Nice/src/bossa/syntax typedef.nice,1.19,1.20 tools.nice,1.103,1.104 scope.nice,1.3,1.4 retypedMethod.nice,1.7,1.8 pattern.nice,1.20,1.21 nicefieldaccess.nice,1.11,1.12 niceclass.nice,1.25,1.26 niceMethod.nice,1.19,1.20 methodbody.nice,1.12,1.13 methodImplementation.nice,1.13,1.14 methodDeclaration.nice,1.3,1.4 methodContainer.nice,1.4,1.5 javaclass.nice,1.6,1.7 javaMethod.nice,1.8,1.9 javaFieldAccess.nice,1.6,1.7 inline.nice,1.4,1.5 importedconstructor.nice,1.15,1.16 globalvar.nice,1.6,1.7 enum.nice,1.18,1.19 dispatch.java.bootstrap,1.53,1.54 defaultMethod.nice,1.8,1.9 customConstructor.nice,1.23,1.24 ast.nice,1.1,1.2 analyse.nice,1.132,1.133 alternative.nice,1.10,1.11 ai.nice,1.6,1.7 VarScope.java,1.21,1.22 TypeScope.java,1.42,1.43 Node.java,1.67,1.68 Module.java,1.24,1.25 Definition.java,1.26,1.27

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

Modified Files:
	typedef.nice tools.nice scope.nice retypedMethod.nice 
	pattern.nice nicefieldaccess.nice niceclass.nice 
	niceMethod.nice methodbody.nice methodImplementation.nice 
	methodDeclaration.nice methodContainer.nice javaclass.nice 
	javaMethod.nice javaFieldAccess.nice inline.nice 
	importedconstructor.nice globalvar.nice enum.nice 
	dispatch.java.bootstrap defaultMethod.nice 
	customConstructor.nice ast.nice analyse.nice alternative.nice 
	ai.nice VarScope.java TypeScope.java Node.java Module.java 
	Definition.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: scope.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/scope.nice,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** scope.nice	20 Dec 2004 20:25:53 -0000	1.3
--- scope.nice	6 Mar 2005 01:34:26 -0000	1.4
***************
*** 22,29 ****
    {
      // If there is any method by that name waiting, load it.
!     loadJavaMethods(i.toString());
  
      return super;
    }
  }
  
--- 22,31 ----
    {
      // If there is any method by that name waiting, load it.
!     loadJavaMethods(i.toString(), this);
  
      return super;
    }
+ 
+   globalLookup(i) = this.lookup(i);
  }
  
***************
*** 39,51 ****
  public class GlobalTypeScope extends TypeScope
  {
!   public Module module = cast(null);
!   private Set<String> set;
  
!   setModule(mod)
    {
!     module = notNull(mod);
    }
  
!   getModule() = module;
  
    addMapping(name, s)
--- 41,53 ----
  public class GlobalTypeScope extends TypeScope
  {
!   public bossa.modules.Package pkg = cast(null);
!   private Set<String> set = new HashSet();
  
!   setPackage(bossa.modules.Package pkg)
    {
!     this.pkg = pkg;
    }
  
!   getPackage() = pkg;
  
    addMapping(name, s)
***************
*** 91,95 ****
  	*/
  	boolean first = true;
! 	String[] pkgs = module.listImplicitPackages();
  	for (int i = 0; i < pkgs.length; i++)
  	  {
--- 93,97 ----
  	*/
  	boolean first = true;
! 	String[] pkgs = pkg.listImplicitPackages();
  	for (int i = 0; i < pkgs.length; i++)
  	  {
***************
*** 113,117 ****
        return res;
  
!     return cast(lookupJavaClass(notNull(name), loc));
    }
  }
--- 115,119 ----
        return res;
  
!     return cast(lookupJavaClass(notNull(name), loc, Module.javaScope));
    }
  }
***************
*** 119,123 ****
  TypeScope createGlobalTypeScope()
  {
!   let res = new GlobalTypeScope(null, set: new HashSet());
  
    try {
--- 121,125 ----
  TypeScope createGlobalTypeScope()
  {
!   let res = new GlobalTypeScope(null);
  
    try {

Index: enum.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/enum.nice,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** enum.nice	1 Mar 2005 17:36:36 -0000	1.18
--- enum.nice	6 Mar 2005 01:34:26 -0000	1.19
***************
*** 78,82 ****
    classDef.setImplementation(impl);
  
!   if (! notNull(Definition.currentModule).interfaceFile())
      // create the method implementation of family()
      globalDefs.add(createMethodBodyDefinition(impl, new LocatedString("family"),
--- 78,82 ----
    classDef.setImplementation(impl);
  
!   if (! notNull(Definition.currentModule).compiled())
      // create the method implementation of family()
      globalDefs.add(createMethodBodyDefinition(impl, new LocatedString("family"),
***************
*** 134,138 ****
            res = new gnu.expr.Declaration(notNull(name).toString(), nice.tools.code.Types.javaType(type));
            this.setDeclaration(notNull(res));
!           definition.module.addGlobalVar(res, true);
        }
      
--- 134,138 ----
            res = new gnu.expr.Declaration(notNull(name).toString(), nice.tools.code.Types.javaType(type));
            this.setDeclaration(notNull(res));
!           definition.module.pkg.addGlobalVar(res, true);
        }
      

Index: globalvar.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/globalvar.nice,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** globalvar.nice	16 Jan 2005 00:28:21 -0000	1.6
--- globalvar.nice	6 Mar 2005 01:34:26 -0000	1.7
***************
*** 81,85 ****
            }
  
!         definition.module.addGlobalVar(res, definition.constant);
        }
  
--- 81,85 ----
            }
  
!         definition.module.pkg.addGlobalVar(res, definition.constant);
        }
  

Index: niceclass.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** niceclass.nice	4 Mar 2005 02:25:03 -0000	1.25
--- niceclass.nice	6 Mar 2005 01:34:26 -0000	1.26
***************
*** 67,71 ****
         and only adds or modifies features when needed.
      */
!     classe = notNull(definition.module).getClassExp(this);
    }
  
--- 67,71 ----
         and only adds or modifies features when needed.
      */
!     classe = definition.module.pkg.getClassExp(this);
    }
  
