Index: src/parser.h |
diff --git a/src/parser.h b/src/parser.h |
index 346f75fa2b12d12255e66c766456a79c16a58b97..0924869a8429c26862c1bc1f0568a124cbe98682 100644 |
--- a/src/parser.h |
+++ b/src/parser.h |
@@ -385,9 +385,13 @@ class ParserTraits { |
// Used by FunctionState and BlockState. |
typedef v8::internal::Scope Scope; |
+ typedef v8::internal::Scope* ScopePtr; |
typedef Variable GeneratorVariable; |
typedef v8::internal::Zone Zone; |
+ typedef v8::internal::AstProperties AstProperties; |
+ typedef Vector<VariableProxy*> ParameterIdentifierVector; |
+ |
// Return types for traversing functions. |
typedef const AstRawString* Identifier; |
typedef v8::internal::Expression* Expression; |
@@ -422,6 +426,7 @@ class ParserTraits { |
// Helper functions for recursive descent. |
bool IsEvalOrArguments(const AstRawString* identifier) const; |
+ V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const; |
// Returns true if the expression is of type "this.foo". |
static bool IsThisProperty(Expression* expression); |
@@ -441,6 +446,8 @@ class ParserTraits { |
return string->AsArrayIndex(index); |
} |
+ bool IsValidArrowFunctionParameterList(Expression* expression); |
+ |
// Functions for encapsulating the differences between parsing and preparsing; |
// operations interleaved with the recursive descent. |
static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { |
@@ -535,9 +542,13 @@ class ParserTraits { |
static Expression* EmptyExpression() { |
return NULL; |
} |
+ static Expression* EmptyArrowParamList() { |
+ return NULL; |
+ } |
static Literal* EmptyLiteral() { |
return NULL; |
} |
+ |
// Used in error return values. |
static ZoneList<Expression*>* NullExpressionList() { |
return NULL; |
@@ -571,6 +582,11 @@ class ParserTraits { |
ZoneList<v8::internal::Statement*>* NewStatementList(int size, Zone* zone) { |
return new(zone) ZoneList<v8::internal::Statement*>(size, zone); |
} |
+ V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type); |
+ |
+ // Utility functions |
+ Vector<VariableProxy*> ParameterListFromExpression(Expression* expression); |
+ V8_INLINE AstValueFactory* ast_value_factory(); |
// Temporary glue; these functions will move to ParserBase. |
Expression* ParseV8Intrinsic(bool* ok); |
@@ -583,6 +599,21 @@ class ParserTraits { |
FunctionLiteral::FunctionType type, |
FunctionLiteral::ArityRestriction arity_restriction, |
bool* ok); |
+ V8_INLINE void SkipLazyFunctionBody( |
+ const AstRawString* name, |
+ int* materialized_literal_count, |
+ int* expected_property_count, |
+ bool* ok); |
+ V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
+ const AstRawString* name, |
+ int pos, |
+ Variable* fvar, |
+ Token::Value fvar_init_op, |
+ bool is_generator, |
+ bool* ok); |
+ V8_INLINE void CheckConflictingVarDeclarations( |
+ v8::internal::Scope* scope, |
+ bool* ok); |
private: |
Parser* parser_; |
@@ -825,6 +856,50 @@ class Parser : public ParserBase<ParserTraits> { |
}; |
+bool ParserTraits::IsFutureStrictReserved( |
+ const AstRawString* identifier) const { |
+ return identifier->IsOneByteEqualTo("yield") || |
+ parser_->scanner()->IdentifierIsFutureStrictReserved(identifier); |
+} |
+ |
+ |
+Scope* ParserTraits::NewScope(Scope* parent_scope, ScopeType scope_type) { |
+ return parser_->NewScope(parent_scope, scope_type); |
+} |
+ |
+ |
+void ParserTraits::SkipLazyFunctionBody( |
+ const AstRawString* function_name, |
+ int* materialized_literal_count, |
+ int* expected_property_count, |
+ bool* ok) { |
+ return parser_->SkipLazyFunctionBody(function_name, |
+ materialized_literal_count, expected_property_count, ok); |
+} |
+ |
+ |
+ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( |
+ const AstRawString* name, |
+ int pos, |
+ Variable* fvar, |
+ Token::Value fvar_init_op, |
+ bool is_generator, |
+ bool* ok) { |
+ return parser_->ParseEagerFunctionBody(name, pos, |
+ fvar, fvar_init_op, is_generator, ok); |
+} |
+ |
+void ParserTraits::CheckConflictingVarDeclarations( |
+ v8::internal::Scope* scope, bool* ok) { |
+ parser_->CheckConflictingVarDeclarations(scope, ok); |
+} |
+ |
+ |
+AstValueFactory* ParserTraits::ast_value_factory() { |
+ return parser_->ast_value_factory_; |
+} |
+ |
+ |
// Support for handling complex values (array and object literals) that |
// can be fully handled at compile time. |
class CompileTimeValue: public AllStatic { |