From 3f3e2b25981410596ce017ec0d2421b985a00d14 Mon Sep 17 00:00:00 2001 From: sundar Date: Mon, 17 Jun 2013 13:56:05 +0530 Subject: [PATCH] 8016550: nashorn.option.no.syntax.extensions has the wrong default Reviewed-by: hannesw, lagergren --- make/project.properties | 3 ++- .../api/scripting/NashornScriptEngine.java | 2 +- src/jdk/nashorn/internal/parser/Parser.java | 2 +- .../internal/runtime/ScriptEnvironment.java | 4 ---- .../runtime/resources/Options.properties | 18 +++++------------- test/script/basic/moduleload.js | 1 - 6 files changed, 9 insertions(+), 21 deletions(-) diff --git a/make/project.properties b/make/project.properties index 2e3839b6..66bbdbeb 100644 --- a/make/project.properties +++ b/make/project.properties @@ -193,7 +193,8 @@ test262-test-sys-prop.test.js.enable.strict.mode=true # list of test262 test dirs to be excluded test262-test-sys-prop.test.js.exclude.dir=\ - ${test262.suite.dir}/intl402/ + ${test262.suite.dir}/intl402/ \ + ${test262.suite.dir}/bestPractice/ test262-test-sys-prop.test.failed.list.file=${build.dir}/test/failedTests diff --git a/src/jdk/nashorn/api/scripting/NashornScriptEngine.java b/src/jdk/nashorn/api/scripting/NashornScriptEngine.java index 283e36e9..6a6f2e37 100644 --- a/src/jdk/nashorn/api/scripting/NashornScriptEngine.java +++ b/src/jdk/nashorn/api/scripting/NashornScriptEngine.java @@ -72,7 +72,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C private final ScriptObject global; // default options passed to Nashorn Options object - private static final String[] DEFAULT_OPTIONS = new String[] { "-scripting", "-af", "-doe" }; + private static final String[] DEFAULT_OPTIONS = new String[] { "-scripting", "-doe" }; NashornScriptEngine(final NashornScriptEngineFactory factory, final ClassLoader appLoader) { this(factory, DEFAULT_OPTIONS, appLoader); diff --git a/src/jdk/nashorn/internal/parser/Parser.java b/src/jdk/nashorn/internal/parser/Parser.java index ee90b8d9..0c2c1633 100644 --- a/src/jdk/nashorn/internal/parser/Parser.java +++ b/src/jdk/nashorn/internal/parser/Parser.java @@ -2403,7 +2403,7 @@ loop: verifyStrictIdent(name, "function name"); } else if (isStatement) { // Nashorn extension: anonymous function statements - if (env._no_syntax_extensions || !env._anon_functions) { + if (env._no_syntax_extensions) { expect(IDENT); } } diff --git a/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java b/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java index 2ca897db..f04dedf0 100644 --- a/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java +++ b/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java @@ -56,9 +56,6 @@ public final class ScriptEnvironment { /** Current Options object. */ private final Options options; - /** Always allow functions as statements */ - public final boolean _anon_functions; - /** Size of the per-global Class cache size */ public final int _class_cache_size; @@ -192,7 +189,6 @@ public final class ScriptEnvironment { this.namespace = new Namespace(); this.options = options; - _anon_functions = options.getBoolean("anon.functions"); _class_cache_size = options.getInteger("class.cache.size"); _compile_only = options.getBoolean("compile.only"); _debug_lines = options.getBoolean("debug.lines"); diff --git a/src/jdk/nashorn/internal/runtime/resources/Options.properties b/src/jdk/nashorn/internal/runtime/resources/Options.properties index 4dd6df6f..4d7be62b 100644 --- a/src/jdk/nashorn/internal/runtime/resources/Options.properties +++ b/src/jdk/nashorn/internal/runtime/resources/Options.properties @@ -59,7 +59,7 @@ nashorn.options.D.key = nashorn.option.D ## is_undocumented - should this option never appear in the online help. defaults to no. ## desc - description of what the option does ## default - default value of the option. e.g. debug.lines is true by default. Not set means option not available by default -## dependency - does this arg imply another arg, e.g. scripting -> anon-functions +## dependency - does this arg imply another arg. ## confict - does this arg conflict with another arg e.g trace && instrument ## value_next_arg - is the opton's value passed as next argument in command line? ## @@ -77,16 +77,9 @@ nashorn.option.xhelp = { \ desc="Print extended help for command line flags." \ } -nashorn.option.anon.functions = { \ - name="--anon-functions", \ - short_name="-af", \ - is_undocumented=true, \ - desc="Always allow functions as statements." \ -} - nashorn.option.class.cache.size ={ \ name="--class-cache-size", \ - short_name="--ccs", \ + short_name="-ccs", \ desc="Size of the Class cache size per global scope.", \ is_undocumented=true, \ type=Integer, \ @@ -201,10 +194,10 @@ nashorn.option.loader.per.compile = { \ nashorn.option.no.syntax.extensions = { \ name="--no-syntax-extensions", \ - short_name="--nse", \ + short_name="-nse", \ is_undocumented=true, \ desc="No non-standard syntax extensions", \ - default=-anon-functions=false \ + default=false \ } nashorn.option.package = { \ @@ -296,8 +289,7 @@ nashorn.option.strict = { \ nashorn.option.scripting = { \ name="-scripting", \ - desc="Enable scripting features.", \ - dependency="--anon-functions=true" \ + desc="Enable scripting features." \ } nashorn.option.specialize.calls = { \ diff --git a/test/script/basic/moduleload.js b/test/script/basic/moduleload.js index 628bfa24..633d2a1c 100644 --- a/test/script/basic/moduleload.js +++ b/test/script/basic/moduleload.js @@ -25,7 +25,6 @@ * This loads "module.js" and calls the anonymous top-level function from it. * * @test - * @option --anon-functions * @run */ -- GitLab