***************
*** 386,390 ****
      res.setSimple(true);
      res.setAccessFlags(definition.getBytecodeFlags());
!     definition.module.addUserClass(res);
      return res;
    }
--- 386,390 ----
      res.setSimple(true);
      res.setAccessFlags(definition.getBytecodeFlags());
!     definition.module.pkg.addUserClass(res);
      return res;
    }

Index: javaMethod.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaMethod.nice,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** javaMethod.nice	16 Jan 2005 00:28:21 -0000	1.8
--- javaMethod.nice	6 Mar 2005 01:34:26 -0000	1.9
***************
*** 208,212 ****
   * to make them available to the nice code.
   */
! void fetchMethods(mlsub.typing.TypeConstructor tc, gnu.bytecode.ClassType classType)
  {
    try {
--- 208,212 ----
   * to make them available to the nice code.
   */
! void fetchMethods(mlsub.typing.TypeConstructor tc, gnu.bytecode.ClassType classType, VarScope scope)
  {
    try {
***************
*** 215,219 ****
      for (?gnu.bytecode.Field f = classType.getFields(); f != null; f = f.getNext())
        if (retyped.get(f) == null)
!         addJavaSymbol(f, makeJavaFieldAccess(f));
  
      for (?gnu.bytecode.Method m = classType.getMethods(); m != null; m = m.getNext())
--- 215,219 ----
      for (?gnu.bytecode.Field f = classType.getFields(); f != null; f = f.getNext())
        if (retyped.get(f) == null)
!         addJavaSymbol(f, makeJavaFieldAccess(f), scope);
  
      for (?gnu.bytecode.Method m = classType.getMethods(); m != null; m = m.getNext())
***************
*** 301,305 ****
  
  /** Called when the given name is going to be needed. */
! void loadJavaMethods(String name)
  {
    ?List<gnu.bytecode.Method> methods = knownMethods.get(name);
--- 301,305 ----
  
  /** Called when the given name is going to be needed. */
! void loadJavaMethods(String name, VarScope scope)
  {
    ?List<gnu.bytecode.Method> methods = knownMethods.get(name);
***************
*** 316,329 ****
           continue;
  
!        addJavaSymbol(m, makeJavaMethod(m, false));
      }
  }
  
! void addJavaSymbol(gnu.bytecode.AttrContainer m, ?MethodDeclaration def)
  {
!   if (def == null || Node.getGlobalScope() == null)
      return;
  
!   Node.getGlobalScope().addSymbol(def.getSymbol());
    retyped.put(m, def);
  }
--- 316,329 ----
           continue;
  
!        addJavaSymbol(m, makeJavaMethod(m, false), scope);
      }
  }
  
! void addJavaSymbol(gnu.bytecode.AttrContainer m, ?MethodDeclaration def, VarScope scope)
  {
!   if (def == null)
      return;
  
!   scope.addSymbol(def.getSymbol());
    retyped.put(m, def);
  }

Index: Definition.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Definition.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** Definition.java	26 Nov 2004 20:26:02 -0000	1.26
--- Definition.java	6 Mar 2005 01:34:26 -0000	1.27
***************
*** 70,74 ****
    public boolean inInterfaceFile()
    {
!     return module.interfaceFile();
    }
  
--- 70,74 ----
    public boolean inInterfaceFile()
    {
!     return module.compiled();
    }
  

Index: retypedMethod.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/retypedMethod.nice,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** retypedMethod.nice	16 Jan 2005 21:51:15 -0000	1.7
--- retypedMethod.nice	6 Mar 2005 01:34:26 -0000	1.8
***************
*** 238,245 ****
  
    res.addChild(parameters);
!   let symbol = new MethodSymbol(res, name, constraint, returnType);
!   res.symbol = symbol;
!   symbol.propagate = Node.global;
!   res.addChild(symbol);
    return res;
  }
--- 238,242 ----
  
    res.addChild(parameters);
!   res.setSymbol(new MethodSymbol(res, name, constraint, returnType));
    return res;
  }
***************
*** 254,258 ****
  let Map<gnu.bytecode.AttrContainer,MethodDeclaration> retyped = new HashMap();
  
! void registerNativeMethod(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod)
  {
    ?MethodDeclaration auto = retyped.put(reflectMethod, m);
--- 251,255 ----
  let Map<gnu.bytecode.AttrContainer,MethodDeclaration> retyped = new HashMap();
  
! private void registerNativeMethod(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod)
  {
    ?MethodDeclaration auto = retyped.put(reflectMethod, m);
***************
*** 269,273 ****
  }
  
! void registerNativeConstructor(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod,
                                   mlsub.typing.TypeConstructor classe)
  {
--- 266,270 ----
  }
  
! private void registerNativeConstructor(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod,
                                   mlsub.typing.TypeConstructor classe)
  {
***************
*** 294,298 ****
  private void removeFromScope(MethodDeclaration m)
  {
!   Node.getGlobalScope().removeSymbol(m.getSymbol());
    unregisterDispatchTest(m);
  }
--- 291,295 ----
  private void removeFromScope(MethodDeclaration m)
  {
!   Module.javaScope.removeSymbol(m.getSymbol());
    unregisterDispatchTest(m);
  }

Index: niceMethod.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** niceMethod.nice	28 Feb 2005 14:01:07 -0000	1.19
--- niceMethod.nice	6 Mar 2005 01:34:26 -0000	1.20
***************
*** 44,50 ****
      // any other known method, there is an explicit override keyword.
      // So we can avoid looking for specializations when there isn't one.
!     if (isOverride || ! module.interfaceFile())
        {
!         homonyms = Node.getGlobalScope().lookup(this.getName());
          if (notNull(homonyms).size() == 1)
            homonyms = null;
--- 44,50 ----
      // any other known method, there is an explicit override keyword.
      // So we can avoid looking for specializations when there isn't one.
!     if (isOverride || ! module.compiled())
        {
!         homonyms = module.scope.lookup(this.getName());
          if (notNull(homonyms).size() == 1)
            homonyms = null;
***************
*** 113,117 ****
              // If the method is imported,
              // check if the reverse relation holds with that method
!             if (d.module != null && d.module.interfaceFile() &&
                  mlsub.typing.Typing.smaller(itsDomain, ourDomain, true) &&
                  ! nice.tools.typing.Types.typeParameterDispatch(s.getType(), this.getType()))
--- 113,117 ----
              // If the method is imported,
              // check if the reverse relation holds with that method
!             if (d.module != null && d.module.compiled() &&
                  mlsub.typing.Typing.smaller(itsDomain, ourDomain, true) &&
                  ! nice.tools.typing.Types.typeParameterDispatch(s.getType(), this.getType()))
***************
*** 136,140 ****
  
          // In a compiled package, we don't need checking.
!         if (module.interfaceFile())
            {
              this.addSpecializedMethod(d);
--- 136,140 ----
  
          // In a compiled package, we don't need checking.
!         if (module.compiled())
            {
              this.addSpecializedMethod(d);
***************
*** 181,185 ****
  
    /** @return a string that uniquely represents this method */
!   getFullName() = module.getName() + '.' + name + ':' + this.getType();
  
    computeCode() = getDispatchMethod(this, module);
--- 181,185 ----
  
    /** @return a string that uniquely represents this method */
!   getFullName() = module.pkg.getName() + '.' + name + ':' + this.getType();
  
    computeCode() = getDispatchMethod(this, module);
***************
*** 213,221 ****
  
    res.addChild(parameters);
!   let symbol = new MethodSymbol(res, name, constraint, returnType);
!   res.symbol = symbol;
!   symbol.propagate = Node.global;
!   res.addChild(symbol);
!   return res; 
  }
  
--- 213,218 ----
  
    res.addChild(parameters);
!   res.setSymbol(new MethodSymbol(res, name, constraint, returnType));
!   return res;
  }
  
***************
*** 353,357 ****
        as the precise types are found during typechecking.
    */
!   ?gnu.bytecode.Method meth = module.lookupDispatchClassMethod
     (receiver == null ? null : receiver.getClassType(),
      name, "id", def.getFullName());
--- 350,354 ----
        as the precise types are found during typechecking.
    */
!   ?gnu.bytecode.Method meth = module.pkg.lookupDispatchClassMethod
     (receiver == null ? null : receiver.getClassType(),
      name, "id", def.getFullName());
***************
*** 389,392 ****
      return receiver.addJavaMethod(res);
    else
!     return module.addMethod(res, false);
  }
--- 386,389 ----
      return receiver.addJavaMethod(res);
    else
!     return module.pkg.addMethod(res, false);
  }

Index: methodbody.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodbody.nice,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** methodbody.nice	16 Jan 2005 00:28:21 -0000	1.12
--- methodbody.nice	6 Mar 2005 01:34:26 -0000	1.13
***************
*** 253,257 ****
      //Resolution of the body is delayed to enable overloading
  
!     resolvePatterns(notNull(typeScope), Node.getGlobalScope(), formals);
  
      symbols = notNull(scope).lookup(name);
--- 253,257 ----
      //Resolution of the body is delayed to enable overloading
  
!     resolvePatterns(notNull(typeScope), module.scope, formals);
  
      symbols = notNull(scope).lookup(name);
***************
*** 260,264 ****
    void lateBuildScope()
    {
!     resolvePatternValues(formals);
  
      let s = this.findSymbol(notNull(symbols));
--- 260,264 ----
    void lateBuildScope()
    {
!     resolvePatternValues(formals, module.scope);
  
      let s = this.findSymbol(notNull(symbols));

Index: VarScope.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarScope.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** VarScope.java	14 Jan 2005 18:53:54 -0000	1.21
--- VarScope.java	6 Mar 2005 01:34:26 -0000	1.22
***************
*** 83,86 ****
--- 83,94 ----
    }
  
+   List globalLookup(LocatedString i)
+   {
+     if (outer != null)
+       return outer.globalLookup(i);
+     else
+       return null;
+   }
+ 
    /****************************************************************
     * Debugging

Index: methodContainer.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodContainer.nice,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** methodContainer.nice	16 Feb 2005 12:13:17 -0000	1.4
--- methodContainer.nice	6 Mar 2005 01:34:26 -0000	1.5
***************
*** 32,36 ****
  
    {
!     this.name.prepend(module.getName() + ".");
    }
  
--- 32,36 ----
  
    {
!     this.name.prepend(module.pkg.getName() + ".");
    }
  

Index: javaFieldAccess.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaFieldAccess.nice,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** javaFieldAccess.nice	12 Feb 2005 14:44:30 -0000	1.6
--- javaFieldAccess.nice	6 Mar 2005 01:34:26 -0000	1.7
***************
*** 119,126 ****
  	fieldName : fieldName );
    res.addChild(parameters);
!   let symbol = new MethodSymbol(res, name, cst, returnType);
!   res.symbol = symbol;
!   symbol.propagate = Node.global;
!   res.addChild(symbol);
    return res;
  }
--- 119,123 ----
  	fieldName : fieldName );
    res.addChild(parameters);
!   res.setSymbol(new MethodSymbol(res, name, cst, returnType));
    return res;
  }

Index: nicefieldaccess.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/nicefieldaccess.nice,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** nicefieldaccess.nice	14 Jan 2005 16:41:27 -0000	1.11
--- nicefieldaccess.nice	6 Mar 2005 01:34:26 -0000	1.12
***************
*** 56,63 ****
  
    res.addChild(params);
!   let symbol = new MethodSymbol(res, field.getName(), constr, notNull(field.sym.syntacticType));
!   res.symbol = symbol;
!   symbol.propagate = Node.global;
!   res.addChild(symbol);
!   return res;    
  }
--- 56,60 ----
  
    res.addChild(params);
!   res.setSymbol(new MethodSymbol(res, field.getName(), constr, notNull(field.sym.syntacticType)));
!   return res;
  }

Index: alternative.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/alternative.nice,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** alternative.nice	16 Jan 2005 21:51:15 -0000	1.10
--- alternative.nice	6 Mar 2005 01:34:26 -0000	1.11
***************
*** 374,378 ****
   * When read from a bytecode file.
   */
! public void readImportedAlternative(gnu.bytecode.ClassType c, gnu.bytecode.Method method, Location location)
  {
    ?gnu.bytecode.MiscAttr defattr = cast(gnu.bytecode.Attribute.get(method, "definition"));
--- 374,378 ----
   * When read from a bytecode file.
   */
! public void readImportedAlternative(gnu.bytecode.ClassType c, gnu.bytecode.Method method, Location location, Module module)
  {
    ?gnu.bytecode.MiscAttr defattr = cast(gnu.bytecode.Attribute.get(method, "definition"));
***************
*** 383,387 ****
    String fullName = new String(defattr.data);
  
!   registerJavaMethod(fullName);
  
    ?gnu.bytecode.MiscAttr attr = cast(gnu.bytecode.Attribute.get(method, "patterns"));
--- 383,387 ----
    String fullName = new String(defattr.data);
  
!   registerJavaMethod(fullName, module.scope);
  
    ?gnu.bytecode.MiscAttr attr = cast(gnu.bytecode.Attribute.get(method, "patterns"));
***************
*** 398,402 ****
      ?Pattern p;
  
!     while ((p = readPattern(rep, at)) != null)
        {
          if (p.getTC() == nice.tools.typing.PrimitiveType.arrayTC)
--- 398,402 ----
      ?Pattern p;
  
!     while ((p = readPattern(rep, at, module.scope)) != null)
        {
          if (p.getTC() == nice.tools.typing.PrimitiveType.arrayTC)
***************
*** 430,434 ****
     to the link tests and dispatch code generation.
  */
! private void registerJavaMethod(String fullName)
  {
    if (! fullName.startsWith("JAVA:"))
--- 430,434 ----
     to the link tests and dispatch code generation.
  */
! private void registerJavaMethod(String fullName, VarScope scope)
  {
    if (! fullName.startsWith("JAVA:"))
***************
*** 439,443 ****
  	bossa.util.Location.nowhere());
  
!   for (VarSymbol sym : bossa.syntax.Node.getGlobalScope().lookup(methodName))
      {
        if (sym.getMethodDeclaration() == null)
--- 439,443 ----
  	bossa.util.Location.nowhere());
  
!   for (VarSymbol sym : scope.lookup(methodName))
      {
        if (sym.getMethodDeclaration() == null)
***************
*** 451,453 ****
          }
      }
! }
\ No newline at end of file
--- 451,453 ----
          }
      }
! }

Index: inline.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/inline.nice,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** inline.nice	16 Jan 2005 00:28:21 -0000	1.4
--- inline.nice	6 Mar 2005 01:34:26 -0000	1.5
***************
*** 145,152 ****
  
    res.addChild(parameters);
!   let symbol = new MethodSymbol(res, name, constraint, returnType);
!   res.symbol = symbol;
!   symbol.propagate = Node.global;
!   res.addChild(symbol);
!   return res; 
  }
--- 145,149 ----
  
    res.addChild(parameters);
!   res.setSymbol(new MethodSymbol(res, name, constraint, returnType));
!   return res;
  }

Index: Module.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Module.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** Module.java	28 Feb 2005 14:01:07 -0000	1.24
--- Module.java	6 Mar 2005 01:34:26 -0000	1.25
***************
*** 1,6 ****
  /**************************************************************************/
! /*                             N I C E                                    */
! /*        A simple imperative object-oriented research language           */
! /*                   (c)  Daniel Bonniot 1999                             */
  /*                                                                        */
  /*  This program is free software; you can redistribute it and/or modify  */
--- 1,6 ----
  /**************************************************************************/
! /*                                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  */
***************
*** 14,39 ****
  
  /**
!    A Nice module.
  
!    @version $Date$
!    @author Daniel Bonniot
   */
  
! public interface Module extends mlsub.compilation.Module
  {
!   String[] listImplicitPackages();
!   bossa.modules.Compilation compilation();
!   boolean interfaceFile();
  
!   /****************************************************************
!    * Code generation
!    ****************************************************************/
  
!   gnu.bytecode.ClassType createClass(String name);
!   void addGlobalVar(gnu.expr.Declaration declaration, boolean constant);
!   gnu.bytecode.Method lookupDispatchClassMethod(gnu.bytecode.ClassType clas, String name, String attribute, String value);
!   gnu.expr.ReferenceExp addMethod(gnu.expr.LambdaExp method, 
! 				  boolean packageMethod);
!   gnu.expr.ClassExp getClassExp(Object def);
!   void addUserClass(gnu.expr.ClassExp classe);
  }
--- 14,41 ----
  
  /**
!    The smallest unit containing code (typically, the content of a file).
  
!    Definitions marked as 'private' are only visible inside their Module.
   */
  
! public class Module
  {
!   public final bossa.modules.Package pkg;
!   VarScope scope;
!   String name;
  
!   static VarScope javaScope;
  
!   public Module(bossa.modules.Package pkg, String name, VarScope scope)
!   {
!     this.pkg = pkg;
!     this.name = name;
!     this.scope = scope;
! 
!     javaScope = scope;
!   }
! 
!   bossa.modules.Compilation compilation() { return pkg.getCompilation(); }
! 
!   public boolean compiled() { return pkg.interfaceFile(); }
  }

Index: analyse.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v
retrieving revision 1.132
retrieving revision 1.133
diff -C2 -d -r1.132 -r1.133
*** analyse.nice	4 Mar 2005 02:25:03 -0000	1.132
--- analyse.nice	6 Mar 2005 01:34:26 -0000	1.133
***************
*** 178,184 ****
    ?VarSymbol lookup(String name) = this.vars[name];
  
!   List<VarSymbol> globalLookup(LocatedString name) = 
      this.outerVarScope.lookup(name);
  
    ?mlsub.typing.TypeSymbol lookupType(LocatedString name)
    {
--- 178,187 ----
    ?VarSymbol lookup(String name) = this.vars[name];
  
!   List<VarSymbol> outerLookup(LocatedString name) =
      this.outerVarScope.lookup(name);
  
+   List<VarSymbol> globalLookup(LocatedString name) =
+     this.outerVarScope.globalLookup(name);
+ 
    ?mlsub.typing.TypeSymbol lookupType(LocatedString name)
    {
***************
*** 510,516 ****
    ?List<VarSymbol> symbols;
    if (e.isInfix())
-     symbols = cast(notNull(Node.getGlobalScope()).lookup(e.ident));
-   else
      symbols = info.globalLookup(e.ident);
  
    if (symbols != null && symbols.size() > 0)
--- 513,519 ----
    ?List<VarSymbol> symbols;
    if (e.isInfix())
      symbols = info.globalLookup(e.ident);
+   else
+     symbols = info.outerLookup(e.ident);
  
    if (symbols != null && symbols.size() > 0)

Index: customConstructor.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** customConstructor.nice	22 Feb 2005 13:09:44 -0000	1.23
--- customConstructor.nice	6 Mar 2005 01:34:26 -0000	1.24
***************
*** 155,162 ****
  
    res.addChild(params);
!   let symbol = new MethodSymbol(res, name, cst, returnType);
!   res.symbol = symbol;
!   symbol.propagate = Node.global;
!   res.addChild(symbol);
    return res;
  }
--- 155,159 ----
  
    res.addChild(params);
!   res.setSymbol(new MethodSymbol(res, name, cst, returnType));
    return res;
  }

Index: Node.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Node.java,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -d -r1.67 -r1.68
*** Node.java	13 Jan 2005 16:47:33 -0000	1.67
--- Node.java	6 Mar 2005 01:34:26 -0000	1.68
***************
*** 118,127 ****
     */
  
-   private static VarScope globalScope;
-   public static final VarScope getGlobalScope()
-   {
-     return globalScope;
-   }
-   
    private static TypeScope globalTypeScope;
    public static final TypeScope getGlobalTypeScope()
--- 118,121 ----
***************
*** 130,136 ****
    }
  
