Commit 36491702 authored by caitpotter88's avatar caitpotter88 Committed by Commit bot

[cleanup] add Parser accessors for FLAG_harmony_function_sent

BUG=
LOG=N
R=adamk@chromium.org, littledan@chromium.org

Review URL: https://codereview.chromium.org/1702853002

Cr-Commit-Position: refs/heads/master@{#34051}
parent fd2edb0e
......@@ -116,7 +116,8 @@ class ParserBase : public Traits {
allow_strong_mode_(false),
allow_legacy_const_(true),
allow_harmony_do_expressions_(false),
allow_harmony_function_name_(false) {}
allow_harmony_function_name_(false),
allow_harmony_function_sent_(false) {}
#define ALLOW_ACCESSORS(name) \
bool allow_##name() const { return allow_##name##_; } \
......@@ -134,6 +135,7 @@ class ParserBase : public Traits {
ALLOW_ACCESSORS(legacy_const);
ALLOW_ACCESSORS(harmony_do_expressions);
ALLOW_ACCESSORS(harmony_function_name);
ALLOW_ACCESSORS(harmony_function_sent);
#undef ALLOW_ACCESSORS
uintptr_t stack_limit() const { return stack_limit_; }
......@@ -947,6 +949,7 @@ class ParserBase : public Traits {
bool allow_legacy_const_;
bool allow_harmony_do_expressions_;
bool allow_harmony_function_name_;
bool allow_harmony_function_sent_;
};
template <class Traits>
......@@ -2543,7 +2546,7 @@ ParserBase<Traits>::ParseMemberExpression(ExpressionClassifier* classifier,
Consume(Token::FUNCTION);
int function_token_position = position();
if (FLAG_harmony_function_sent && peek() == Token::PERIOD) {
if (allow_harmony_function_sent() && peek() == Token::PERIOD) {
// function.sent
int pos = position();
ExpectMetaProperty(CStrVector("sent"), "function.sent", pos, CHECK_OK);
......
......@@ -773,6 +773,7 @@ Parser::Parser(ParseInfo* info)
set_allow_legacy_const(FLAG_legacy_const);
set_allow_harmony_do_expressions(FLAG_harmony_do_expressions);
set_allow_harmony_function_name(FLAG_harmony_function_name);
set_allow_harmony_function_sent(FLAG_harmony_function_sent);
for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
++feature) {
use_counts_[feature] = 0;
......@@ -4853,6 +4854,7 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser(
SET_ALLOW(strong_mode);
SET_ALLOW(harmony_do_expressions);
SET_ALLOW(harmony_function_name);
SET_ALLOW(harmony_function_sent);
#undef SET_ALLOW
}
PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction(
......
......@@ -1500,7 +1500,6 @@ i::Handle<i::String> FormatMessage(i::Vector<unsigned> data) {
return i::MessageTemplate::FormatMessage(isolate, message, arg_object);
}
enum ParserFlag {
kAllowLazy,
kAllowNatives,
......@@ -1511,10 +1510,10 @@ enum ParserFlag {
kAllowHarmonyDestructuringAssignment,
kAllowHarmonyNewTarget,
kAllowStrongMode,
kNoLegacyConst
kNoLegacyConst,
kAllowHarmonyFunctionSent
};
enum ParserSyncTestResult {
kSuccessOrError,
kSuccess,
......@@ -1536,6 +1535,8 @@ void SetParserFlags(i::ParserBase<Traits>* parser,
flags.Contains(kAllowHarmonyDestructuringAssignment));
parser->set_allow_strong_mode(flags.Contains(kAllowStrongMode));
parser->set_allow_legacy_const(!flags.Contains(kNoLegacyConst));
parser->set_allow_harmony_function_sent(
flags.Contains(kAllowHarmonyFunctionSent));
}
......@@ -8022,10 +8023,9 @@ TEST(FunctionSentErrors) {
};
// clang-format on
bool old_flag = i::FLAG_harmony_function_sent;
i::FLAG_harmony_function_sent = true;
RunParserSyncTest(context_data, error_data, kError);
i::FLAG_harmony_function_sent = old_flag;
static const ParserFlag always_flags[] = {kAllowHarmonyFunctionSent};
RunParserSyncTest(context_data, error_data, kError, always_flags,
arraysize(always_flags));
}
TEST(NewTargetErrors) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment