Thread: [Nice-commit] Nice/src/bossa/syntax CustomConstructor.java,1.20,1.21 MethodImplementation.java,1.8,1
Brought to you by:
bonniot
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13177/F:/nice/src/bossa/syntax Modified Files: CustomConstructor.java MethodImplementation.java analyse.nice dispatch.java.bootstrap pattern.nice tools.nice typecheck.nice Log Message: Don't allow redefinition of parameters in local variables. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** analyse.nice 2 Sep 2004 15:46:32 -0000 1.111 --- analyse.nice 7 Oct 2004 22:03:44 -0000 1.112 *************** *** 51,54 **** --- 51,70 ---- } + Statement analyseMethodBody(Statement s, VarScope varScope, TypeScope typeScope, + MonoSymbol[] params, boolean mustReturnAValue) + { + Info info = buildInfo(varScope, typeScope); + + info.addVars(params); + + analyse(s, info); + + if (mustReturnAValue && !info.getUnreachable()) + throw error(s, "Missing return statement"); + + return s; + } + + analyse(Expression e, varScope, typeScope) = analyse(e, buildInfo(varScope, typeScope)); *************** *** 840,845 **** { // if it isn't a loop it must be a block because of the parser ! Block b = cast(target.getStatement()); ! b.isBreakTarget = true; } --- 856,861 ---- { // if it isn't a loop it must be a block because of the parser ! Block block = cast(target.getStatement()); ! block.isBreakTarget = true; } Index: CustomConstructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CustomConstructor.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CustomConstructor.java 7 Oct 2004 16:25:06 -0000 1.20 --- CustomConstructor.java 7 Oct 2004 22:03:43 -0000 1.21 *************** *** 112,117 **** { bossa.syntax.dispatch.resolveCCThis(body, this, classe); ! body = bossa.syntax.dispatch.analyse ! (body, thisScope, thisTypeScope, false); } --- 112,117 ---- { bossa.syntax.dispatch.resolveCCThis(body, this, classe); ! body = bossa.syntax.dispatch.analyseMethodBody ! (body, thisScope, thisTypeScope, getSymbols(), false); } Index: pattern.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/pattern.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pattern.nice 15 Sep 2004 12:58:57 -0000 1.4 --- pattern.nice 7 Oct 2004 22:03:44 -0000 1.5 *************** *** 100,103 **** --- 100,105 ---- { atAny() = true; + + getName() = notNull(name).toString().equals("_") ? null : name; } *************** *** 235,239 **** public class ReferencePattern extends ValuePattern { ! getName() = cast(null); } --- 237,241 ---- public class ReferencePattern extends ValuePattern { ! getName() = null; } Index: MethodImplementation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodImplementation.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MethodImplementation.java 14 Sep 2004 16:11:46 -0000 1.8 --- MethodImplementation.java 7 Oct 2004 22:03:44 -0000 1.9 *************** *** 91,95 **** } ! res[tn] = new MonoSymbol(p.getName(), type); } scope.addSymbols(res); --- 91,96 ---- } ! LocatedString argName = p.getName() != null ? p.getName() : new LocatedString("argument_"+tn, bossa.util.Location.nowhere()); ! res[tn] = new MonoSymbol(argName, type); } scope.addSymbols(res); *************** *** 116,121 **** try { ! body = bossa.syntax.dispatch.analyse ! (body, scope, typeScope, !Types.isVoid(declaration.getReturnType())); } finally { --- 117,122 ---- try { ! body = bossa.syntax.dispatch.analyseMethodBody ! (body, scope, typeScope, parameters, !Types.isVoid(declaration.getReturnType())); } finally { Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** tools.nice 16 Sep 2004 21:25:59 -0000 1.51 --- tools.nice 7 Oct 2004 22:03:44 -0000 1.52 *************** *** 212,215 **** --- 212,217 ---- ?mlsub.typing.TypeConstructor getRuntimeTC(Pattern) = native mlsub.typing.TypeConstructor Pattern.getRuntimeTC(); boolean matchesValue(Pattern, ConstantExp) = native boolean Pattern.matchesValue(ConstantExp); + public ?LocatedString getName(Pattern) = native LocatedString Pattern.getName(); + // Retypings needed since java types are not strict. Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** dispatch.java.bootstrap 2 Sep 2004 15:46:32 -0000 1.22 --- dispatch.java.bootstrap 7 Oct 2004 22:03:44 -0000 1.23 *************** *** 75,79 **** { return null; } ! static Statement analyse(Statement s, VarScope v, TypeScope t, boolean r) { return null; } --- 75,82 ---- { return null; } ! static Statement analyse(Statement s, VarScope v, TypeScope t, boolean r) ! { return null; } ! ! static Statement analyseMethodBody(Statement s, VarScope varScope, TypeScope typeScope, MonoSymbol[] params, boolean mustReturnAValue) { return null; } Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** typecheck.nice 3 Sep 2004 18:07:27 -0000 1.115 --- typecheck.nice 7 Oct 2004 22:03:44 -0000 1.116 *************** *** 242,246 **** } } ! catch(TypingEx e){ } } --- 242,246 ---- } } ! catch(TypingEx te){ } } |