[Nice-commit] Nice/src/bossa/syntax niceclass.nice,1.24,1.25 analyse.nice,1.131,1.132
Brought to you by:
bonniot
|
From: Daniel B. <bo...@us...> - 2005-03-04 02:25:29
|
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; } |