[Nice-commit] Nice/src/gnu/expr LambdaExp.java,1.27,1.28
Brought to you by:
bonniot
|
From: Daniel B. <bo...@us...> - 2005-02-20 13:20:23
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10410/src/gnu/expr Modified Files: LambdaExp.java Log Message: Revert to revision 1.26 since the case of falsely reachable points because of 'assert false' is handled in the more general case by stdlib/nice/lang/inline/Assert.java revision 1.8. Index: LambdaExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/LambdaExp.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** LambdaExp.java 25 Dec 2004 15:51:44 -0000 1.27 --- LambdaExp.java 20 Feb 2005 13:20:03 -0000 1.28 *************** *** 482,510 **** { if (comp.method.reachableHere() && (! Compilation.usingTailCalls || isModuleBody() || isClassMethod() || isHandlingTailCalls())) ! { ! /* If there is a value to return, or the method returns void, ! then emit a return. ! */ ! if (code.SP > 0 || comp.method.getReturnType().isVoid()) ! code.emitReturn(); ! else ! /* ! This can happen for unreachable code, like after an ! 'assert false' in a non-void method. ! ! It can also be because reachableHere is not computed properly. ! */ ! { ! // Throw an error explaining the situation. ! ClassType error = ClassType.make("java.lang.Error"); ! code.emitNew(error); ! code.emitDup(); ! code.emitPushString("Invalid location reached. Enable assertion checking to get more precise information"); ! code.emitInvokeSpecial(error.getDeclaredMethod("<init>", new Type[]{Type.string_type})); ! code.emitThrow(); ! } ! } code.popScope(); // Undoes enterScope in allocParameters } --- 482,493 ---- { if (comp.method.reachableHere() + /* Work-around since reachableHere is not computed properly: + Only return if the method is void or if there is a value + on the stack. + */ + && (code.SP > 0 || comp.method.getReturnType().isVoid()) && (! Compilation.usingTailCalls || isModuleBody() || isClassMethod() || isHandlingTailCalls())) ! code.emitReturn(); code.popScope(); // Undoes enterScope in allocParameters } |