!   public static final Module getGlobalTypeScopeModule()
    {
!     return globalTypeScope.getModule();
    }
  
--- 124,130 ----
    }
  
!   public static final bossa.modules.Package getGlobalTypeScopeModule()
    {
!     return globalTypeScope.getPackage();
    }
  
***************
*** 142,162 ****
    public static bossa.modules.Compilation compilation = null;
  
!   public static void setModule(Module module)
    {
      // For multiple compilations in the same JVM:
      // If we are starting a new compilation, reset the global scopes.
!     if (compilation != module.compilation())
        {
!         compilation = module.compilation();
! 	globalScope = dispatch.createGlobalVarScope();
  	globalTypeScope = dispatch.createGlobalTypeScope();
        }
!     globalTypeScope.setModule(module);
    }
  
!   void buildScope(Module module)
    {
!     setModule(module);
!     buildScope(globalScope, globalTypeScope);
    }
    
--- 136,155 ----
    public static bossa.modules.Compilation compilation = null;
  
!   public static void setPackage(bossa.modules.Package pkg)
    {
      // For multiple compilations in the same JVM:
      // If we are starting a new compilation, reset the global scopes.
!     if (compilation != pkg.getCompilation())
        {
!         compilation = pkg.getCompilation();
  	globalTypeScope = dispatch.createGlobalTypeScope();
        }
!     globalTypeScope.setPackage(pkg);
    }
  
