[Nice-commit] Nice/src/bossa/syntax block.nice,NONE,1.1 locals.nice,NONE,1.1 Arguments.java,1.24,1.2
Brought to you by:
bonniot
From: Arjan B. <ar...@us...> - 2004-08-08 21:52:20
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29035/F:/nice/src/bossa/syntax Modified Files: Arguments.java CustomConstructor.java analyse.nice call.nice dispatch.java.bootstrap loop.nice rewrite.nice tools.nice typecheck.nice Added Files: block.nice locals.nice Removed Files: Block.java Log Message: Converted block and local variables to nice code. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** analyse.nice 5 Aug 2004 10:45:29 -0000 1.108 --- analyse.nice 8 Aug 2004 21:51:54 -0000 1.109 *************** *** 218,222 **** } ! void checkInitialized(Block.LocalVariable.Symbol sym, Info info, ?bossa.util.Location loc) { --- 218,222 ---- } ! void checkInitialized(LocalVariableSymbol sym, Info info, ?bossa.util.Location loc) { *************** *** 239,243 **** analyse(Expression e, i) = e; ! void setInitialized (Block.LocalVariable.Symbol v, Info info, bossa.util.Location loc) { --- 239,243 ---- analyse(Expression e, i) = e; ! void setInitialized (LocalVariableSymbol v, Info info, bossa.util.Location loc) { *************** *** 311,321 **** Arguments args = e.arguments; - let ExpLocalVariable[?] expLocals = e.localVars = cast(args.extractLocalVars()); - if (e.infix) markAsCallFirstArg(notNull(args.getExp(0))); ! if (expLocals != null) { info.begin(); for (local : expLocals) --- 311,326 ---- Arguments args = e.arguments; if (e.infix) markAsCallFirstArg(notNull(args.getExp(0))); ! List<ExpLocalVariable> expLocals = new ArrayList(); ! ! for (int i = args.size(); --i>=0; ) ! if (args.getExp(i) instanceof ExpLocalVariable) ! expLocals.add(cast(args.getExp(i))); ! ! if (!expLocals.isEmpty()) { + e.localVars = expLocals; info.begin(); for (local : expLocals) *************** *** 328,332 **** args.analyse(info, noEscape); ! if (expLocals != null) info.end(); --- 333,337 ---- args.analyse(info, noEscape); ! if (!expLocals.isEmpty()) info.end(); *************** *** 471,475 **** sym.captured = true; ! if (sym instanceof Block.LocalVariable.Symbol) { if (assigned) --- 476,480 ---- sym.captured = true; ! if (sym instanceof LocalVariableSymbol) { if (assigned) *************** *** 679,683 **** analyse(null(Statement), info) {} ! analyse(Block.LocalVariable decl, info) { if (decl.value != null) --- 684,688 ---- analyse(null(Statement), info) {} ! analyse(LocalVariable decl, info) { if (decl.value != null) *************** *** 692,696 **** } ! analyse(Block.LocalConstant decl, info) { decl.value = analyse(decl.value, info); --- 697,701 ---- } ! analyse(LocalConstant decl, info) { decl.value = analyse(decl.value, info); *************** *** 698,702 **** } ! analyse(Block.LocalFunction decl, info) { notNull(decl.parameters).resolveCalledFromAnalyse(cast(info)); --- 703,707 ---- } ! analyse(LocalFunction decl, info) { notNull(decl.parameters).resolveCalledFromAnalyse(cast(info)); *************** *** 709,713 **** { info.begin(); ! notNull(b.locals).foreach(Block.LocalDeclaration l => analyse(l, info)); analyse(b.statements, info); info.end(); --- 714,718 ---- { info.begin(); ! notNull(b.locals).foreach(LocalDeclaration l => analyse(l, info)); analyse(b.statements, info); info.end(); *************** *** 717,725 **** } ! void analyse(?Statement[] statements, Info info) { for (int i = 0; i < statements.length; i++) { ! ?Statement s = statements[i]; if (info.getUnreachable()) throw error(s, "This statement is never executed"); --- 722,730 ---- } ! void analyse(Statement[] statements, Info info) { for (int i = 0; i < statements.length; i++) { ! Statement s = statements[i]; if (info.getUnreachable()) throw error(s, "This statement is never executed"); Index: CustomConstructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CustomConstructor.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** CustomConstructor.java 2 Aug 2004 19:10:58 -0000 1.17 --- CustomConstructor.java 8 Aug 2004 21:51:54 -0000 1.18 *************** *** 32,36 **** public static CustomConstructor make (LocatedString className, Constraint cst, FormalParameters params, ! Block body) { return new SourceCustomConstructor(className, cst, params, body); --- 32,36 ---- public static CustomConstructor make (LocatedString className, Constraint cst, FormalParameters params, ! Statement body) { return new SourceCustomConstructor(className, cst, params, body); *************** *** 121,125 **** { SourceCustomConstructor(LocatedString className, Constraint cst, ! FormalParameters params, Block body) { super(className, cst, params); --- 121,125 ---- { SourceCustomConstructor(LocatedString className, Constraint cst, ! FormalParameters params, Statement body) { super(className, cst, params); --- Block.java DELETED --- Index: loop.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/loop.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** loop.nice 5 Aug 2004 10:45:30 -0000 1.2 --- loop.nice 8 Aug 2004 21:51:54 -0000 1.3 *************** *** 23,27 **** ?Expression whileExp; final Statement loopBody; ! final ?Block iterationStatements = null; final boolean testFirst; --- 23,27 ---- ?Expression whileExp; final Statement loopBody; ! final ?Statement iterationStatements = null; final boolean testFirst; *************** *** 98,102 **** (loopBody == null ? ";" : loopBody.toString()); ! Statement[] itStatements = cast(notNull(iterationStatements).statements); String itStats = ""; for(int i = 0; i<itStatements.length; i++) --- 98,103 ---- (loopBody == null ? ";" : loopBody.toString()); ! Block itbl = cast(iterationStatements); ! Statement[] itStatements = itbl.statements; String itStats = ""; for(int i = 0; i<itStatements.length; i++) *************** *** 113,117 **** public LoopStmt createForLoop ! (Expression test, Block update, Statement body) { return new LoopStmt(whileExp:test, loopBody: body, iterationStatements: update, testFirst: true); --- 114,118 ---- public LoopStmt createForLoop ! (Expression test, Statement update, Statement body) { return new LoopStmt(whileExp:test, loopBody: body, iterationStatements: update, testFirst: true); *************** *** 143,153 **** let getiter = createCallExp(new IdentExp(new LocatedString("forIterator", loc)), container); let iter = new LocatedString(loc.uniqueIdentifier("for_in_iter_"), loc); ! let init = new Block.LocalVariable(iter, itertype, true, getiter); let iterexp = new IdentExp(iter); let cond = createCallExp(new IdentExp(new LocatedString("hasNext", loc)), iterexp); let getvar = createCallExp(new IdentExp(new LocatedString("next", loc)), iterexp); ! let assign = new Block.LocalVariable(varName, vartype, true, getvar); ! let loop = createWhileLoop(cond, new Block(new LinkedList([assign, body]))); ! return new Block(new LinkedList([init, loop])); } --- 144,154 ---- let getiter = createCallExp(new IdentExp(new LocatedString("forIterator", loc)), container); let iter = new LocatedString(loc.uniqueIdentifier("for_in_iter_"), loc); ! let init = new LocalVariable(iter, itertype, true, getiter); let iterexp = new IdentExp(iter); let cond = createCallExp(new IdentExp(new LocatedString("hasNext", loc)), iterexp); let getvar = createCallExp(new IdentExp(new LocatedString("next", loc)), iterexp); ! let assign = new LocalVariable(varName, vartype, true, getvar); ! let loop = createWhileLoop(cond, createBlock(new LinkedList([assign, body]))); ! return createBlock(new LinkedList([init, loop])); } Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** typecheck.nice 7 Aug 2004 16:48:13 -0000 1.111 --- typecheck.nice 8 Aug 2004 21:51:54 -0000 1.112 *************** *** 677,681 **** typecheck(ExpLocalVariable e) { ! Block.LocalVariable decl = notNull(e.variable); MonoSymbol target = notNull(decl.left); --- 677,681 ---- typecheck(ExpLocalVariable e) { ! let decl = e.variable; MonoSymbol target = notNull(decl.left); *************** *** 733,737 **** b.statements = rewrite(b.statements); ! b.locals.foreach(?Block.LocalDeclaration d => typecheck(d)); b.statements.foreach (?Statement s => { --- 733,737 ---- b.statements = rewrite(b.statements); ! b.locals.foreach(?LocalDeclaration d => typecheck(d)); b.statements.foreach (?Statement s => { *************** *** 746,750 **** } ! typecheck(Block.LocalVariable decl) { MonoSymbol target = notNull(decl.left()); --- 746,750 ---- } ! typecheck(LocalVariable decl) { MonoSymbol target = notNull(decl.left()); *************** *** 789,793 **** } ! typecheck(Block.LocalConstant decl) { if (! notNull(decl.left).used) --- 789,793 ---- } ! typecheck(LocalConstant decl) { if (! notNull(decl.left).used) *************** *** 805,809 **** } ! typecheck(Block.LocalFunction decl) { typecheck(decl.value); --- 805,809 ---- } ! typecheck(LocalFunction decl) { typecheck(decl.value); Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** tools.nice 7 Aug 2004 14:20:29 -0000 1.46 --- tools.nice 8 Aug 2004 21:51:54 -0000 1.47 *************** *** 63,67 **** mlsub.typing.Monotype ensureMonomorphic(mlsub.typing.Polytype type, ! Block.LocalValue decl) { type.simplify(); --- 63,67 ---- mlsub.typing.Monotype ensureMonomorphic(mlsub.typing.Polytype type, ! LocalValue decl) { type.simplify(); *************** *** 192,205 **** mlsub.typing.Monotype type(MonoSymbol) = native MonoSymbol.type; GlobalTypeScope getGlobalTypeScope() = native GlobalTypeScope Node.getGlobalTypeScope(); - List<Block.LocalDeclaration> locals(Block) = native Block.locals; - ?Statement[] statements(Block) = native Block.statements; ?gnu.bytecode.ClassType staticClass(Arguments) = native gnu.bytecode.ClassType Arguments.staticClass(); List<VarSymbol> findJavaMethods(?gnu.bytecode.ClassType, String, int) = native List JavaClasses.findJavaMethods(gnu.bytecode.ClassType,java.lang.String,int); List<VarSymbol> findJavaMethods(?gnu.bytecode.ClassType, String) = native List JavaClasses.findJavaMethods(gnu.bytecode.ClassType,java.lang.String); TypeParameters TypeParameters(List<Monotype>) = native new bossa.syntax.TypeParameters(List); - Block Block(List<Statement>) = native new bossa.syntax.Block(List); String explainNoMatch(Arguments, List<VarSymbol>) = native String Arguments.explainNoMatch(List); Map<VarSymbol,mlsub.typing.Polytype> types(Arguments) = native Arguments.types; <T> String map(String, String, String, T[]) = native String bossa.util.Util.map(String, String, String, Object[]); Stack<bossa.link.Alternative> sortedAlternatives(MethodDeclaration) = native Stack bossa.link.Alternative.sortedAlternatives(MethodDeclaration); List<VarSymbol> getConstructorCallSymbols(NiceClass) = native List NiceClass.getConstructorCallSymbols(); --- 192,203 ---- mlsub.typing.Monotype type(MonoSymbol) = native MonoSymbol.type; GlobalTypeScope getGlobalTypeScope() = native GlobalTypeScope Node.getGlobalTypeScope(); ?gnu.bytecode.ClassType staticClass(Arguments) = native gnu.bytecode.ClassType Arguments.staticClass(); List<VarSymbol> findJavaMethods(?gnu.bytecode.ClassType, String, int) = native List JavaClasses.findJavaMethods(gnu.bytecode.ClassType,java.lang.String,int); List<VarSymbol> findJavaMethods(?gnu.bytecode.ClassType, String) = native List JavaClasses.findJavaMethods(gnu.bytecode.ClassType,java.lang.String); TypeParameters TypeParameters(List<Monotype>) = native new bossa.syntax.TypeParameters(List); String explainNoMatch(Arguments, List<VarSymbol>) = native String Arguments.explainNoMatch(List); Map<VarSymbol,mlsub.typing.Polytype> types(Arguments) = native Arguments.types; <T> String map(String, String, String, T[]) = native String bossa.util.Util.map(String, String, String, Object[]); + <T> String map(String, String, String, Collection<T>) = native String bossa.util.Util.map(String, String, String, Collection); Stack<bossa.link.Alternative> sortedAlternatives(MethodDeclaration) = native Stack bossa.link.Alternative.sortedAlternatives(MethodDeclaration); List<VarSymbol> getConstructorCallSymbols(NiceClass) = native List NiceClass.getConstructorCallSymbols(); *************** *** 211,215 **** // Retypings needed since java types are not strict. - Block newBlock(?Statement[] statements) = native new Block(Statement[]); mlsub.typing.Polytype boolPolytype() = native PrimitiveType.boolPolytype; mlsub.typing.Polytype longPolytype() = native PrimitiveType.longPolytype; --- 209,212 ---- --- NEW FILE: locals.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; import bossa.util.*; abstract class LocalDeclaration extends Statement { ?Expression value; String getName(); VarSymbol getSymbol(); gnu.bytecode.Type getBytecodeType(); gnu.expr.Expression initValue() { return notNull(value).generateCode(); } location() = notNull(this.getSymbol().name.location()); gnu.expr.Expression compile(gnu.expr.LetExp letExp) { gnu.expr.Declaration decl = letExp.addDeclaration(this.getName(), this.getBytecodeType()); decl.noteValue(null); if (! this.getSymbol().isAssignable()) decl.setFlag(gnu.expr.Declaration.IS_CONSTANT); if (value == null) decl.setFlag(gnu.expr.Declaration.NOT_INITIALIZED); this.getSymbol().setDeclaration(decl); return this.initValue(); } generateCode() { Internal.error("Should not be called"); return cast(null); } public String display() { if (value == null) return this.getSymbol().toString(); else return this.getSymbol().toString() + '=' + value; } } public abstract class LocalValue extends LocalDeclaration { ?LocalValue next = null; LocalValue last = cast(null); { last = this; } /* Local variables are chained to handle multiple var declarations like "int x = 3, y = x, z = y;" We have to be careful about the order, so that dependencies like above work as expected. */ public void addNext(LocatedString name, ?Expression value); toString() { let res = new StringBuffer(); ?LocalValue v = this; while (true) { res.append(notNull(v).display()); v = notNull(v).next; if (v == null) break; else res.append(','); } return res.toString(); } } public class LocalVariable extends LocalValue { LocalVariableSymbol left; getName() = left.name.toString(); getSymbol() = left; getBytecodeType() = nice.tools.code.Types.javaType(left.type); initValue() { if (value == null) return notNull(gnu.expr.QuoteExp.undefined_exp); else return notNull(value).generateCode(); } int getIndex() { return left.index; } void setIndex(int i) { left.index = i; } addNext(name, value) { if (left.syntacticType == null && value == null) User.error(name,"A local variable requires a type or a default value"); last.next = new LocalVariable(name, left.syntacticType, ! left.isAssignable(), value); last = notNull(last.next); } display() { if (left.constant) return "let "+ super; else return "var " + super; } } class LocalVariableSymbol extends MonoSymbol { /* Index to make the initialization analysis or -1 if this variable is always initialized. */ int index = -1; boolean constant; isAssignable() { /* For a constant symbol with no initial value, index != -1. We allow assignments, but check with dataflow in analyse.nice that assignment occurs only in the uninitialized state. */ return ! constant || index != -1; } } public new LocalVariable(LocatedString name, ?Monotype type, boolean constant, ?Expression value) { this(value: value, left:new LocalVariableSymbol(name, type, constant: constant)); } public class LocalConstant extends LocalValue { MonoSymbol left; getName() = left.name.toString(); getSymbol() = left; getBytecodeType() = nice.tools.code.Types.javaType(left.type); addNext(name, value) { if (value == null) User.error(name,"A local constant requires a type or a default value"); last.next = new LocalConstant(name, notNull(value)); last = notNull(last.next); } toString() = "let " + super; } class LocalConstantSymbol extends MonoSymbol { isAssignable() = false; } public new LocalConstant(LocatedString name, Expression value) { ?Monotype t = null; this(value: value, left: new LocalConstantSymbol(name,t)); } public class LocalFunction extends LocalDeclaration { FunSymbol left; FormalParameters parameters; getName() = left.name.toString(); getSymbol() = left; getBytecodeType() = nice.tools.code.Types.javaType(left.type); mlsub.typing.Polytype inferredReturnType() { return notNull(value).inferredReturnType(); } mlsub.typing.Monotype declaredReturnType() { return nice.tools.typing.Types.result(left.getType()); } } public Statement createLocalFunction(LocatedString name, Monotype returnType, FormalParameters parameters, Statement body) { let value = createFunExp(Constraint.True, parameters.getMonoSymbols(), body); let symbol = new FunSymbol(name, Constraint.True, parameters, returnType); notNull(notNull(symbol.syntacticType).getMonotype()).nullness = Monotype.sure; return new LocalFunction(left: symbol, value: value, parameters: parameters); } public Statement createLocalVariable(LocatedString name, ?Monotype type, boolean constant, ?Expression value) { if (type == null && value == null) User.error(name,"A local variable requires a type or a default value"); if (constant && type == null) return new LocalConstant(name, value: notNull(value)); return new LocalVariable(name, type, constant: constant, value: value); } public void addNextLocal(Statement localValue, LocatedString name, ?Expression value) { LocalValue lv = cast(localValue); lv.addNext(name, value); } public class ExpLocalVariable extends Expression { LocalVariable variable; Expression initValue; computeType() { this.type = variable.left.getType(); } compile() = this.compileAssign(initValue.generateCode()); getDeclaration() = variable.getSymbol().getDeclaration(); } public Expression createExpLocalVariable(LocatedString name, Expression value, boolean constant, ?Monotype type) { let res = new ExpLocalVariable(variable: new LocalVariable(name, type, constant, null), initValue: value); res.setLocation(name.location()); return res; } --- NEW FILE: block.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; import bossa.util.*; /** A block : a list of statements with local variables. */ public class Block extends Statement { ArrayList<LocalDeclaration> locals = new ArrayList(); Statement[] statements; boolean isBreakTarget = false; public Statement last() { return statements[statements.length - 1]; } /** Divides the statements in an hierarchy of blocks. Each block has a list of local variables accessible in the block, and a list of statements (possibly sub-blocks). @param statements the list of statements, with LocalDeclarations @return the list of statements of the current block. */ private Statement[] cutInBlocks(List<Statement> statements) { ArrayList<Statement> res = new ArrayList(); let i = statements.listIterator(); // Finds locals at the beginning while(i.hasNext()) { let s = i.next(); if (s instanceof LocalValue) { ?LocalValue decl = s; do { locals.add(notNull(decl)); decl = notNull(decl).next; } while (decl != null); } else if (s instanceof LocalDeclaration) locals.add(s); else { res.add(s); break; } } // There will be no more locals, let's save space :-) locals.trimToSize(); // Finds statements. Creates a new Block if a local declaration is found while(i.hasNext()) { let s = i.next(); if (s instanceof LocalDeclaration) { // Create a subblock with all the statements starting from this one let end = createBlock(statements.subList(i.previousIndex(), statements.size())); end.setLocation(s.location()); res.add(end); break; } res.add(s); } return new Statement[res.size()].fillWith(res); } /**************************************************************** * Code generation ****************************************************************/ generateCode() { if (statements.length != 0) { let body = new gnu.expr.BeginExp(); // addLocals must appear before Statement.compile(statements) // in order to define the locals before their use. // That is why we can't set body's body at construction. let res = this.addLocals(locals.iterator(), body); body.setExpressions(Statement.compile(statements)); return res; } return this.addLocals(locals.iterator(), notNull(gnu.expr.QuoteExp.voidExp)); } private gnu.expr.Expression addLocals(Iterator<LocalDeclaration> vars, gnu.expr.Expression body) { if (!vars.hasNext()) return body; let local = vars.next(); gnu.expr.Expression[] eVal = cast(new gnu.expr.Expression[1]); gnu.expr.LetExp res = new gnu.expr.LetExp(eVal); eVal[0] = local.compile(res); res.setBody(this.addLocals(vars,body)); local.location().write(res); return res; } /**************************************************************** * Printing ****************************************************************/ toString() { return "{\n" + Util.map("",";\n",";\n",locals) + Util.map("","\n","\n",statements) + "}\n"; } } public Statement createBlock(List<Statement> statements) { let res = new Block(statements: cast(null)); let stmts = res.cutInBlocks(statements); res.statements = stmts; if (stmts != null && stmts.length > 0 && stmts[0] != null) res.setLocation(stmts[0].location()); return res; } Index: rewrite.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/rewrite.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** rewrite.nice 29 Jul 2004 12:11:40 -0000 1.5 --- rewrite.nice 8 Aug 2004 21:51:54 -0000 1.6 *************** *** 40,44 **** } ! ?Statement[] rewrite(?Statement[] statements) { for (int i = 0; i < statements.length - 1; i++) --- 40,44 ---- } ! Statement[] rewrite(Statement[] statements) { for (int i = 0; i < statements.length - 1; i++) *************** *** 79,88 **** makeStatement(StatementExp e) = e.statement; ! Block makeBlock(Expression first, ?Statement[] rest) { ?Statement[] res = new Statement[rest.length + 1]; res[0] = makeStatement(first); copy(rest, 0, res, 1, rest.length); ! return new Block(res); } --- 79,88 ---- makeStatement(StatementExp e) = e.statement; ! Block makeBlock(Expression first, Statement[] rest) { ?Statement[] res = new Statement[rest.length + 1]; res[0] = makeStatement(first); copy(rest, 0, res, 1, rest.length); ! return new Block(statements: cast(res)); } Index: call.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/call.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** call.nice 5 Aug 2004 10:45:30 -0000 1.1 --- call.nice 8 Aug 2004 21:51:54 -0000 1.2 *************** *** 31,35 **** ?gnu.bytecode.ClassType declaringClass = null; ! ExpLocalVariable[?] localVars = null; /** The type of the function, constrained by the actual arguments. */ --- 31,35 ---- ?gnu.bytecode.ClassType declaringClass = null; ! ?List<ExpLocalVariable> localVars = null; /** The type of the function, constrained by the actual arguments. */ *************** *** 135,144 **** if (localVars != null) { ! for(int i = notNull(localVars).length-1; i >= 0; i--) { gnu.expr.Expression[] eVal = cast(new gnu.expr.Expression[1]); gnu.expr.LetExp letExp = new gnu.expr.LetExp(eVal); ! eVal[0] = notNull(notNull(localVars)[i].variable).compile(letExp); ! if (i == notNull(localVars).length-1) { firstLetExp = letExp; --- 135,144 ---- if (localVars != null) { ! for(int i = notNull(localVars).size()-1; i >= 0; i--) { gnu.expr.Expression[] eVal = cast(new gnu.expr.Expression[1]); gnu.expr.LetExp letExp = new gnu.expr.LetExp(eVal); ! eVal[0] = notNull(localVars)[i].variable.compile(letExp); ! if (i == notNull(localVars).size()-1) { firstLetExp = letExp; Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** dispatch.java.bootstrap 7 Aug 2004 14:20:29 -0000 1.19 --- dispatch.java.bootstrap 8 Aug 2004 21:51:54 -0000 1.20 *************** *** 89,92 **** --- 89,106 ---- { return false; } + public static Expression createExpLocalVariable(LocatedString name, Expression value, boolean constant, Monotype type) + { return null; } + + public static Statement createLocalVariable(LocatedString name, Monotype type, boolean constant, Expression value) + { return null; } + + public void addNextLocal(Statement localValue, LocatedString name, Expression value) {} + + public static Statement createLocalFunction(LocatedString name, Monotype returnType, FormalParameters parameters, Statement body) + { return null; } + + public static Statement createBlock(List statements) + { return null; } + static Statement analyse(Statement s, VarScope v, TypeScope t, boolean r) { return null; } Index: Arguments.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Arguments.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Arguments.java 2 Feb 2004 23:21:44 -0000 1.24 --- Arguments.java 8 Aug 2004 21:51:54 -0000 1.25 *************** *** 161,178 **** } - ExpLocalVariable[] extractLocalVars() - { - List res = new ArrayList(); - - for (int i = arguments.length; --i>=0; ) - if (arguments[i].value instanceof ExpLocalVariable) - res.add(arguments[i].value); - - if (res.isEmpty()) - return null; - - return (ExpLocalVariable[])res.toArray(new ExpLocalVariable[res.size()]); - } - java.util.Map applicationExpressions = new java.util.HashMap(); --- 161,164 ---- |