Nice/src/bossa/modules Package.java,1.137,1.138 Content.java,1.17,1.18 Compilation.nice,1.30,1.31 Compilation.java,1.10,1.11

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-serv499/src/bossa/modules

Modified Files:
	Package.java Content.java Compilation.nice Compilation.java 
Log Message:
Made bossa.syntax.Module represent a visibility unit (typically a file).
Scopes are still global. This change will later allow to make each Module have
its own scope, to implement 'private'.


Index: Compilation.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/modules/Compilation.nice,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** Compilation.nice	11 Aug 2004 16:09:36 -0000	1.30
--- Compilation.nice	6 Mar 2005 01:34:27 -0000	1.31
***************
*** 55,58 ****
--- 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)

Index: Package.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v
retrieving revision 1.137
retrieving revision 1.138
diff -C2 -d -r1.137 -r1.138
*** Package.java	28 Feb 2005 14:01:07 -0000	1.137
--- Package.java	6 Mar 2005 01:34:27 -0000	1.138
***************
*** 33,37 ****
     @author Daniel Bonniot ([email protected])
   */
! public class Package implements mlsub.compilation.Module, Located, bossa.syntax.Module
  {
    /****************************************************************
--- 33,37 ----
     @author Daniel Bonniot ([email protected])
   */
! public class Package implements mlsub.compilation.Module, Located
  {
    /****************************************************************
***************
*** 74,77 ****
--- 74,80 ----
      compilation.packages.put(name.toString(), this);
  
+     if (compilation.globalScope == null)
+       compilation.globalScope = bossa.syntax.dispatch.createGlobalVarScope();
+ 
      source = compilation.locator.find(this);
      if (source == null)
***************
*** 113,120 ****
    private void read(boolean shouldReload)
    {
!     Module oldModule = Definition.currentModule;
!     Definition.currentModule = this;
!     Node.setModule(this);
!     
      compilation.progress(this, "parsing");
  
--- 116,121 ----
    private void read(boolean shouldReload)
    {
!     bossa.syntax.Node.setPackage(this);
! 
      compilation.progress(this, "parsing");
  
***************
*** 128,135 ****
        // Inform compilation that at least one package is going to generate code
        compilation.recompilationNeeded = true;
- 
-     Definition.currentModule = oldModule;
    }
!   
    void setOpens(Set opens)
    {
--- 129,134 ----
        // Inform compilation that at least one package is going to generate code
        compilation.recompilationNeeded = true;
    }
! 
    void setOpens(Set opens)
    {
***************
*** 155,160 ****
  	method != null;
  	method = method.getNext())
!       bossa.syntax.dispatch.readImportedAlternative(source.getBytecode(), method,
! 					  location());
    }
    
--- 154,159 ----
  	method != null;
  	method = method.getNext())
!       bossa.syntax.dispatch.readImportedAlternative
!         (source.getBytecode(), method, location(), compiledModule);
    }
    
***************
*** 831,835 ****
    Compilation compilation;
    
!   public Compilation compilation() { return compilation; }
  
    /** 
--- 830,836 ----
    Compilation compilation;
    
!   public Compilation getCompilation() { return compilation; }
! 
!   bossa.syntax.Module compiledModule = null;
  
    /** 

Index: Compilation.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/modules/Compilation.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Compilation.java	11 Aug 2004 16:09:36 -0000	1.10
--- Compilation.java	6 Mar 2005 01:34:27 -0000	1.11
***************
*** 36,39 ****
--- 36,41 ----
    public java.util.Map packages;
    public java.util.Map javaTypeConstructors;
+ 
+   bossa.syntax.VarScope globalScope;
  }
  

Index: Content.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/modules/Content.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Content.java	10 Aug 2004 17:22:19 -0000	1.17
--- Content.java	6 Mar 2005 01:34:27 -0000	1.18
***************
*** 68,72 ****
        readers = source.getDefinitions();
      else
!       readers = compiled.getDefinitions();
  
      LinkedList imports = new LinkedList();
--- 68,75 ----
        readers = source.getDefinitions();
      else
!       {
!         pkg.compiledModule = new bossa.syntax.Module(pkg, pkg.getName(), pkg.compilation.globalScope);
!         readers = compiled.getDefinitions();
!       }
  
      LinkedList imports = new LinkedList();
***************
*** 109,113 ****
--- 112,123 ----
    {
      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;
+ 
      pkg.compilation.parser.read(unit.reader, definitions);
+ 
+     Definition.currentModule = null;
    }
  



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