!   void buildScope(bossa.modules.Package pkg)
    {
!     setPackage(pkg);
!     buildScope(null, globalTypeScope);
    }
    
***************
*** 169,172 ****
--- 162,168 ----
      //Internal.error("Scope set twice for " + this + this.getClass());
  
+     if (this instanceof Definition)
+       outer = ((Definition) this).module.scope;
+ 
      switch(propagate)
        {
***************
*** 181,187 ****
  
        case global:
- 	outer = globalScope;
- 	outer.addSymbols(varSymbols);
  	this.scope = outer;
  	typeOuter = globalTypeScope;
  	this.typeScope = typeOuter;
--- 177,182 ----
  
        case global:
  	this.scope = outer;
+ 	this.scope.addSymbols(varSymbols);
  	typeOuter = globalTypeScope;
  	this.typeScope = typeOuter;
***************
*** 310,314 ****
          }
          catch(UserError ex){
!           globalTypeScope.getModule().compilation().error(ex);
  	}
    }
--- 305,309 ----
          }
          catch(UserError ex){
!           globalTypeScope.getPackage().getCompilation().error(ex);
  	}
    }

Index: ai.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ai.nice,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ai.nice	16 Jan 2005 00:28:21 -0000	1.6
--- ai.nice	6 Mar 2005 01:34:26 -0000	1.7
***************
*** 113,117 ****
  
      let ident = new TypeIdent
!       (name: new LocatedString(module.getName() + '.' + interfaceName.content, 
  			 interfaceName.location()));
      interfaceITF = ident.resolveToItf(notNull(typeScope));
--- 113,117 ----
  
      let ident = new TypeIdent
