| 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_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
| 6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/ast.h" | 9 #include "src/ast.h" |
| 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency | 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 const AstRawString* name, Scanner::Location function_name_location, | 795 const AstRawString* name, Scanner::Location function_name_location, |
| 796 FunctionNameValidity function_name_validity, FunctionKind kind, | 796 FunctionNameValidity function_name_validity, FunctionKind kind, |
| 797 int function_token_position, FunctionLiteral::FunctionType type, | 797 int function_token_position, FunctionLiteral::FunctionType type, |
| 798 FunctionLiteral::ArityRestriction arity_restriction, | 798 FunctionLiteral::ArityRestriction arity_restriction, |
| 799 LanguageMode language_mode, bool* ok); | 799 LanguageMode language_mode, bool* ok); |
| 800 V8_INLINE void SkipLazyFunctionBody( | 800 V8_INLINE void SkipLazyFunctionBody( |
| 801 int* materialized_literal_count, int* expected_property_count, bool* ok, | 801 int* materialized_literal_count, int* expected_property_count, bool* ok, |
| 802 Scanner::BookmarkScope* bookmark = nullptr); | 802 Scanner::BookmarkScope* bookmark = nullptr); |
| 803 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( | 803 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
| 804 const AstRawString* name, int pos, | 804 const AstRawString* name, int pos, |
| 805 const ParserFormalParameters& parameters, | 805 const ParserFormalParameters& parameters, FunctionKind kind, |
| 806 Variable* fvar, Token::Value fvar_init_op, FunctionKind kind, bool* ok); | 806 FunctionLiteral::FunctionType function_type, bool* ok); |
| 807 | 807 |
| 808 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 808 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
| 809 Scanner::Location class_name_location, | 809 Scanner::Location class_name_location, |
| 810 bool name_is_strict_reserved, int pos, | 810 bool name_is_strict_reserved, int pos, |
| 811 bool* ok); | 811 bool* ok); |
| 812 | 812 |
| 813 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope, | 813 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope, |
| 814 bool* ok); | 814 bool* ok); |
| 815 | 815 |
| 816 class TemplateLiteral : public ZoneObject { | 816 class TemplateLiteral : public ZoneObject { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 | 1153 |
| 1154 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 1154 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
| 1155 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); | 1155 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); |
| 1156 | 1156 |
| 1157 Block* BuildParameterInitializationBlock( | 1157 Block* BuildParameterInitializationBlock( |
| 1158 const ParserFormalParameters& parameters, bool* ok); | 1158 const ParserFormalParameters& parameters, bool* ok); |
| 1159 | 1159 |
| 1160 // Consumes the ending }. | 1160 // Consumes the ending }. |
| 1161 ZoneList<Statement*>* ParseEagerFunctionBody( | 1161 ZoneList<Statement*>* ParseEagerFunctionBody( |
| 1162 const AstRawString* function_name, int pos, | 1162 const AstRawString* function_name, int pos, |
| 1163 const ParserFormalParameters& parameters, | 1163 const ParserFormalParameters& parameters, FunctionKind kind, |
| 1164 Variable* fvar, Token::Value fvar_init_op, FunctionKind kind, bool* ok); | 1164 FunctionLiteral::FunctionType function_type, bool* ok); |
| 1165 | 1165 |
| 1166 void ThrowPendingError(Isolate* isolate, Handle<Script> script); | 1166 void ThrowPendingError(Isolate* isolate, Handle<Script> script); |
| 1167 | 1167 |
| 1168 TemplateLiteralState OpenTemplateLiteral(int pos); | 1168 TemplateLiteralState OpenTemplateLiteral(int pos); |
| 1169 void AddTemplateSpan(TemplateLiteralState* state, bool tail); | 1169 void AddTemplateSpan(TemplateLiteralState* state, bool tail); |
| 1170 void AddTemplateExpression(TemplateLiteralState* state, | 1170 void AddTemplateExpression(TemplateLiteralState* state, |
| 1171 Expression* expression); | 1171 Expression* expression); |
| 1172 Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start, | 1172 Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start, |
| 1173 Expression* tag); | 1173 Expression* tag); |
| 1174 uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit); | 1174 uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 | 1218 |
| 1219 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count, | 1219 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count, |
| 1220 int* expected_property_count, bool* ok, | 1220 int* expected_property_count, bool* ok, |
| 1221 Scanner::BookmarkScope* bookmark) { | 1221 Scanner::BookmarkScope* bookmark) { |
| 1222 return parser_->SkipLazyFunctionBody(materialized_literal_count, | 1222 return parser_->SkipLazyFunctionBody(materialized_literal_count, |
| 1223 expected_property_count, ok, bookmark); | 1223 expected_property_count, ok, bookmark); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 | 1226 |
| 1227 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( | 1227 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( |
| 1228 const AstRawString* name, int pos, | 1228 const AstRawString* name, int pos, const ParserFormalParameters& parameters, |
| 1229 const ParserFormalParameters& parameters, Variable* fvar, | 1229 FunctionKind kind, FunctionLiteral::FunctionType function_type, bool* ok) { |
| 1230 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { | 1230 return parser_->ParseEagerFunctionBody(name, pos, parameters, kind, |
| 1231 return parser_->ParseEagerFunctionBody(name, pos, parameters, fvar, | 1231 function_type, ok); |
| 1232 fvar_init_op, kind, ok); | |
| 1233 } | 1232 } |
| 1234 | 1233 |
| 1235 void ParserTraits::CheckConflictingVarDeclarations(v8::internal::Scope* scope, | 1234 void ParserTraits::CheckConflictingVarDeclarations(v8::internal::Scope* scope, |
| 1236 bool* ok) { | 1235 bool* ok) { |
| 1237 parser_->CheckConflictingVarDeclarations(scope, ok); | 1236 parser_->CheckConflictingVarDeclarations(scope, ok); |
| 1238 } | 1237 } |
| 1239 | 1238 |
| 1240 | 1239 |
| 1241 // Support for handling complex values (array and object literals) that | 1240 // Support for handling complex values (array and object literals) that |
| 1242 // can be fully handled at compile time. | 1241 // can be fully handled at compile time. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 parser_->BuildParameterInitializationBlock(parameters, ok); | 1341 parser_->BuildParameterInitializationBlock(parameters, ok); |
| 1343 if (!*ok) return; | 1342 if (!*ok) return; |
| 1344 if (init_block != nullptr) { | 1343 if (init_block != nullptr) { |
| 1345 body->Add(init_block, parser_->zone()); | 1344 body->Add(init_block, parser_->zone()); |
| 1346 } | 1345 } |
| 1347 } | 1346 } |
| 1348 } | 1347 } |
| 1349 } } // namespace v8::internal | 1348 } } // namespace v8::internal |
| 1350 | 1349 |
| 1351 #endif // V8_PARSER_H_ | 1350 #endif // V8_PARSER_H_ |
| OLD | NEW |