| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PARSING_PARSER_H_ | 5 #ifndef V8_PARSING_PARSER_H_ |
| 6 #define V8_PARSING_PARSER_H_ | 6 #define V8_PARSING_PARSER_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 Statement* BuildAssertIsCoercible(Variable* var); | 528 Statement* BuildAssertIsCoercible(Variable* var); |
| 529 | 529 |
| 530 // Factory methods. | 530 // Factory methods. |
| 531 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, | 531 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, |
| 532 int pos, int end_pos); | 532 int pos, int end_pos); |
| 533 | 533 |
| 534 // Skip over a lazy function, either using cached data if we have it, or | 534 // Skip over a lazy function, either using cached data if we have it, or |
| 535 // by parsing the function with PreParser. Consumes the ending }. | 535 // by parsing the function with PreParser. Consumes the ending }. |
| 536 // If may_abort == true, the (pre-)parser may decide to abort skipping | 536 // If may_abort == true, the (pre-)parser may decide to abort skipping |
| 537 // in order to force the function to be eagerly parsed, after all. | 537 // in order to force the function to be eagerly parsed, after all. |
| 538 LazyParsingResult SkipFunction( | 538 LazyParsingResult SkipFunction(FunctionKind kind, |
| 539 FunctionKind kind, DeclarationScope* function_scope, int* num_parameters, | 539 DeclarationScope* function_scope, |
| 540 int* function_length, bool* has_duplicate_parameters, | 540 int* num_parameters, int* function_length, |
| 541 int* materialized_literal_count, int* expected_property_count, | 541 bool* has_duplicate_parameters, |
| 542 bool is_inner_function, bool may_abort, bool* ok); | 542 int* expected_property_count, |
| 543 bool is_inner_function, bool may_abort, |
| 544 bool* ok); |
| 543 | 545 |
| 544 Block* BuildParameterInitializationBlock( | 546 Block* BuildParameterInitializationBlock( |
| 545 const ParserFormalParameters& parameters, bool* ok); | 547 const ParserFormalParameters& parameters, bool* ok); |
| 546 Block* BuildRejectPromiseOnException(Block* block); | 548 Block* BuildRejectPromiseOnException(Block* block); |
| 547 | 549 |
| 548 ZoneList<Statement*>* ParseFunction( | 550 ZoneList<Statement*>* ParseFunction( |
| 549 const AstRawString* function_name, int pos, FunctionKind kind, | 551 const AstRawString* function_name, int pos, FunctionKind kind, |
| 550 FunctionLiteral::FunctionType function_type, | 552 FunctionLiteral::FunctionType function_type, |
| 551 DeclarationScope* function_scope, int* num_parameters, | 553 DeclarationScope* function_scope, int* num_parameters, |
| 552 int* function_length, bool* has_duplicate_parameters, | 554 int* function_length, bool* has_duplicate_parameters, |
| 553 int* materialized_literal_count, int* expected_property_count, bool* ok); | 555 int* expected_property_count, bool* ok); |
| 554 | 556 |
| 555 void ThrowPendingError(Isolate* isolate, Handle<Script> script); | 557 void ThrowPendingError(Isolate* isolate, Handle<Script> script); |
| 556 | 558 |
| 557 class TemplateLiteral : public ZoneObject { | 559 class TemplateLiteral : public ZoneObject { |
| 558 public: | 560 public: |
| 559 TemplateLiteral(Zone* zone, int pos) | 561 TemplateLiteral(Zone* zone, int pos) |
| 560 : cooked_(8, zone), raw_(8, zone), expressions_(8, zone), pos_(pos) {} | 562 : cooked_(8, zone), raw_(8, zone), expressions_(8, zone), pos_(pos) {} |
| 561 | 563 |
| 562 const ZoneList<Expression*>* cooked() const { return &cooked_; } | 564 const ZoneList<Expression*>* cooked() const { return &cooked_; } |
| 563 const ZoneList<Expression*>* raw() const { return &raw_; } | 565 const ZoneList<Expression*>* raw() const { return &raw_; } |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 Expression* params, | 1079 Expression* params, |
| 1078 const Scanner::Location& params_loc, | 1080 const Scanner::Location& params_loc, |
| 1079 Scanner::Location* duplicate_loc, | 1081 Scanner::Location* duplicate_loc, |
| 1080 bool* ok); | 1082 bool* ok); |
| 1081 | 1083 |
| 1082 V8_INLINE Expression* NoTemplateTag() { return NULL; } | 1084 V8_INLINE Expression* NoTemplateTag() { return NULL; } |
| 1083 V8_INLINE static bool IsTaggedTemplate(const Expression* tag) { | 1085 V8_INLINE static bool IsTaggedTemplate(const Expression* tag) { |
| 1084 return tag != NULL; | 1086 return tag != NULL; |
| 1085 } | 1087 } |
| 1086 | 1088 |
| 1087 V8_INLINE void MaterializeUnspreadArgumentsLiterals(int count) {} | |
| 1088 | |
| 1089 Expression* ExpressionListToExpression(ZoneList<Expression*>* args); | 1089 Expression* ExpressionListToExpression(ZoneList<Expression*>* args); |
| 1090 | 1090 |
| 1091 void AddAccessorPrefixToFunctionName(bool is_get, FunctionLiteral* function, | 1091 void AddAccessorPrefixToFunctionName(bool is_get, FunctionLiteral* function, |
| 1092 const AstRawString* name); | 1092 const AstRawString* name); |
| 1093 | 1093 |
| 1094 void SetFunctionNameFromPropertyName(ObjectLiteralProperty* property, | 1094 void SetFunctionNameFromPropertyName(ObjectLiteralProperty* property, |
| 1095 const AstRawString* name); | 1095 const AstRawString* name); |
| 1096 | 1096 |
| 1097 void SetFunctionNameFromIdentifierRef(Expression* value, | 1097 void SetFunctionNameFromIdentifierRef(Expression* value, |
| 1098 Expression* identifier); | 1098 Expression* identifier); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 | 1178 |
| 1179 private: | 1179 private: |
| 1180 ParserTarget** variable_; | 1180 ParserTarget** variable_; |
| 1181 ParserTarget* previous_; | 1181 ParserTarget* previous_; |
| 1182 }; | 1182 }; |
| 1183 | 1183 |
| 1184 } // namespace internal | 1184 } // namespace internal |
| 1185 } // namespace v8 | 1185 } // namespace v8 |
| 1186 | 1186 |
| 1187 #endif // V8_PARSING_PARSER_H_ | 1187 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |