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