Bug 1083458 - Remove basic expression closure code. r=jandem

--HG--
extra : rebase_source : 56a47c9f89bef389b636b85ceeae8d6dda47ba2d
extra : histedit_source : 9224420d64ebab70cbf32e4b25ff78f738a2c4fc
This commit is contained in:
Tom Schuster 2018-03-12 20:14:54 +01:00
Родитель c5a5409300
Коммит 3d059d5b19
5 изменённых файлов: 3 добавлений и 71 удалений

Просмотреть файл

@ -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"

Просмотреть файл

@ -3262,16 +3262,6 @@ Parser<FullParseHandler, CharT>::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<ParseHandler, CharT>::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<ParseHandler, CharT>::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;

Просмотреть файл

@ -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<FullParseHandler, CharT> final
using Base::pos;
using Base::ss;
using Base::tokenStream;
using Base::allowExpressionClosures;
private:
using Base::alloc;

Просмотреть файл

@ -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())

Просмотреть файл

@ -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;