[Nice-commit] Nice/src/bossa/syntax analyse.nice,1.105,1.106 rewrite.nice,1.4,1.5 tools.nice,1.36,1.
Brought to you by:
bonniot
From: Arjan B. <ar...@us...> - 2004-07-29 12:11:52
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23653/F:/nice/src/bossa/syntax Modified Files: analyse.nice rewrite.nice tools.nice typecheck.nice Log Message: Removed usage of old pattern syntax. Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** tools.nice 28 Jul 2004 14:40:33 -0000 1.36 --- tools.nice 29 Jul 2004 12:11:40 -0000 1.37 *************** *** 22,28 **** ?LocatedString identString(?Expression); identString(e) = null; ! identString(e@IdentExp) = e.ident; ! identString(e@SymbolExp) = e.getName(); ! identString(e@OverloadedSymbolExp) = e.ident; boolean isCallTo(CallExp e, String name) --- 22,28 ---- ?LocatedString identString(?Expression); identString(e) = null; ! identString(IdentExp e) = e.ident; ! identString(SymbolExp e) = e.getName(); ! identString(OverloadedSymbolExp e) = e.ident; boolean isCallTo(CallExp e, String name) *************** *** 36,45 **** boolean isNullExp(Expression); ! isNullExp(e@Expression) = false; ! isNullExp(e@NullExp) = true; ?MonoSymbol localVariable(Expression); ! localVariable(e@Expression) = null; ! localVariable(e@SymbolExp) { let sym = e.getSymbol(); --- 36,45 ---- boolean isNullExp(Expression); ! isNullExp(Expression e) = false; ! isNullExp(NullExp e) = true; ?MonoSymbol localVariable(Expression); ! localVariable(Expression e) = null; ! localVariable(SymbolExp e) { let sym = e.getSymbol(); *************** *** 58,62 **** return null; } ! localVariable(e@AssignExp) = localVariable(notNull(e.to)); mlsub.typing.Monotype makeSure(mlsub.typing.Monotype m) = --- 58,62 ---- return null; } ! localVariable(AssignExp e) = localVariable(notNull(e.to)); mlsub.typing.Monotype makeSure(mlsub.typing.Monotype m) = Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** analyse.nice 28 Jul 2004 20:48:27 -0000 1.105 --- analyse.nice 29 Jul 2004 12:11:40 -0000 1.106 *************** *** 39,43 **** } ! analyse(s@Statement, varScope, typeScope, mustReturnAValue) { Info info = buildInfo(varScope, typeScope); --- 39,43 ---- } ! analyse(Statement s, varScope, typeScope, mustReturnAValue) { Info info = buildInfo(varScope, typeScope); *************** *** 51,55 **** } ! analyse(e@Expression, varScope, typeScope) = analyse(e, buildInfo(varScope, typeScope)); --- 51,55 ---- } ! analyse(Expression e, varScope, typeScope) = analyse(e, buildInfo(varScope, typeScope)); *************** *** 237,241 **** ****************************************************************/ ! analyse(e@Expression, i) = e; void setInitialized (Block.LocalVariable.Symbol v, Info info, --- 237,241 ---- ****************************************************************/ ! analyse(Expression e, i) = e; void setInitialized (Block.LocalVariable.Symbol v, Info info, *************** *** 256,261 **** Expression analyseAssigned(?Expression, Info); analyseAssigned(e, i) = notNull(analyse(e, i)); ! analyseAssigned(e@IdentExp, info) = analyseIdent(e, info, true); ! analyseAssigned(e@TupleExp, info) { Expression[] es = notNull(e.expressions); --- 256,261 ---- Expression analyseAssigned(?Expression, Info); analyseAssigned(e, i) = notNull(analyse(e, i)); ! analyseAssigned(IdentExp e, info) = analyseIdent(e, info, true); ! analyseAssigned(TupleExp e, info) { Expression[] es = notNull(e.expressions); *************** *** 266,270 **** } ! analyse(e@AssignExp, i) { e.value = analyse(e.value, i); --- 266,270 ---- } ! analyse(AssignExp e, i) { e.value = analyse(e.value, i); *************** *** 287,291 **** void markAsCallFun(Expression, boolean); markAsCallFun(e, infix) {} ! markAsCallFun(e@IdentExp, infix) { if (infix) e.setInfix(); --- 287,291 ---- void markAsCallFun(Expression, boolean); markAsCallFun(e, infix) {} ! markAsCallFun(IdentExp e, infix) { if (infix) e.setInfix(); *************** *** 295,304 **** void markAsCallFirstArg(Expression); markAsCallFirstArg(e) {} ! markAsCallFirstArg(e@IdentExp) { e.enableClassExp = true; } ! analyse(e@ExpLocalVariable, info) { e.initValue = analyse(e.initValue, info); --- 295,304 ---- void markAsCallFirstArg(Expression); markAsCallFirstArg(e) {} ! markAsCallFirstArg(IdentExp e) { e.enableClassExp = true; } ! analyse(ExpLocalVariable e, info) { e.initValue = analyse(e.initValue, info); *************** *** 307,311 **** } ! analyse(e@CallExp, info) { Arguments args = e.arguments; --- 307,311 ---- } ! analyse(CallExp e, info) { Arguments args = e.arguments; *************** *** 418,424 **** analyse(e, info); ! analyse(e@FunExp, info) = analyse(e, info, false); ! analyse(e@FunExp, info@Info, noEscape) { let savedDepth = info.anonFunDepth; --- 418,424 ---- analyse(e, info); ! analyse(FunExp e, info) = analyse(e, info, false); ! analyse(FunExp e, Info info, noEscape) { let savedDepth = info.anonFunDepth; *************** *** 454,458 **** } ! analyse(e@IdentExp, info) = analyseIdent(e, info, false); Expression analyseIdent(IdentExp e, Info info, boolean assigned) --- 454,458 ---- } ! analyse(IdentExp e, info) = analyseIdent(e, info, false); Expression analyseIdent(IdentExp e, Info info, boolean assigned) *************** *** 541,545 **** } ! analyse(e@IfExp, info) { e.condition = analyse(e.condition, info); --- 541,545 ---- } ! analyse(IfExp e, info) { e.condition = analyse(e.condition, info); *************** *** 558,562 **** } ! analyse(e@IncrementExp, info) { e.variable = analyse(e.variable, info); --- 558,562 ---- } ! analyse(IncrementExp e, info) { e.variable = analyse(e.variable, info); *************** *** 564,568 **** } ! analyse(e@LiteralArrayExp, info) { analyseExps(cast(e.elements), info); --- 564,568 ---- } ! analyse(LiteralArrayExp e, info) { analyseExps(cast(e.elements), info); *************** *** 570,574 **** } ! analyse(e@NewArrayExp, info) { e.resolveTC(info.typeMap); --- 570,574 ---- } ! analyse(NewArrayExp e, info) { e.resolveTC(info.typeMap); *************** *** 577,581 **** } ! analyse(e@NewExp, info) { e.arguments.analyse(info, noEscape: false); --- 577,581 ---- } ! analyse(NewExp e, info) { e.arguments.analyse(info, noEscape: false); *************** *** 584,588 **** } ! analyse(e@StatementExp, info) { analyse(e.statement, info); --- 584,588 ---- } ! analyse(StatementExp e, info) { analyse(e.statement, info); *************** *** 590,596 **** } ! analyse(e@NullExp, i) = e; ! analyse(c@ConstantExp, info) { if (c.type != null) --- 590,596 ---- } ! analyse(NullExp e, i) = e; ! analyse(ConstantExp c, info) { if (c.type != null) *************** *** 613,617 **** } ! analyse(e@TypeConstantExp, info) { LocatedString name = cast(e.value); --- 613,617 ---- } ! analyse(TypeConstantExp e, info) { LocatedString name = cast(e.value); *************** *** 634,638 **** } ! analyse(e@TupleExp, info) { analyseExps(cast(notNull(e.expressions)), info); --- 634,638 ---- } ! analyse(TupleExp e, info) { analyseExps(cast(notNull(e.expressions)), info); *************** *** 641,645 **** ! analyse(e@SuperExp, info) { e.resolveTC(info.outerTypeScope); --- 641,645 ---- ! analyse(SuperExp e, info) { e.resolveTC(info.outerTypeScope); *************** *** 650,657 **** ****************************************************************/ ! analyse(s@Statement, info) {} analyse(null(Statement), info) {} ! analyse(decl@Block.LocalVariable, info) { if (decl.value != null) --- 650,657 ---- ****************************************************************/ ! analyse(Statement s, info) {} analyse(null(Statement), info) {} ! analyse(Block.LocalVariable decl, info) { if (decl.value != null) *************** *** 666,670 **** } ! analyse(decl@Block.LocalConstant, info) { decl.value = analyse(decl.value, info); --- 666,670 ---- } ! analyse(Block.LocalConstant decl, info) { decl.value = analyse(decl.value, info); *************** *** 672,676 **** } ! analyse(decl@Block.LocalFunction, info) { notNull(decl.parameters).resolveCalledFromAnalyse(cast(info)); --- 672,676 ---- } ! analyse(Block.LocalFunction decl, info) { notNull(decl.parameters).resolveCalledFromAnalyse(cast(info)); *************** *** 680,684 **** } ! analyse(b@Block, info) { info.begin(); --- 680,684 ---- } ! analyse(Block b, info) { info.begin(); *************** *** 703,707 **** } ! analyse(s@ExpressionStmt, info) { s.exp = analyse(s.exp, info); --- 703,707 ---- } ! analyse(ExpressionStmt s, info) { s.exp = analyse(s.exp, info); *************** *** 712,716 **** ****************************************************************/ ! analyse(l@LoopStmt, info) { // If the test comes before the body, then the body might not execute --- 712,716 ---- ****************************************************************/ ! analyse(LoopStmt l, info) { // If the test comes before the body, then the body might not execute *************** *** 754,758 **** } ! analyse(b@BreakStmt, info) { ?LoopStmt loop = info.currentLoop; --- 754,758 ---- } ! analyse(BreakStmt b, info) { ?LoopStmt loop = info.currentLoop; *************** *** 764,768 **** } ! analyse(s@LabeledStmt, info) { mustNotFindLabel(notNull(s.getLabel()), info); --- 764,768 ---- } ! analyse(LabeledStmt s, info) { mustNotFindLabel(notNull(s.getLabel()), info); *************** *** 797,801 **** } ! analyse(b@BreakLabelStmt, info) { LabeledStmt target = b.statement = mustFindLabel(notNull(b.label), info); --- 797,801 ---- } ! analyse(BreakLabelStmt b, info) { LabeledStmt target = b.statement = mustFindLabel(notNull(b.label), info); *************** *** 816,820 **** } ! analyse(c@ContinueStmt, info) { if (c.label == null) --- 816,820 ---- } ! analyse(ContinueStmt c, info) { if (c.label == null) *************** *** 834,838 **** } ! analyse(r@ReturnStmt, info) { r.value = analyse(r.value, info); --- 834,838 ---- } ! analyse(ReturnStmt r, info) { r.value = analyse(r.value, info); *************** *** 840,849 **** } ! analyse(r@VoidReturnStmt, info) { info.setUnreachable(); } ! analyse(t@TryStmt, info) { info.beginCases(); --- 840,849 ---- } ! analyse(VoidReturnStmt r, info) { info.setUnreachable(); } ! analyse(TryStmt t, info) { info.beginCases(); *************** *** 877,881 **** } ! analyse(s@SynchronizedStmt, info) { s.object = analyse(s.object, info); --- 877,881 ---- } ! analyse(SynchronizedStmt s, info) { s.object = analyse(s.object, info); Index: rewrite.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/rewrite.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** rewrite.nice 28 Jul 2004 14:40:33 -0000 1.4 --- rewrite.nice 29 Jul 2004 12:11:40 -0000 1.5 *************** *** 33,38 **** Statement rewrite(Statement); ! rewrite(s@Statement) = s; ! rewrite(s@Block) { s.statements = rewrite(s.statements); --- 33,38 ---- Statement rewrite(Statement); ! rewrite(Statement s) = s; ! rewrite(Block s) { s.statements = rewrite(s.statements); *************** *** 67,71 **** ?IfExp ifExp(?Statement); ifExp(s) = null; ! ifExp(s@ExpressionStmt) { if (s.exp instanceof bossa.syntax.IfExp) --- 67,71 ---- ?IfExp ifExp(?Statement); ifExp(s) = null; ! ifExp(ExpressionStmt s) { if (s.exp instanceof bossa.syntax.IfExp) *************** *** 76,81 **** Statement makeStatement(Expression); ! makeStatement(e@Expression) = new ExpressionStmt(e); ! makeStatement(e@StatementExp) = e.statement; Block makeBlock(Expression first, ?Statement[] rest) --- 76,81 ---- Statement makeStatement(Expression); ! makeStatement(Expression e) = new ExpressionStmt(e); ! makeStatement(StatementExp e) = e.statement; Block makeBlock(Expression first, ?Statement[] rest) Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** typecheck.nice 28 Jul 2004 20:48:28 -0000 1.103 --- typecheck.nice 29 Jul 2004 12:11:40 -0000 1.104 *************** *** 30,34 **** typecheck(null(Expression)) {} ! typecheck(e@AssignExp) { Expression to = notNull(notNull(e.to).noOverloading()); --- 30,34 ---- typecheck(null(Expression)) {} ! typecheck(AssignExp e) { Expression to = notNull(notNull(e.to).noOverloading()); *************** *** 191,195 **** } ! typecheck(e@CallExp) { typecheck(e.function); --- 191,195 ---- } ! typecheck(CallExp e) { typecheck(e.function); *************** *** 230,234 **** } ! typecheck(e@FunExp) { ?Function saved = Node.getCurrentFunction(); --- 230,234 ---- } ! typecheck(FunExp e) { ?Function saved = Node.getCurrentFunction(); *************** *** 247,251 **** } ! typecheck(e@IdentExp) { throw new Error("typecheck in IdentExp"); --- 247,251 ---- } ! typecheck(IdentExp e) { throw new Error("typecheck in IdentExp"); *************** *** 262,266 **** (?List<MonoSymbol>, ?List<MonoSymbol>) nullnessInfo(Expression test); nullnessInfo(test) = (null, null); ! nullnessInfo(test@CallExp) { if (test.isCallTo("||")) --- 262,266 ---- (?List<MonoSymbol>, ?List<MonoSymbol>) nullnessInfo(Expression test); nullnessInfo(test) = (null, null); ! nullnessInfo(CallExp test) { if (test.isCallTo("||")) *************** *** 346,350 **** (?List<(MonoSymbol, mlsub.typing.Monotype)>, ?List<(MonoSymbol, mlsub.typing.Monotype)>) instanceofInfo(Expression test); instanceofInfo(test) = (null, null); ! instanceofInfo(test@CallExp) { if (test.isCallTo("||")) --- 346,350 ---- (?List<(MonoSymbol, mlsub.typing.Monotype)>, ?List<(MonoSymbol, mlsub.typing.Monotype)>) instanceofInfo(Expression test); instanceofInfo(test) = (null, null); ! instanceofInfo(CallExp test) { if (test.isCallTo("||")) *************** *** 496,500 **** } ! typecheck(e@IfExp) { Expression condition = notNull(e.condition); --- 496,500 ---- } ! typecheck(IfExp e) { Expression condition = notNull(e.condition); *************** *** 597,601 **** } ! typecheck(e@IncrementExp) { try{ --- 597,601 ---- } ! typecheck(IncrementExp e) { try{ *************** *** 612,621 **** } ! typecheck(e@LiteralArrayExp) { typecheckExps(cast(e.elements)); } ! typecheck(e@NewArrayExp) { Expression[] knownDimensions = notNull(e.knownDimensions); --- 612,621 ---- } ! typecheck(LiteralArrayExp e) { typecheckExps(cast(e.elements)); } ! typecheck(NewArrayExp e) { Expression[] knownDimensions = notNull(e.knownDimensions); *************** *** 635,639 **** } ! typecheck(e@NewExp) { e.arguments.typecheckArgs(); --- 635,639 ---- } ! typecheck(NewExp e) { e.arguments.typecheckArgs(); *************** *** 642,646 **** } ! typecheck(e@StatementExp) { e.statement = rewrite(e.statement); --- 642,646 ---- } ! typecheck(StatementExp e) { e.statement = rewrite(e.statement); *************** *** 649,658 **** } ! typecheck(e@TupleExp) { typecheckExps(cast(notNull(e.expressions))); } ! typecheck(e@SuperExp) { if (Node.currentFunction instanceof MethodBodyDefinition) --- 649,658 ---- } ! typecheck(TupleExp e) { typecheckExps(cast(notNull(e.expressions))); } ! typecheck(SuperExp e) { if (Node.currentFunction instanceof MethodBodyDefinition) *************** *** 664,668 **** } ! typecheck(e@ExpLocalVariable) { Block.LocalVariable decl = notNull(e.variable); --- 664,668 ---- } ! typecheck(ExpLocalVariable e) { Block.LocalVariable decl = notNull(e.variable); *************** *** 703,711 **** } ! typecheck(c@ConstantExp){} ! typecheck(e@NullExp) {} ! typecheck(e@OverloadedSymbolExp) {} ! typecheck(e@PackageExp) {} ! typecheck(e@SymbolExp) {} /**************************************************************** --- 703,711 ---- } ! typecheck(ConstantExp c){} ! typecheck(NullExp e) {} ! typecheck(OverloadedSymbolExp e) {} ! typecheck(PackageExp e) {} ! typecheck(SymbolExp e) {} /**************************************************************** *************** *** 715,719 **** typecheck(null(Statement)) {} ! typecheck(b@Block) { b.statements = rewrite(b.statements); --- 715,719 ---- typecheck(null(Statement)) {} ! typecheck(Block b) { b.statements = rewrite(b.statements); *************** *** 728,732 **** } ! typecheck(decl@Block.LocalVariable) { MonoSymbol target = notNull(decl.left()); --- 728,732 ---- } ! typecheck(Block.LocalVariable decl) { MonoSymbol target = notNull(decl.left()); *************** *** 771,775 **** } ! typecheck(decl@Block.LocalConstant) { if (! notNull(decl.left).used) --- 771,775 ---- } ! typecheck(Block.LocalConstant decl) { if (! notNull(decl.left).used) *************** *** 787,791 **** } ! typecheck(decl@Block.LocalFunction) { typecheck(decl.value); --- 787,791 ---- } ! typecheck(Block.LocalFunction decl) { typecheck(decl.value); *************** *** 801,805 **** } ! typecheck(s@ExpressionStmt) { s.exp = notNull(s.exp).noOverloading(); --- 801,805 ---- } ! typecheck(ExpressionStmt s) { s.exp = notNull(s.exp).noOverloading(); *************** *** 807,811 **** } ! typecheck(l@LoopStmt) { ?Expression whileExp = l.whileExp; --- 807,811 ---- } ! typecheck(LoopStmt l) { ?Expression whileExp = l.whileExp; *************** *** 848,861 **** } ! typecheck(b@BreakStmt) {} ! typecheck(b@BreakLabelStmt) {} ! typecheck(c@ContinueStmt) {} ! typecheck(s@LabeledStmt) { typecheck(s.getStatement()); } ! typecheck(r@ReturnStmt) { ?Function function = Node.currentFunction; --- 848,861 ---- } ! typecheck(BreakStmt b) {} ! typecheck(BreakLabelStmt b) {} ! typecheck(ContinueStmt c) {} ! typecheck(LabeledStmt s) { typecheck(s.getStatement()); } ! typecheck(ReturnStmt r) { ?Function function = Node.currentFunction; *************** *** 892,896 **** } ! typecheck(r@VoidReturnStmt) { ?Function function = Node.currentFunction; --- 892,896 ---- } ! typecheck(VoidReturnStmt r) { ?Function function = Node.currentFunction; *************** *** 914,918 **** ! typecheck(t@TryStmt) { typecheck(t.body); --- 914,918 ---- ! typecheck(TryStmt t) { typecheck(t.body); *************** *** 921,925 **** } ! typecheck(s@SynchronizedStmt) { s.object = notNull(s.object).noOverloading(); --- 921,925 ---- } ! typecheck(SynchronizedStmt s) { s.object = notNull(s.object).noOverloading(); *************** *** 967,973 **** } ! boolean isNullError(TypingEx ex); ! isNullError(@TypingEx) = false; ! isNullError(ex@MonotypeLeqEx) { /* --- 967,972 ---- } ! boolean isNullError(TypingEx ex) = false; ! isNullError(MonotypeLeqEx ex) { /* |