Nice/src/bossa/modules Package.java,1.138,1.139 Content.java,1.18,1.19 Compilation.nice,1.31,1.32 Compilation.java,1.11,1.12

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

Modified Files:
	Package.java Content.java Compilation.nice Compilation.java 
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.


Index: Compilation.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/modules/Compilation.nice,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** Compilation.nice	6 Mar 2005 01:34:27 -0000	1.31
--- Compilation.nice	11 Mar 2005 17:35:54 -0000	1.32
***************
*** 16,19 ****
--- 16,20 ----
  import nice.tools.locator;
  import nice.tools.repository;
+ import nice.tools.visibility;
  
  /**
***************
*** 55,59 ****
    Map<String,Package> packages = new HashMap();
    Map<String,mlsub.typing.TypeConstructor> javaTypeConstructors = new HashMap();
!   bossa.syntax.VarScope globalScope = cast(null);
  
    void setMainPackage(String packageName)
--- 56,63 ----
    Map<String,Package> packages = new HashMap();
    Map<String,mlsub.typing.TypeConstructor> javaTypeConstructors = new HashMap();
!   nice.tools.visibility.Scope</*VarSymbol*/bossa.syntax.Symbol> javaScope =
!     new nice.tools.visibility.Scope(name: "java", parent: null);
! 
!   bossa.syntax.TypeScope globalTypeScope = cast(null);
  
    void setMainPackage(String packageName)

Index: Package.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v
retrieving revision 1.138
retrieving revision 1.139
diff -C2 -d -r1.138 -r1.139
*** Package.java	6 Mar 2005 01:34:27 -0000	1.138
--- Package.java	11 Mar 2005 17:35:53 -0000	1.139
***************
*** 74,79 ****
      compilation.packages.put(name.toString(), this);
  
!     if (compilation.globalScope == null)
!       compilation.globalScope = bossa.syntax.dispatch.createGlobalVarScope();
  
      source = compilation.locator.find(this);
--- 74,78 ----
      compilation.packages.put(name.toString(), this);
  
!     packageScope = new nice.tools.visibility.Scope(getName(), null);
  
      source = compilation.locator.find(this);
***************
*** 102,106 ****
      if (!name.toString().equals("nice.lang") && !Debug.ignorePrelude)
        imports.add(new LocatedString("nice.lang",
! 				    bossa.util.Location.nowhere()));
  
      setOpens(opens);
--- 101,105 ----
      if (!name.toString().equals("nice.lang") && !Debug.ignorePrelude)
        imports.add(new LocatedString("nice.lang",
!                                     bossa.util.Location.nowhere()));
  
      setOpens(opens);
***************
*** 108,112 ****
      List p = this.getImports();
      for (Iterator i = p.iterator(); i.hasNext();)
!       source.someImportModified(((Package) i.next()).lastModification());
    }
  
--- 107,118 ----
      List p = this.getImports();
      for (Iterator i = p.iterator(); i.hasNext();)
!       {
!         Package imported = (Package) i.next();
!         source.someImportModified(imported.lastModification());
!         if (imported != this)
!           packageScope.addImplicitOpen(imported.packageScope);
!       }
! 
!     packageScope.addImplicitOpen(compilation.javaScope);
    }
  
***************
*** 194,198 ****
        {
  	LocatedString s = (LocatedString) i.next();
! 	importedPackages.add(make(s, compilation, false));
        }
    }
--- 200,206 ----
        {
  	LocatedString s = (LocatedString) i.next();
!         Package p = make(s, compilation, false);
!         if (! importedPackages.contains(p))
!           importedPackages.add(p);
        }
    }
***************
*** 834,837 ****
--- 842,847 ----
    bossa.syntax.Module compiledModule = null;
  
+   nice.tools.visibility.Scope packageScope;
+ 
    /** 
        @return true if this package was loaded from an interface file,

Index: Compilation.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/modules/Compilation.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Compilation.java	6 Mar 2005 01:34:27 -0000	1.11
--- Compilation.java	11 Mar 2005 17:35:54 -0000	1.12
***************
*** 37,41 ****
    public java.util.Map javaTypeConstructors;
  
!   bossa.syntax.VarScope globalScope;
  }
  
--- 37,42 ----
    public java.util.Map javaTypeConstructors;
  
!   nice.tools.visibility.Scope javaScope;
!   public bossa.syntax.TypeScope globalTypeScope;
  }
  

Index: Content.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/modules/Content.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Content.java	6 Mar 2005 01:34:27 -0000	1.18
--- Content.java	11 Mar 2005 17:35:54 -0000	1.19
***************
*** 69,73 ****
      else
        {
!         pkg.compiledModule = new bossa.syntax.Module(pkg, pkg.getName(), pkg.compilation.globalScope);
          readers = compiled.getDefinitions();
        }
--- 69,74 ----
      else
        {
!         pkg.compiledModule =
!           new bossa.syntax.Module(pkg, pkg.getName(), pkg.packageScope);
          readers = compiled.getDefinitions();
        }
***************
*** 113,118 ****
      bossa.util.Location.setCurrentFile(unit.file);
  
!     bossa.syntax.Module module = pkg.compiledModule != null ?
!       pkg.compiledModule : new bossa.syntax.Module(pkg, unit.name, pkg.compilation.globalScope);
      Definition.currentModule = module;
  
--- 114,129 ----
      bossa.util.Location.setCurrentFile(unit.file);
  
!     bossa.syntax.Module module;
! 
!     if (pkg.compiledModule != null)
!       module = pkg.compiledModule;
!     else
!       {
!         nice.tools.visibility.Scope scope =
!           new nice.tools.visibility.Scope(unit.name, pkg.packageScope);
! 
!         module = new bossa.syntax.Module(pkg, unit.name, scope);
!       }
! 
      Definition.currentModule = module;
  



-------------------------------------------------------
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.