зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1507520 - Make BigInt parsing dependent on run-time feature flag r=jandem,terpri
Differential Revision: https://phabricator.services.mozilla.com/D17349 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
85cf25f341
Коммит
514415e0a0
|
@ -116,6 +116,7 @@ class JS_PUBLIC_API TransitiveCompileOptions {
|
|||
bool allowHTMLComments = true;
|
||||
bool isProbablySystemCode = false;
|
||||
bool hideScriptFromDebugger = false;
|
||||
bool bigIntEnabledOption = false;
|
||||
|
||||
/**
|
||||
* |introductionType| is a statically allocated C string: one of "eval",
|
||||
|
|
|
@ -2159,7 +2159,7 @@ MOZ_MUST_USE bool TokenStreamSpecific<Unit, AnyCharsAccess>::decimalNumber(
|
|||
}
|
||||
}
|
||||
#ifdef ENABLE_BIGINT
|
||||
else if (unit == 'n') {
|
||||
else if (unit == 'n' && anyCharsAccess().options().bigIntEnabledOption) {
|
||||
isBigInt = true;
|
||||
unit = peekCodeUnit();
|
||||
}
|
||||
|
@ -2365,6 +2365,7 @@ MOZ_MUST_USE bool TokenStreamSpecific<Unit, AnyCharsAccess>::regexpLiteral(
|
|||
template <typename Unit, class AnyCharsAccess>
|
||||
MOZ_MUST_USE bool TokenStreamSpecific<Unit, AnyCharsAccess>::bigIntLiteral(
|
||||
TokenStart start, Modifier modifier, TokenKind* out) {
|
||||
MOZ_ASSERT(anyCharsAccess().options().bigIntEnabledOption);
|
||||
MOZ_ASSERT(this->sourceUnits.previousCodeUnit() == toUnit('n'));
|
||||
MOZ_ASSERT(this->sourceUnits.offset() > start.offset());
|
||||
uint32_t length = this->sourceUnits.offset() - start.offset();
|
||||
|
@ -2645,7 +2646,7 @@ MOZ_MUST_USE bool TokenStreamSpecific<Unit, AnyCharsAccess>::getTokenInternal(
|
|||
}
|
||||
|
||||
#ifdef ENABLE_BIGINT
|
||||
if (unit == 'n') {
|
||||
if (unit == 'n' && anyCharsAccess().options().bigIntEnabledOption) {
|
||||
if (isLegacyOctalOrNoctal) {
|
||||
error(JSMSG_BIGINT_INVALID_SYNTAX);
|
||||
return badToken();
|
||||
|
|
|
@ -3422,6 +3422,7 @@ void JS::TransitiveCompileOptions::copyPODTransitiveOptions(
|
|||
hasIntroductionInfo = rhs.hasIntroductionInfo;
|
||||
isProbablySystemCode = rhs.isProbablySystemCode;
|
||||
hideScriptFromDebugger = rhs.hideScriptFromDebugger;
|
||||
bigIntEnabledOption = rhs.bigIntEnabledOption;
|
||||
};
|
||||
|
||||
void JS::ReadOnlyCompileOptions::copyPODOptions(
|
||||
|
@ -3548,6 +3549,7 @@ JS::CompileOptions::CompileOptions(JSContext* cx)
|
|||
}
|
||||
throwOnAsmJSValidationFailureOption =
|
||||
cx->options().throwOnAsmJSValidationFailure();
|
||||
bigIntEnabledOption = cx->realm()->creationOptions().getBigIntEnabled();
|
||||
}
|
||||
|
||||
CompileOptions& CompileOptions::setIntroductionInfoToCaller(
|
||||
|
|
Загрузка…
Ссылка в новой задаче