Nice/src/bossa/syntax niceclass.nice,1.24,1.25 analyse.nice,1.131,1.132

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-serv4640/src/bossa/syntax

Modified Files:
	niceclass.nice analyse.nice 
Log Message:
Simplified class initializer resolution by placing 'this' in the SymbolTable
used for the initializers instead of fiddling in the parent scope.


Index: analyse.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v
retrieving revision 1.131
retrieving revision 1.132
diff -C2 -d -r1.131 -r1.132
*** analyse.nice	4 Mar 2005 01:55:19 -0000	1.131
--- analyse.nice	4 Mar 2005 02:25:03 -0000	1.132
***************
*** 21,25 ****
  // Interface
  
! Statement analyse(Statement, VarScope, TypeScope, boolean mustReturnAValue);
  Expression analyse(Expression, VarScope, TypeScope,
  		   SymbolTable<VarSymbol> vars = new SymbolTable());
--- 21,26 ----
  // Interface
  
! Statement analyse(Statement, VarScope, TypeScope, boolean mustReturnAValue,
! 		  SymbolTable<VarSymbol> vars = new SymbolTable());
  Expression analyse(Expression, VarScope, TypeScope,
  		   SymbolTable<VarSymbol> vars = new SymbolTable());
***************
*** 28,32 ****
  
  Info buildInfo(VarScope varScope, TypeScope typeScope,
! 	       SymbolTable<VarSymbol> vars = new SymbolTable())
  {
    let SymbolTable<mlsub.typing.TypeSymbol> t = new SymbolTable();
--- 29,33 ----
  
  Info buildInfo(VarScope varScope, TypeScope typeScope,
! 	       SymbolTable<VarSymbol> vars)
  {
    let SymbolTable<mlsub.typing.TypeSymbol> t = new SymbolTable();
***************
*** 36,42 ****
  }
  
! analyse(Statement s, varScope, typeScope, mustReturnAValue)
  {
!   Info info = buildInfo(varScope, typeScope);
  
    analyse(s, info);
--- 37,43 ----
  }
  
! analyse(Statement s, varScope, typeScope, mustReturnAValue, vars)
  {
!   Info info = buildInfo(varScope, typeScope, vars);
  
    analyse(s, info);
***************
*** 51,55 ****
  		MonoSymbol[] params, boolean mustReturnAValue)
  {
!   Info info = buildInfo(varScope, typeScope);
  
    info.addVars(params);
--- 52,56 ----
  		MonoSymbol[] params, boolean mustReturnAValue)
  {
!   Info info = buildInfo(varScope, typeScope, new SymbolTable());
  
    info.addVars(params);

Index: niceclass.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** niceclass.nice	1 Mar 2005 17:36:36 -0000	1.24
--- niceclass.nice	4 Mar 2005 02:25:03 -0000	1.25
***************
*** 245,249 ****
        return;
  
-     VarScope scope = notNull(definition.scope);
      mlsub.typing.Monotype thisType =
        sureMonotype(new mlsub.typing.MonotypeConstructor(definition.getTC(),
--- 245,248 ----
***************
*** 252,262 ****
  
      Node.thisExp = createSymbolExp(notNull(thisSymbol), definition.location());
!     scope.addSymbol(thisSymbol);
  
      for (int i = 0; i < initializers.size(); i++)
!       initializers[i] = analyse(initializers[i], notNull(definition.scope), notNull(localScope), false);
  
      Node.thisExp = null;
-     scope.removeSymbol(thisSymbol);
    }
  
--- 251,266 ----
  
      Node.thisExp = createSymbolExp(notNull(thisSymbol), definition.location());
! 
!     SymbolTable<VarSymbol> vars = new SymbolTable();
!     vars["this"] = notNull(thisSymbol);
  
      for (int i = 0; i < initializers.size(); i++)
!       {
! 	vars.begin();
! 	initializers[i] = analyse(initializers[i], notNull(definition.scope), notNull(localScope), false, vars);
! 	vars.end();
!       }
  
      Node.thisExp = 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.