Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Unified Diff: src/parsing/parser-base.h

Issue 1712833002: Don't reflect ES2015 Function name inference in Function.prototype.toString (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index c51cdce51ae1e1dd69e9b98420ffefacb3316753..a3854d18c3f311b3a7a31e6b0f0cfa18e79c8b81 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -802,9 +802,10 @@ class ParserBase : public Traits {
ExpressionClassifier* classifier, bool* ok);
void ParseFormalParameterList(FormalParametersT* parameters,
ExpressionClassifier* classifier, bool* ok);
- void CheckArityRestrictions(
- int param_count, FunctionLiteral::ArityRestriction arity_restriction,
- bool has_rest, int formals_start_pos, int formals_end_pos, bool* ok);
+ void CheckArityRestrictions(int param_count,
+ FunctionLiteral::FunctionType function_type,
+ bool has_rest, int formals_start_pos,
+ int formals_end_pos, bool* ok);
bool IsNextLetKeyword();
@@ -1737,8 +1738,7 @@ ParserBase<Traits>::ParsePropertyDefinition(
value = this->ParseFunctionLiteral(
*name, scanner()->location(), kSkipFunctionNameCheck, kind,
- RelocInfo::kNoPosition, FunctionLiteral::kAnonymousExpression,
- FunctionLiteral::kNormalArity, language_mode(),
+ RelocInfo::kNoPosition, FunctionLiteral::kMethod, language_mode(),
CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
return factory()->NewObjectLiteralProperty(name_expression, value,
@@ -1779,8 +1779,7 @@ ParserBase<Traits>::ParsePropertyDefinition(
typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral(
*name, scanner()->location(), kSkipFunctionNameCheck,
FunctionKind::kAccessorFunction, RelocInfo::kNoPosition,
- FunctionLiteral::kAnonymousExpression,
- is_get ? FunctionLiteral::kGetterArity : FunctionLiteral::kSetterArity,
+ is_get ? FunctionLiteral::kGetter : FunctionLiteral::kSetter,
language_mode(), CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
// Make sure the name expression is a string since we need a Name for
@@ -2577,8 +2576,7 @@ ParserBase<Traits>::ParseMemberExpression(ExpressionClassifier* classifier,
: kFunctionNameValidityUnknown,
is_generator ? FunctionKind::kGeneratorFunction
: FunctionKind::kNormalFunction,
- function_token_position, function_type, FunctionLiteral::kNormalArity,
- language_mode(), CHECK_OK);
+ function_token_position, function_type, language_mode(), CHECK_OK);
} else if (peek() == Token::SUPER) {
const bool is_new = false;
result = ParseSuperExpression(is_new, classifier, CHECK_OK);
@@ -2970,20 +2968,19 @@ void ParserBase<Traits>::ParseFormalParameterList(
}
}
-
template <class Traits>
void ParserBase<Traits>::CheckArityRestrictions(
- int param_count, FunctionLiteral::ArityRestriction arity_restriction,
- bool has_rest, int formals_start_pos, int formals_end_pos, bool* ok) {
- switch (arity_restriction) {
- case FunctionLiteral::kGetterArity:
+ int param_count, FunctionLiteral::FunctionType function_type, bool has_rest,
+ int formals_start_pos, int formals_end_pos, bool* ok) {
+ switch (function_type) {
+ case FunctionLiteral::kGetter:
if (param_count != 0) {
ReportMessageAt(Scanner::Location(formals_start_pos, formals_end_pos),
MessageTemplate::kBadGetterArity);
*ok = false;
}
break;
- case FunctionLiteral::kSetterArity:
+ case FunctionLiteral::kSetter:
if (param_count != 1) {
ReportMessageAt(Scanner::Location(formals_start_pos, formals_end_pos),
MessageTemplate::kBadSetterArity);
« src/parsing/parser.cc ('K') | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698