!       (name: new LocatedString(module.pkg.getName() + '.' + interfaceName.content, 
  			 interfaceName.location()));
      interfaceITF = ident.resolveToItf(notNull(typeScope));

Index: typedef.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typedef.nice,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** typedef.nice	16 Feb 2005 22:35:06 -0000	1.19
--- typedef.nice	6 Mar 2005 01:34:26 -0000	1.20
***************
*** 482,488 ****
  		     superClass + " is an interface, so " + name +
  		     " may only implement it");
!         if (! nice.tools.code.Types.legalAccess(superClass, module.getName()))
!           User.error(superClassIdent, name + " cannot extend " + 
! 		     superClass + ".  It is not available to this package.");
  
          superClassIdent = null;
--- 482,488 ----
  		     superClass + " is an interface, so " + name +
  		     " may only implement it");
!         if (! nice.tools.code.Types.legalAccess(superClass, module.pkg.getName()))
!           User.error(superClassIdent, name + " cannot extend " +
! 		     superClass + ".  It is not visible in this package.");
  
          superClassIdent = null;

Index: methodDeclaration.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodDeclaration.nice,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** methodDeclaration.nice	14 Jan 2005 16:41:27 -0000	1.3
--- methodDeclaration.nice	6 Mar 2005 01:34:26 -0000	1.4
***************
*** 37,40 ****
--- 37,53 ----
    ?gnu.expr.Expression code = null;
  
