[Nice-commit] Nice/src/nice/tools/visibility flat.nice,NONE,1.1
Brought to you by:
bonniot
|
From: Daniel B. <bo...@us...> - 2005-03-11 17:35:57
|
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 (bo...@us...) */ <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; } |