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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 pattern->Accept(this); | 1006 pattern->Accept(this); |
1007 current_value_ = old_value; | 1007 current_value_ = old_value; |
1008 } | 1008 } |
1009 | 1009 |
1010 AstNodeFactory* factory() const { return descriptor_->parser->factory(); } | 1010 AstNodeFactory* factory() const { return descriptor_->parser->factory(); } |
1011 AstValueFactory* ast_value_factory() const { | 1011 AstValueFactory* ast_value_factory() const { |
1012 return descriptor_->parser->ast_value_factory(); | 1012 return descriptor_->parser->ast_value_factory(); |
1013 } | 1013 } |
1014 bool inside_with() const { return descriptor_->parser->inside_with(); } | 1014 bool inside_with() const { return descriptor_->parser->inside_with(); } |
1015 Zone* zone() const { return descriptor_->parser->zone(); } | 1015 Zone* zone() const { return descriptor_->parser->zone(); } |
| 1016 Scope* TemporaryDeclarationScope() const { |
| 1017 return descriptor_->parser->scope_->DeclarationScope(); |
| 1018 } |
1016 | 1019 |
1017 Expression* pattern_; | 1020 Expression* pattern_; |
1018 int initializer_position_; | 1021 int initializer_position_; |
1019 Block* block_; | 1022 Block* block_; |
1020 const DeclarationDescriptor* descriptor_; | 1023 const DeclarationDescriptor* descriptor_; |
1021 ZoneList<const AstRawString*>* names_; | 1024 ZoneList<const AstRawString*>* names_; |
1022 Expression* current_value_; | 1025 Expression* current_value_; |
1023 bool* ok_; | 1026 bool* ok_; |
1024 }; | 1027 }; |
1025 | 1028 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 | 1097 |
1095 // Parser support | 1098 // Parser support |
1096 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode); | 1099 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode); |
1097 Variable* Declare(Declaration* declaration, bool resolve, bool* ok); | 1100 Variable* Declare(Declaration* declaration, bool resolve, bool* ok); |
1098 | 1101 |
1099 bool TargetStackContainsLabel(const AstRawString* label); | 1102 bool TargetStackContainsLabel(const AstRawString* label); |
1100 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); | 1103 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); |
1101 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); | 1104 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); |
1102 | 1105 |
1103 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); | 1106 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); |
| 1107 Statement* BuildAssertIsCoercible(Variable* var); |
1104 | 1108 |
1105 // Factory methods. | 1109 // Factory methods. |
1106 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, | 1110 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, |
1107 int end_pos); | 1111 int end_pos); |
1108 | 1112 |
1109 // Skip over a lazy function, either using cached data if we have it, or | 1113 // Skip over a lazy function, either using cached data if we have it, or |
1110 // by parsing the function with PreParser. Consumes the ending }. | 1114 // by parsing the function with PreParser. Consumes the ending }. |
1111 // | 1115 // |
1112 // If bookmark is set, the (pre-)parser may decide to abort skipping | 1116 // If bookmark is set, the (pre-)parser may decide to abort skipping |
1113 // in order to force the function to be eagerly parsed, after all. | 1117 // in order to force the function to be eagerly parsed, after all. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 } | 1266 } |
1263 | 1267 |
1264 | 1268 |
1265 Expression* ParserTraits::SpreadCallNew( | 1269 Expression* ParserTraits::SpreadCallNew( |
1266 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { | 1270 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
1267 return parser_->SpreadCallNew(function, args, pos); | 1271 return parser_->SpreadCallNew(function, args, pos); |
1268 } | 1272 } |
1269 } } // namespace v8::internal | 1273 } } // namespace v8::internal |
1270 | 1274 |
1271 #endif // V8_PARSER_H_ | 1275 #endif // V8_PARSER_H_ |
OLD | NEW |