+   void setSymbol(MethodSymbol symbol)
+   {
+     this.symbol = symbol;
+     symbol.propagate = Node.none;
+     this.addChild(symbol);
+   }
+ 
+   buildScope(outer, typeOuter)
+   {
+     module.scope.addSymbol(symbol);
+     super;
+   }
+ 
    public ?mlsub.typing.Polytype getType()
    {
***************
*** 67,71 ****
    void typedResolve()
    {
!     if (module.interfaceFile() && ! notNull(parameters).hasDefaultValue())
        return;
  
--- 80,84 ----
    void typedResolve()
    {
!     if (module.compiled() && ! notNull(parameters).hasDefaultValue())
        return;
  

Index: methodImplementation.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodImplementation.nice,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** methodImplementation.nice	20 Feb 2005 22:09:40 -0000	1.13
--- methodImplementation.nice	6 Mar 2005 01:34:26 -0000	1.14
***************
*** 165,169 ****
    {
      this.createMethod(name.toString());
!     gnu.expr.ReferenceExp ref = module.addMethod(compiledMethod, true);
  
      return ref;
--- 165,169 ----
    {
      this.createMethod(name.toString());
!     gnu.expr.ReferenceExp ref = module.pkg.addMethod(compiledMethod, true);
  
      return ref;

Index: TypeScope.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeScope.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** TypeScope.java	16 Feb 2005 22:35:06 -0000	1.42
--- TypeScope.java	6 Mar 2005 01:34:26 -0000	1.43
***************
*** 32,37 ****
  
    // only for GlobalTypeScope
!   void setModule(Module mod) {}
!   Module getModule() { return null; }
    public mlsub.typing.TypeConstructor globalLookup(String name, Location loc)
    { return null; }
--- 32,37 ----
  
    // only for GlobalTypeScope
!   void setPackage(bossa.modules.Package pkg) {}
!   bossa.modules.Package getPackage() { return null; }
    public mlsub.typing.TypeConstructor globalLookup(String name, Location loc)
    { return null; }

Index: pattern.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/pattern.nice,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** pattern.nice	12 Feb 2005 17:48:39 -0000	1.20
--- pattern.nice	6 Mar 2005 01:34:26 -0000	1.21
***************
*** 213,220 ****
  }
   
! void resolvePatternValues(Pattern[] patterns)
  {
    for (int i = 0; i < patterns.length; i++)
!     patterns[i] = resolveGlobalConstants(patterns[i]);
  }
   
--- 213,220 ----
  }
   
! void resolvePatternValues(Pattern[] patterns, VarScope scope)
  {
    for (int i = 0; i < patterns.length; i++)
!     patterns[i] = resolveGlobalConstants(patterns[i], scope);
  }
   
***************
*** 691,697 ****
  
  
! private ?VarSymbol findRefSymbol(LocatedString refName)
  {
!   for (sym : Node.getGlobalScope().lookup(refName))
      if (sym instanceof GlobalVarSymbol ||
  	sym instanceof EnumSymbol )
--- 691,697 ----
  
  
! private ?VarSymbol findRefSymbol(LocatedString refName, VarScope scope)
  {
!   for (sym : scope.lookup(refName))
      if (sym instanceof GlobalVarSymbol ||
  	sym instanceof EnumSymbol )
***************
*** 701,714 ****
  }
  
! Pattern resolveGlobalConstants(Pattern pattern)
  {
    return pattern;
  }
  
! resolveGlobalConstants(IntComparePattern pattern)
  {
    if (pattern.refName != null)
      {
!       let symbol = findRefSymbol(notNull(pattern.refName));
        if (symbol instanceof GlobalVarSymbol)
  	{
--- 701,714 ----
  }
  
! Pattern resolveGlobalConstants(Pattern pattern, VarScope scope)
  {
    return pattern;
  }
  
! resolveGlobalConstants(IntComparePattern pattern, scope)
  {
    if (pattern.refName != null)
      {
!       let symbol = findRefSymbol(notNull(pattern.refName), scope);
        if (symbol instanceof GlobalVarSymbol)
  	{
***************
*** 725,734 ****
  }
  
! resolveGlobalConstants(VariablePattern pattern)
  {
    if (pattern.name == null)
      return pattern;
  
!   let symbol = findRefSymbol(notNull(pattern.name));
    if (symbol == null)
      return pattern;
--- 725,734 ----
  }
  
! resolveGlobalConstants(VariablePattern pattern, scope)
  {
    if (pattern.name == null)
      return pattern;
  
!   let symbol = findRefSymbol(notNull(pattern.name), scope);
    if (symbol == null)
      return pattern;
***************
*** 783,787 ****
  bytecodeRepresentation(ReferencePattern p) = "@=" + p.name;
  
! public ?Pattern readPattern(String rep, int[]/*ref*/ pos)
  {
    int cpos = pos[0];
--- 783,787 ----
  bytecodeRepresentation(ReferencePattern p) = "@=" + p.name;
  
! public ?Pattern readPattern(String rep, int[]/*ref*/ pos, VarScope scope)
  {
    int cpos = pos[0];
***************
*** 845,849 ****
  
        if (name[0] == '=')
!         return resolveGlobalConstants(new VariablePattern(name: new LocatedString(name.substring(1)), loc: loc));
      }
  
--- 845,849 ----
  
        if (name[0] == '=')
!         return resolveGlobalConstants(new VariablePattern(name: new LocatedString(name.substring(1)), loc: loc), scope);
      }
  

Index: javaclass.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaclass.nice,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** javaclass.nice	16 Jan 2005 00:28:21 -0000	1.6
--- javaclass.nice	6 Mar 2005 01:34:26 -0000	1.7
***************
*** 72,76 ****
        return;
  
!     fetchMethods(definition.getTC(), cast(definition.getJavaType()));
    }
  
--- 72,76 ----
        return;
  
!     fetchMethods(definition.getTC(), cast(definition.getJavaType()), Module.javaScope);
    }
  
***************
*** 114,119 ****
  }
  
! mlsub.typing.TypeConstructor createJavaType(bossa.modules.Compilation compilation, String className,
!                                  gnu.bytecode.Type javaType)
  {
    if (bossa.util.Debug.javaTypes)
--- 114,120 ----
  }
  
! mlsub.typing.TypeConstructor createJavaType
!   (bossa.modules.Compilation compilation, String className,
!    gnu.bytecode.Type javaType, VarScope scope)
  {
    if (bossa.util.Debug.javaTypes)
***************
*** 207,212 ****
  
    if (javaType instanceof gnu.bytecode.ClassType)
!     fetchMethods(res, javaType);
!     
    return res;
  }
--- 208,213 ----
  
    if (javaType instanceof gnu.bytecode.ClassType)
!     fetchMethods(res, javaType, scope);
! 
    return res;
  }
***************
*** 234,238 ****
  }
  
! ?mlsub.typing.TypeConstructor lookupJavaClass(String className, ?Location loc)
  {
    let classType = nice.tools.code.TypeImport.lookup(className, loc);
--- 235,240 ----
  }
  
! ?mlsub.typing.TypeConstructor lookupJavaClass(String className, ?Location loc,
! 					      VarScope scope)
  {
    let classType = nice.tools.code.TypeImport.lookup(className, loc);
***************
*** 246,249 ****
      return compilation.javaTypeConstructors.get(classType);
  
!   return createJavaType(compilation, classType.getName(), classType);
  }
--- 248,251 ----
      return compilation.javaTypeConstructors.get(classType);
  
!   return createJavaType(compilation, classType.getName(), classType, scope);
  }

Index: tools.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v
retrieving revision 1.103
retrieving revision 1.104
diff -C2 -d -r1.103 -r1.104
*** tools.nice	16 Jan 2005 21:51:15 -0000	1.103
--- tools.nice	6 Mar 2005 01:34:26 -0000	1.104
***************
*** 187,190 ****
--- 187,191 ----
  ?mlsub.typing.TypeSymbol lookup(TypeMap, String) = native mlsub.typing.TypeSymbol TypeMap.lookup(String);
  List<VarSymbol> lookup(VarScope, LocatedString) = native List VarScope.lookup(LocatedString);
+ List<VarSymbol> globalLookup(VarScope, LocatedString) = native List VarScope.globalLookup(LocatedString);
  Map<gnu.bytecode.Type,mlsub.typing.TypeConstructor> javaTypeConstructors(bossa.modules.Compilation ) = native bossa.modules.Compilation.javaTypeConstructors;
  ?LocatedString name(Symbol) = native Symbol.name;
***************
*** 216,219 ****
--- 217,222 ----
  gnu.expr.QuoteExp voidExp() = native gnu.expr.QuoteExp.voidExp;
  gnu.expr.QuoteExp QuoteExp_undefined_exp() = native gnu.expr.QuoteExp.undefined_exp;
+ GlobalVarScope scope(Module) = native Module.scope;
+ GlobalVarScope javaScope() = native Module.javaScope;
  
  // Local Variables:

Index: importedconstructor.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/importedconstructor.nice,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** importedconstructor.nice	16 Feb 2005 12:13:17 -0000	1.15
--- importedconstructor.nice	6 Mar 2005 01:34:26 -0000	1.16
***************
*** 115,122 ****
  	method: method);
    res.addChild(parameters);
!   let symbol = new MethodSymbol(res, name, constraint, returnType);
!   res.symbol = symbol;
!   symbol.propagate = Node.global;
!   res.addChild(symbol);
  
    addConstructor(res.classe.getDefinition().getTC(), res);
--- 115,119 ----
  	method: method);
    res.addChild(parameters);
!   res.setSymbol(new MethodSymbol(res, name, constraint, returnType));
  
    addConstructor(res.classe.getDefinition().getTC(), res);

Index: dispatch.java.bootstrap
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** dispatch.java.bootstrap	15 Jan 2005 20:27:33 -0000	1.53
--- dispatch.java.bootstrap	6 Mar 2005 01:34:26 -0000	1.54
***************
*** 19,23 ****
    public static void resetDispatchTest() {}
  
!   public static void readImportedAlternative(gnu.bytecode.ClassType c, gnu.bytecode.Method method, bossa.util.Location location) {}
  
    static TypeScope createGlobalTypeScope()
--- 19,23 ----
    public static void resetDispatchTest() {}
  
!   public static void readImportedAlternative(gnu.bytecode.ClassType c, gnu.bytecode.Method method, bossa.util.Location location, Module module) {}
  
    static TypeScope createGlobalTypeScope()
***************
*** 28,32 ****
    public static void resetJavaClasses() {}
  
!   static VarScope createGlobalVarScope()
    { return null; }
  
--- 28,32 ----
    public static void resetJavaClasses() {}
  
!   public static VarScope createGlobalVarScope()
    { return null; }
  
***************
*** 39,43 ****
    { return null; }
  
!   public static AST createAST(Module module, List defs)
    { return null; }
  
--- 39,43 ----
    { return null; }
  
!   public static AST createAST(bossa.modules.Package module, List defs)
    { return null; }
  

Index: ast.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ast.nice,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ast.nice	26 Nov 2004 20:26:02 -0000	1.1
--- ast.nice	6 Mar 2005 01:34:26 -0000	1.2
***************
*** 23,27 ****
  public class CAST extends AST
  {
!   private Module module;
    private ArrayList<TypeDefinition> classes = new ArrayList();
    private ArrayList<MethodDeclaration> methods = new ArrayList();
--- 23,27 ----
  public class CAST extends AST
  {
!   private bossa.modules.Package pkg;
    private ArrayList<TypeDefinition> classes = new ArrayList();
    private ArrayList<MethodDeclaration> methods = new ArrayList();
***************
*** 56,60 ****
    buildScope()
    {
!     this.buildScope(module);
    }
    
--- 56,60 ----
    buildScope()
    {
!     this.buildScope(pkg);
    }
    
***************
*** 64,68 ****
        n.doResolve();
      } catch(UserError ex) {
!       module.compilation().error(ex);
      }
    }
--- 64,68 ----
        n.doResolve();
      } catch(UserError ex) {
!       pkg.getCompilation().error(ex);
      }
    }
