From 1e62bd261c100d9778821fcb5822a5936e4e9972 Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Sat, 27 Apr 2024 13:10:51 +0200 Subject: [PATCH] a bit cleanup for the PR; make the old function markFunctionStart(int) deprecated and do not use the old stuff internally --- src/org/mozilla/javascript/Decompiler.java | 2 ++ src/org/mozilla/javascript/IRFactory.java | 2 +- testsrc/jstests/harmony/generators-basic.js | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/org/mozilla/javascript/Decompiler.java b/src/org/mozilla/javascript/Decompiler.java index 72fd1d90cf..467cdd2db0 100644 --- a/src/org/mozilla/javascript/Decompiler.java +++ b/src/org/mozilla/javascript/Decompiler.java @@ -74,6 +74,8 @@ int markFunctionStart(int functionType, boolean isGenerator) { return savedOffset; } + /** @deprecated use {@link #markFunctionStart(int, boolean)} instead */ + @Deprecated int markFunctionStart(int functionType) { return markFunctionStart(functionType, false); } diff --git a/src/org/mozilla/javascript/IRFactory.java b/src/org/mozilla/javascript/IRFactory.java index 7ef4e0a4b8..7e932cc4ca 100644 --- a/src/org/mozilla/javascript/IRFactory.java +++ b/src/org/mozilla/javascript/IRFactory.java @@ -687,7 +687,7 @@ private Node transformGenExpr(GeneratorExpression node) { fn.setRequiresActivation(); int functionType = fn.getFunctionType(); - int start = decompiler.markFunctionStart(functionType); + int start = decompiler.markFunctionStart(functionType, false); Node mexpr = decompileFunctionHeader(fn); int index = parser.currentScriptOrFn.addFunction(fn); diff --git a/testsrc/jstests/harmony/generators-basic.js b/testsrc/jstests/harmony/generators-basic.js index eebd5bee07..5346b5ee79 100644 --- a/testsrc/jstests/harmony/generators-basic.js +++ b/testsrc/jstests/harmony/generators-basic.js @@ -163,7 +163,6 @@ assertEquals(undefined, r.value); assertTrue(r.done); // toString returns the correct value - assertEquals("\nfunction* gen() {\n for (var i = 0; i < 3; i++) {\n yield i;\n }\n}\n", gen.toString()); "success";