Commit 30c71859 authored by marja's avatar marja Committed by Commit bot

Parser / PreParser: trivial unifications

(To minimize the diff of actually interesting unifications.)

R=rossberg@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#26620}
parent dff690ec
...@@ -361,7 +361,6 @@ class ParserTraits { ...@@ -361,7 +361,6 @@ class ParserTraits {
typedef Variable GeneratorVariable; typedef Variable GeneratorVariable;
typedef v8::internal::AstProperties AstProperties; typedef v8::internal::AstProperties AstProperties;
typedef Vector<VariableProxy*> ParameterIdentifierVector;
// Return types for traversing functions. // Return types for traversing functions.
typedef const AstRawString* Identifier; typedef const AstRawString* Identifier;
...@@ -668,18 +667,6 @@ class Parser : public ParserBase<ParserTraits> { ...@@ -668,18 +667,6 @@ class Parser : public ParserBase<ParserTraits> {
// https://codereview.chromium.org/7003030/ ). // https://codereview.chromium.org/7003030/ ).
static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1
enum VariableDeclarationContext {
kStatementListItem,
kStatement,
kForStatement
};
// If a list of variable declarations includes any initializers.
enum VariableDeclarationProperties {
kHasInitializers,
kHasNoInitializers
};
// Returns NULL if parsing failed. // Returns NULL if parsing failed.
FunctionLiteral* ParseProgram(CompilationInfo* info); FunctionLiteral* ParseProgram(CompilationInfo* info);
......
...@@ -180,11 +180,11 @@ PreParser::Statement PreParser::ParseStatementListItem(bool* ok) { ...@@ -180,11 +180,11 @@ PreParser::Statement PreParser::ParseStatementListItem(bool* ok) {
case Token::CLASS: case Token::CLASS:
return ParseClassDeclaration(ok); return ParseClassDeclaration(ok);
case Token::CONST: case Token::CONST:
return ParseVariableStatement(kSourceElement, ok); return ParseVariableStatement(kStatementListItem, ok);
case Token::LET: case Token::LET:
DCHECK(allow_harmony_scoping()); DCHECK(allow_harmony_scoping());
if (is_strict(language_mode())) { if (is_strict(language_mode())) {
return ParseVariableStatement(kSourceElement, ok); return ParseVariableStatement(kStatementListItem, ok);
} }
// Fall through. // Fall through.
default: default:
......
...@@ -170,6 +170,15 @@ class ParserBase : public Traits { ...@@ -170,6 +170,15 @@ class ParserBase : public Traits {
PARSE_EAGERLY PARSE_EAGERLY
}; };
enum VariableDeclarationContext {
kStatementListItem,
kStatement,
kForStatement
};
// If a list of variable declarations includes any initializers.
enum VariableDeclarationProperties { kHasInitializers, kHasNoInitializers };
class Checkpoint; class Checkpoint;
class ObjectLiteralCheckerBase; class ObjectLiteralCheckerBase;
...@@ -1191,7 +1200,6 @@ class PreParserTraits { ...@@ -1191,7 +1200,6 @@ class PreParserTraits {
typedef void GeneratorVariable; typedef void GeneratorVariable;
typedef int AstProperties; typedef int AstProperties;
typedef Vector<PreParserIdentifier> ParameterIdentifierVector;
// Return types for traversing functions. // Return types for traversing functions.
typedef PreParserIdentifier Identifier; typedef PreParserIdentifier Identifier;
...@@ -1552,18 +1560,6 @@ class PreParser : public ParserBase<PreParserTraits> { ...@@ -1552,18 +1560,6 @@ class PreParser : public ParserBase<PreParserTraits> {
// are either being counted in the preparser data, or is important // are either being counted in the preparser data, or is important
// to throw the correct syntax error exceptions. // to throw the correct syntax error exceptions.
enum VariableDeclarationContext {
kSourceElement,
kStatement,
kForStatement
};
// If a list of variable declarations includes any initializers.
enum VariableDeclarationProperties {
kHasInitializers,
kHasNoInitializers
};
// All ParseXXX functions take as the last argument an *ok parameter // All ParseXXX functions take as the last argument an *ok parameter
// which is set to false if parsing failed; it is unchanged otherwise. // which is set to false if parsing failed; it is unchanged otherwise.
// By making the 'exception handling' explicit, we are forced to check // By making the 'exception handling' explicit, we are forced to check
......
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