Nice/src/nice/tools/visibility flat.nice,NONE,1.1

Daniel Bonniot <[email protected]>
Newsgroups gmane.comp.lang.nice.cvs
Message-ID <[email protected]>
Update of /cvsroot/nice/Nice/src/nice/tools/visibility
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23334/src/nice/tools/visibility

Added Files:
	flat.nice 
Log Message:
Each module (and package) now has its own Scope.
All symbols are still public, but only visible to packages that import their
englobing package.


--- NEW FILE: flat.nice ---
/**************************************************************************/
/*                                N I C E                                 */
/*             A high-level object-oriented research language             */
/*                        (c) Daniel Bonniot 2005                         */
/*                                                                        */
/*  This program is free software; you can redistribute it and/or modify  */
/*  it under the terms of the GNU General Public License as published by  */
/*  the Free Software Foundation; either version 2 of the License, or     */
/*  (at your option) any later version.                                   */
/*                                                                        */
/**************************************************************************/

package nice.tools.visibility;

/**
   Flat lookup mode.

   In this mode, symbols in the current scope do not shadow <i>visibile</i>
   symbols in imported scopes.

   @author Daniel Bonniot ([email protected])
 */

<Sym> List<Sym> getFlat(Scope<Sym> this, String key)
{
  List<Sym> res = new LinkedList();

  ?Scope<Sym> s = this;
  while (s != null)
    {
      assert this != null;

      ?List<Sym> temp = s.map[key];
      if (temp != null)
	res.addAll(temp);

      for (o : s.opens)
	{
	  temp = o.publicMap[key];
	  if (temp != null)
	    res.addAll(temp);
	}

      s = s.parent;
    }

  return res;
}



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.