mvel/mvel — pull request #43 by mdproctor (2012-04-17 03:52:08+00:00)
Title: for loop has no visibility to local variables in strict mode

String str = "int height = 100; int j; for (i = 0; i < height; i++) {j++ }; return j;";

[Error: no such identifier: height]
[Near : {... j; for (i = 0; i < height; i++) {j++ }; return j; ....}]
^
[Line: 1, Column: 42]
at org.mvel2.compiler.ExpressionCompiler.verify(ExpressionCompiler.java:397)
at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:273)
at org.mvel2.util.ParseTools.subCompileExpression(ParseTools.java:2133)
at org.mvel2.ast.ForNode.buildForEach(ForNode.java:104)
at org.mvel2.ast.ForNode.(ForNode.java:48)
at org.mvel2.compiler.AbstractParser.createBlockToken(AbstractParser.java:1491)
at org.mvel2.compiler.AbstractParser._captureBlock(AbstractParser.java:1720)
at org.mvel2.compiler.AbstractParser.captureCodeBlock(AbstractParser.java:1555)
at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:390)
at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:128)
at org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62)
at org.mvel2.MVEL.compileExpression(MVEL.java:810)
at org.mvel2.tests.core.ControlFlowTests.testForLoopWithVar(ControlFlowTests.java:202)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)