diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 7c9079e0d46a..315ce01fe063 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -4990,24 +4990,6 @@ SetTimeResolution(JSContext* cx, unsigned argc, Value* vp) return true; } -static bool -EnableExpressionClosures(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - JS::ContextOptionsRef(cx).setExpressionClosures(true); - args.rval().setUndefined(); - return true; -} - -static bool -DisableExpressionClosures(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - JS::ContextOptionsRef(cx).setExpressionClosures(false); - args.rval().setUndefined(); - return true; -} - JSScript* js::TestingFunctionArgumentToScript(JSContext* cx, HandleValue v, @@ -5781,14 +5763,6 @@ gc::ZealModeHelpText), " Enables time clamping and jittering. Specify a time resolution in\n" " microseconds and whether or not to jitter\n"), - JS_FN_HELP("enableExpressionClosures", EnableExpressionClosures, 0, 0, -"enableExpressionClosures()", -" Enables the deprecated, non-standard expression closures.\n"), - - JS_FN_HELP("disableExpressionClosures", DisableExpressionClosures, 0, 0, -"disableExpressionClosures()", -" Disables the deprecated, non-standard expression closures.\n"), - JS_FN_HELP("baselineCompile", BaselineCompile, 2, 0, "baselineCompile([fun/code], forceDebugInstrumentation=false)", " Baseline-compiles the given JS function or script.\n" diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 82bbf22c00a8..673e7ebbe2cd 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -3262,16 +3262,6 @@ Parser::skipLazyInnerFunction(ParseNode* funcNode, uint if (!tokenStream.advance(fun->lazyScript()->end())) return false; - if (allowExpressionClosures()) { - // Only expression closure can be Statement kind. - // If we remove expression closure, we can remove isExprBody flag from - // LazyScript and JSScript. - if (kind == Statement && funbox->isExprBody()) { - if (!matchOrInsertSemicolon()) - return false; - } - } - // Append possible Annex B function box only upon successfully parsing. if (tryAnnexB && !pc->innermostScope()->addPossibleAnnexBFunctionBox(pc, funbox)) return false; @@ -3785,23 +3775,8 @@ GeneralParser::functionFormalParametersAndBody(InHandling i uint32_t openedPos = 0; if (tt != TokenKind::Lc) { if (kind != Arrow) { - if (funbox->isGenerator() || funbox->isAsync() || kind == Method || - kind == GetterNoExpressionClosure || kind == SetterNoExpressionClosure || - IsConstructorKind(kind) || kind == PrimaryExpression) - { - error(JSMSG_CURLY_BEFORE_BODY); - return false; - } - - if (allowExpressionClosures()) { - this->addTelemetry(DeprecatedLanguageExtension::ExpressionClosure); - if (!warnOnceAboutExprClosure()) - return false; - handler.noteExpressionClosure(pn); - } else { - error(JSMSG_CURLY_BEFORE_BODY); - return false; - } + error(JSMSG_CURLY_BEFORE_BODY); + return false; } anyChars.ungetToken(); @@ -3863,7 +3838,7 @@ GeneralParser::functionFormalParametersAndBody(InHandling i JSMSG_CURLY_OPENED, openedPos)); funbox->setEnd(anyChars); } else { - MOZ_ASSERT_IF(!allowExpressionClosures(), kind == Arrow); + MOZ_ASSERT(kind == Arrow); if (anyChars.hadError()) return false; diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index df4ead910f54..d01bfd1d1256 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -340,9 +340,6 @@ class ParserBase bool hasValidSimpleStrictParameterNames(); - bool allowExpressionClosures() const { - return options().expressionClosuresOption; - } /* * Create a new function object given a name (which is optional if this is * a function expression). @@ -705,7 +702,6 @@ class GeneralParser using Base::isValidSimpleAssignmentTarget; using Base::pc; using Base::usedNames; - using Base::allowExpressionClosures; private: using Base::checkAndMarkSuperScope; @@ -1408,7 +1404,6 @@ class Parser final using Base::pos; using Base::ss; using Base::tokenStream; - using Base::allowExpressionClosures; private: using Base::alloc; diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 4dcee8f8c1a5..580b356bb583 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -3965,7 +3965,6 @@ JS::TransitiveCompileOptions::copyPODTransitiveOptions(const TransitiveCompileOp canLazilyParse = rhs.canLazilyParse; strictOption = rhs.strictOption; extraWarningsOption = rhs.extraWarningsOption; - expressionClosuresOption = rhs.expressionClosuresOption; werrorOption = rhs.werrorOption; asmJSOption = rhs.asmJSOption; throwOnAsmJSValidationFailureOption = rhs.throwOnAsmJSValidationFailureOption; @@ -4088,7 +4087,6 @@ JS::CompileOptions::CompileOptions(JSContext* cx) { strictOption = cx->options().strictMode(); extraWarningsOption = cx->compartment()->behaviors().extraWarnings(cx); - expressionClosuresOption = cx->options().expressionClosures(); isProbablySystemCode = cx->compartment()->isProbablySystemCode(); werrorOption = cx->options().werror(); if (!cx->options().asmJS()) diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 2dec365467d0..ac78516174ef 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -990,7 +990,6 @@ class JS_PUBLIC_API(ContextOptions) { #ifdef FUZZING , fuzzing_(false) #endif - , expressionClosures_(false) , arrayProtoValues_(true) { } @@ -1147,12 +1146,6 @@ class JS_PUBLIC_API(ContextOptions) { } #endif - bool expressionClosures() const { return expressionClosures_; } - ContextOptions& setExpressionClosures(bool flag) { - expressionClosures_ = flag; - return *this; - } - bool arrayProtoValues() const { return arrayProtoValues_; } ContextOptions& setArrayProtoValues(bool flag) { arrayProtoValues_ = flag; @@ -1189,7 +1182,6 @@ class JS_PUBLIC_API(ContextOptions) { #ifdef FUZZING bool fuzzing_ : 1; #endif - bool expressionClosures_ : 1; bool arrayProtoValues_ : 1; }; @@ -3591,7 +3583,6 @@ class JS_FRIEND_API(TransitiveCompileOptions) canLazilyParse(true), strictOption(false), extraWarningsOption(false), - expressionClosuresOption(false), werrorOption(false), asmJSOption(AsmJSOption::Disabled), throwOnAsmJSValidationFailureOption(false), @@ -3627,7 +3618,6 @@ class JS_FRIEND_API(TransitiveCompileOptions) bool canLazilyParse; bool strictOption; bool extraWarningsOption; - bool expressionClosuresOption; bool werrorOption; AsmJSOption asmJSOption; bool throwOnAsmJSValidationFailureOption;