Commit 848b6278 authored by nikolaos's avatar nikolaos Committed by Commit bot

[parser] Reorder traits methods

This patch simply reorders the elements of classes ParserTraits
and PreParserTraits (mainly method headers), so that in both
classes the elements are defined in the same order.  This is
useful for easily verifying the consistency between these two
classes.

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

Review-Url: https://codereview.chromium.org/2264483003
Cr-Commit-Position: refs/heads/master@{#38766}
parent 13bd98cf
...@@ -407,15 +407,15 @@ class ParserTraits { ...@@ -407,15 +407,15 @@ class ParserTraits {
static bool IsIdentifier(Expression* expression); static bool IsIdentifier(Expression* expression);
bool IsPrototype(const AstRawString* identifier) const;
bool IsConstructor(const AstRawString* identifier) const;
static const AstRawString* AsIdentifier(Expression* expression) { static const AstRawString* AsIdentifier(Expression* expression) {
DCHECK(IsIdentifier(expression)); DCHECK(IsIdentifier(expression));
return expression->AsVariableProxy()->raw_name(); return expression->AsVariableProxy()->raw_name();
} }
bool IsPrototype(const AstRawString* identifier) const;
bool IsConstructor(const AstRawString* identifier) const;
bool IsDirectEvalCall(Expression* expression) { bool IsDirectEvalCall(Expression* expression) {
if (!expression->IsCall()) return false; if (!expression->IsCall()) return false;
expression = expression->AsCall()->expression(); expression = expression->AsCall()->expression();
......
...@@ -606,8 +606,8 @@ class PreParserTraits { ...@@ -606,8 +606,8 @@ class PreParserTraits {
typedef PreParserExpression YieldExpression; typedef PreParserExpression YieldExpression;
typedef PreParserExpression FunctionLiteral; typedef PreParserExpression FunctionLiteral;
typedef PreParserExpression ClassLiteral; typedef PreParserExpression ClassLiteral;
typedef PreParserExpression ObjectLiteralProperty;
typedef PreParserExpression Literal; typedef PreParserExpression Literal;
typedef PreParserExpression ObjectLiteralProperty;
typedef PreParserExpressionList ExpressionList; typedef PreParserExpressionList ExpressionList;
typedef PreParserExpressionList PropertyList; typedef PreParserExpressionList PropertyList;
typedef PreParserIdentifier FormalParameter; typedef PreParserIdentifier FormalParameter;
...@@ -629,10 +629,6 @@ class PreParserTraits { ...@@ -629,10 +629,6 @@ class PreParserTraits {
return identifier.IsArguments(); return identifier.IsArguments();
} }
bool IsAwait(PreParserIdentifier identifier) const {
return identifier.IsAwait();
}
bool IsEvalOrArguments(PreParserIdentifier identifier) const { bool IsEvalOrArguments(PreParserIdentifier identifier) const {
return identifier.IsEvalOrArguments(); return identifier.IsEvalOrArguments();
} }
...@@ -641,12 +637,12 @@ class PreParserTraits { ...@@ -641,12 +637,12 @@ class PreParserTraits {
return identifier.IsUndefined(); return identifier.IsUndefined();
} }
bool IsPrototype(PreParserIdentifier identifier) const { bool IsAwait(PreParserIdentifier identifier) const {
return identifier.IsPrototype(); return identifier.IsAwait();
} }
bool IsConstructor(PreParserIdentifier identifier) const { bool IsFutureStrictReserved(PreParserIdentifier identifier) const {
return identifier.IsConstructor(); return identifier.IsFutureStrictReserved();
} }
// Returns true if the expression is of type "this.foo". // Returns true if the expression is of type "this.foo".
...@@ -662,12 +658,16 @@ class PreParserTraits { ...@@ -662,12 +658,16 @@ class PreParserTraits {
return expression.AsIdentifier(); return expression.AsIdentifier();
} }
bool IsDirectEvalCall(PreParserExpression expression) const { bool IsPrototype(PreParserIdentifier identifier) const {
return expression.IsDirectEvalCall(); return identifier.IsPrototype();
} }
bool IsFutureStrictReserved(PreParserIdentifier identifier) const { bool IsConstructor(PreParserIdentifier identifier) const {
return identifier.IsFutureStrictReserved(); return identifier.IsConstructor();
}
bool IsDirectEvalCall(PreParserExpression expression) const {
return expression.IsDirectEvalCall();
} }
static bool IsBoilerplateProperty(PreParserExpression property) { static bool IsBoilerplateProperty(PreParserExpression property) {
...@@ -761,9 +761,6 @@ class PreParserTraits { ...@@ -761,9 +761,6 @@ class PreParserTraits {
static PreParserIdentifier EmptyIdentifier() { static PreParserIdentifier EmptyIdentifier() {
return PreParserIdentifier::Default(); return PreParserIdentifier::Default();
} }
static PreParserIdentifier EmptyIdentifierString() {
return PreParserIdentifier::Default();
}
static PreParserExpression EmptyExpression() { static PreParserExpression EmptyExpression() {
return PreParserExpression::Default(); return PreParserExpression::Default();
} }
...@@ -776,9 +773,13 @@ class PreParserTraits { ...@@ -776,9 +773,13 @@ class PreParserTraits {
static PreParserExpression EmptyFunctionLiteral() { static PreParserExpression EmptyFunctionLiteral() {
return PreParserExpression::Default(); return PreParserExpression::Default();
} }
static PreParserExpressionList NullExpressionList() { static PreParserExpressionList NullExpressionList() {
return PreParserExpressionList(); return PreParserExpressionList();
} }
static PreParserIdentifier EmptyIdentifierString() {
return PreParserIdentifier::Default();
}
// Odd-ball literal creators. // Odd-ball literal creators.
PreParserExpression GetLiteralTheHole(int position, PreParserExpression GetLiteralTheHole(int position,
...@@ -788,11 +789,12 @@ class PreParserTraits { ...@@ -788,11 +789,12 @@ class PreParserTraits {
// Producing data during the recursive descent. // Producing data during the recursive descent.
PreParserIdentifier GetSymbol(Scanner* scanner); PreParserIdentifier GetSymbol(Scanner* scanner);
PreParserIdentifier GetNumberAsSymbol(Scanner* scanner) {
PreParserIdentifier GetNextSymbol(Scanner* scanner) const {
return PreParserIdentifier::Default(); return PreParserIdentifier::Default();
} }
PreParserIdentifier GetNextSymbol(Scanner* scanner) const { PreParserIdentifier GetNumberAsSymbol(Scanner* scanner) {
return PreParserIdentifier::Default(); return PreParserIdentifier::Default();
} }
...@@ -843,58 +845,22 @@ class PreParserTraits { ...@@ -843,58 +845,22 @@ class PreParserTraits {
return PreParserExpressionList(); return PreParserExpressionList();
} }
PreParserStatementList NewStatementList(int size, Zone* zone) const {
return PreParserStatementList();
}
PreParserExpressionList NewPropertyList(int size, Zone* zone) const { PreParserExpressionList NewPropertyList(int size, Zone* zone) const {
return PreParserExpressionList(); return PreParserExpressionList();
} }
PreParserStatementList NewStatementList(int size, Zone* zone) const {
return PreParserStatementList();
}
void AddParameterInitializationBlock( void AddParameterInitializationBlock(
const PreParserFormalParameters& parameters, PreParserStatementList list, const PreParserFormalParameters& parameters, PreParserStatementList list,
bool is_async, bool* ok) const {} bool is_async, bool* ok) const {}
V8_INLINE void SkipLazyFunctionBody(
int* materialized_literal_count, int* expected_property_count, bool* ok,
Scanner::BookmarkScope* bookmark = nullptr) {
UNREACHABLE();
}
V8_INLINE PreParserStatementList ParseEagerFunctionBody(
PreParserIdentifier name, int pos,
const PreParserFormalParameters& parameters, FunctionKind kind,
FunctionLiteral::FunctionType function_type, bool* ok);
V8_INLINE void ParseArrowFunctionFormalParameterList(
PreParserFormalParameters* parameters, PreParserExpression expression,
const Scanner::Location& params_loc, Scanner::Location* duplicate_loc,
const Scope::Snapshot& scope_snapshot, bool* ok);
void ParseAsyncArrowSingleExpressionBody( void ParseAsyncArrowSingleExpressionBody(
PreParserStatementList body, bool accept_IN, PreParserStatementList body, bool accept_IN,
Type::ExpressionClassifier* classifier, int pos, bool* ok); Type::ExpressionClassifier* classifier, int pos, bool* ok);
V8_INLINE PreParserExpression ParseAsyncFunctionExpression(bool* ok);
void ReindexLiterals(const PreParserFormalParameters& parameters) {}
struct TemplateLiteralState {};
TemplateLiteralState OpenTemplateLiteral(int pos) {
return TemplateLiteralState();
}
void AddTemplateSpan(TemplateLiteralState* state, bool tail) {}
void AddTemplateExpression(TemplateLiteralState* state,
PreParserExpression expression) {}
V8_INLINE PreParserExpression CloseTemplateLiteral(
TemplateLiteralState* state, int start, PreParserExpression tag);
PreParserExpression NoTemplateTag() {
return PreParserExpression::NoTemplateTag();
}
static bool IsTaggedTemplate(const PreParserExpression tag) {
return !tag.IsNoTemplateTag();
}
void AddFormalParameter(PreParserFormalParameters* parameters, void AddFormalParameter(PreParserFormalParameters* parameters,
PreParserExpression pattern, PreParserExpression pattern,
...@@ -902,6 +868,7 @@ class PreParserTraits { ...@@ -902,6 +868,7 @@ class PreParserTraits {
int initializer_end_position, bool is_rest) { int initializer_end_position, bool is_rest) {
++parameters->arity; ++parameters->arity;
} }
void DeclareFormalParameter(DeclarationScope* scope, void DeclareFormalParameter(DeclarationScope* scope,
PreParserIdentifier parameter, PreParserIdentifier parameter,
Type::ExpressionClassifier* classifier) { Type::ExpressionClassifier* classifier) {
...@@ -910,17 +877,36 @@ class PreParserTraits { ...@@ -910,17 +877,36 @@ class PreParserTraits {
} }
} }
void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {} V8_INLINE void ParseArrowFunctionFormalParameterList(
PreParserFormalParameters* parameters, PreParserExpression expression,
const Scanner::Location& params_loc, Scanner::Location* duplicate_loc,
const Scope::Snapshot& scope_snapshot, bool* ok);
V8_INLINE PreParserExpression ParseAsyncFunctionExpression(bool* ok);
V8_INLINE PreParserExpression ParseDoExpression(bool* ok);
void ReindexLiterals(const PreParserFormalParameters& parameters) {}
// Temporary glue; these functions will move to ParserBase. // Temporary glue; these functions will move to ParserBase.
PreParserExpression ParseV8Intrinsic(bool* ok); PreParserExpression ParseV8Intrinsic(bool* ok);
V8_INLINE PreParserExpression ParseDoExpression(bool* ok);
PreParserExpression ParseFunctionLiteral( PreParserExpression ParseFunctionLiteral(
PreParserIdentifier name, Scanner::Location function_name_location, PreParserIdentifier name, Scanner::Location function_name_location,
FunctionNameValidity function_name_validity, FunctionKind kind, FunctionNameValidity function_name_validity, FunctionKind kind,
int function_token_position, FunctionLiteral::FunctionType type, int function_token_position, FunctionLiteral::FunctionType type,
LanguageMode language_mode, bool* ok); LanguageMode language_mode, bool* ok);
V8_INLINE void SkipLazyFunctionBody(
int* materialized_literal_count, int* expected_property_count, bool* ok,
Scanner::BookmarkScope* bookmark = nullptr) {
UNREACHABLE();
}
V8_INLINE PreParserStatementList ParseEagerFunctionBody(
PreParserIdentifier name, int pos,
const PreParserFormalParameters& parameters, FunctionKind kind,
FunctionLiteral::FunctionType function_type, bool* ok);
PreParserExpression ParseClassLiteral(Type::ExpressionClassifier* classifier, PreParserExpression ParseClassLiteral(Type::ExpressionClassifier* classifier,
PreParserIdentifier name, PreParserIdentifier name,
Scanner::Location class_name_location, Scanner::Location class_name_location,
...@@ -930,7 +916,27 @@ class PreParserTraits { ...@@ -930,7 +916,27 @@ class PreParserTraits {
V8_INLINE void MarkCollectedTailCallExpressions() {} V8_INLINE void MarkCollectedTailCallExpressions() {}
V8_INLINE void MarkTailPosition(PreParserExpression expression) {} V8_INLINE void MarkTailPosition(PreParserExpression expression) {}
PreParserExpressionList PrepareSpreadArguments(PreParserExpressionList list) { void CheckConflictingVarDeclarations(Scope* scope, bool* ok) {}
struct TemplateLiteralState {};
V8_INLINE TemplateLiteralState OpenTemplateLiteral(int pos) {
return TemplateLiteralState();
}
V8_INLINE void AddTemplateSpan(TemplateLiteralState* state, bool tail) {}
V8_INLINE void AddTemplateExpression(TemplateLiteralState* state,
PreParserExpression expression) {}
V8_INLINE PreParserExpression CloseTemplateLiteral(
TemplateLiteralState* state, int start, PreParserExpression tag);
V8_INLINE PreParserExpression NoTemplateTag() {
return PreParserExpression::NoTemplateTag();
}
V8_INLINE static bool IsTaggedTemplate(const PreParserExpression tag) {
return !tag.IsNoTemplateTag();
}
V8_INLINE PreParserExpressionList
PrepareSpreadArguments(PreParserExpressionList list) {
return list; return list;
} }
...@@ -959,6 +965,8 @@ class PreParserTraits { ...@@ -959,6 +965,8 @@ class PreParserTraits {
PreParserExpression left, PreParserExpression right, int pos) { PreParserExpression left, PreParserExpression right, int pos) {
return left; return left;
} }
inline PreParserExpression RewriteAwaitExpression(PreParserExpression value,
int pos);
inline void QueueDestructuringAssignmentForRewriting( inline void QueueDestructuringAssignmentForRewriting(
PreParserExpression assignment) {} PreParserExpression assignment) {}
...@@ -972,9 +980,6 @@ class PreParserTraits { ...@@ -972,9 +980,6 @@ class PreParserTraits {
inline void RewriteNonPattern(Type::ExpressionClassifier* classifier, inline void RewriteNonPattern(Type::ExpressionClassifier* classifier,
bool* ok); bool* ok);
inline PreParserExpression RewriteAwaitExpression(PreParserExpression value,
int pos);
V8_INLINE ZoneList<typename Type::ExpressionClassifier::Error>* V8_INLINE ZoneList<typename Type::ExpressionClassifier::Error>*
GetReportedErrorList() const; GetReportedErrorList() const;
V8_INLINE Zone* zone() const; V8_INLINE Zone* zone() const;
......
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