***************
*** 70,74 ****
    resolveScoping()
    {
!     Node.setModule(module);
  
      // Resolve custom constructors early, classes depend on them
--- 70,74 ----
    resolveScoping()
    {
!     Node.setPackage(pkg);
  
      // Resolve custom constructors early, classes depend on them
***************
*** 84,93 ****
        this.resolve(node);
  
!     module.compilation().exitIfErrors();
    }
  
    typedResolve()
    {
!     Node.setModule(module);
  
      for (m : methods)
--- 84,93 ----
        this.resolve(node);
  
!     pkg.getCompilation().exitIfErrors();
    }
  
    typedResolve()
    {
!     Node.setPackage(pkg);
  
      for (m : methods)
***************
*** 95,99 ****
          m.typedResolve();
        } catch(UserError ex) {
!         module.compilation().error(ex);
        }
  
--- 95,99 ----
          m.typedResolve();
        } catch(UserError ex) {
!         pkg.getCompilation().error(ex);
        }
  
***************
*** 102,114 ****
          mi.lateBuildScope();
        } catch(UserError ex) {
!         module.compilation().error(ex);
        }
  
!     module.compilation().exitIfErrors();
    }
  
    localResolve()
    {
!     Node.setModule(module);
  
      for (d : children)
--- 102,114 ----
          mi.lateBuildScope();
        } catch(UserError ex) {
!         pkg.getCompilation().error(ex);
        }
  
!     pkg.getCompilation().exitIfErrors();
    }
  
    localResolve()
    {
!     Node.setPackage(pkg);
  
      for (d : children)
***************
*** 117,124 ****
          d.resolveBody();
        } catch(UserError ex) {
!         module.compilation().error(ex);
        }
  
!     module.compilation().exitIfErrors();
  
      for (c : classes)
--- 117,124 ----
          d.resolveBody();
        } catch(UserError ex) {
!         pkg.getCompilation().error(ex);
        }
  
!     pkg.getCompilation().exitIfErrors();
  
      for (c : classes)
***************
*** 128,132 ****
    typechecking(compiling)
    {
!     Node.setModule(module);
  
      // Classes are typechecked first, since code can depend on them.
--- 128,132 ----
    typechecking(compiling)
    {
!     Node.setPackage(pkg);
  
      // Classes are typechecked first, since code can depend on them.
***************
*** 144,148 ****
      this.doTypecheck();
  
!     module.compilation().exitIfErrors();
    }
  
--- 144,148 ----
      this.doTypecheck();
  
!     pkg.getCompilation().exitIfErrors();
    }
  
***************
*** 178,185 ****
  }
  
! public AST createAST(Module module, ?List<Definition> defs)
  {
!   let res = new CAST(defs || new ArrayList(), Node.global, module: module);
    res.findElements();
    return res;
! }
\ No newline at end of file
--- 178,185 ----
  }
  
! public AST createAST(bossa.modules.Package pkg, ?List<Definition> defs)
  {
!   let res = new CAST(defs || new ArrayList(), Node.none, pkg: pkg);
    res.findElements();
    return res;
! }

Index: defaultMethod.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/defaultMethod.nice,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** defaultMethod.nice	14 Jan 2005 16:41:27 -0000	1.8
--- defaultMethod.nice	6 Mar 2005 01:34:26 -0000	1.9
***************
*** 130,137 ****
  	contract: contract, isOverride: isOverride, implementation: res);
    notNull(res.declaration).addChild(parameters);
!   let symbol = new MethodSymbol(notNull(res.declaration), name, constraint, returnType);
!   notNull(res.declaration).symbol = symbol;
!   symbol.propagate = Node.global;
!   notNull(res.declaration).addChild(symbol);
  
    res.addChild(res.declaration);
--- 130,135 ----
  	contract: contract, isOverride: isOverride, implementation: res);
    notNull(res.declaration).addChild(parameters);
!   notNull(res.declaration).setSymbol
!     (new MethodSymbol(notNull(res.declaration), name, constraint, returnType));
  
    res.addChild(res.declaration);



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