diff --git a/rhino/src/main/java/org/mozilla/javascript/Interpreter.java b/rhino/src/main/java/org/mozilla/javascript/Interpreter.java index 004893b7cd..7e0f6f74c0 100644 --- a/rhino/src/main/java/org/mozilla/javascript/Interpreter.java +++ b/rhino/src/main/java/org/mozilla/javascript/Interpreter.java @@ -1784,6 +1784,8 @@ private static Object interpretLoop(Context cx, CallFrame frame, Object throwabl ArrowFunction afun = (ArrowFunction) fun; fun = afun.getTargetFunction(); funThisObj = afun.getCallThis(cx); + } else if (fun instanceof LambdaConstructor) { + break; } else if (fun instanceof LambdaFunction) { fun = ((LambdaFunction) fun).getTarget(); } else if (fun instanceof BoundFunction) { diff --git a/tests/src/test/java/org/mozilla/javascript/tests/LambdaFunctionTest.java b/tests/src/test/java/org/mozilla/javascript/tests/LambdaFunctionTest.java index d12c1a3be6..a7fc14b329 100644 --- a/tests/src/test/java/org/mozilla/javascript/tests/LambdaFunctionTest.java +++ b/tests/src/test/java/org/mozilla/javascript/tests/LambdaFunctionTest.java @@ -37,7 +37,8 @@ public void cleanup() { } private void eval(String source) { - cx.evaluateString(root, source, "test.js", 1, null); + Utils.runWithAllOptimizationLevels( + ignored -> cx.evaluateString(root, source, "test.js", 1, null)); } @Test