| 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/parsing/parser-base.h" | 10 #include "src/parsing/parser-base.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 typedef v8::internal::Expression* Expression; | 150 typedef v8::internal::Expression* Expression; |
| 151 typedef v8::internal::FunctionLiteral* FunctionLiteral; | 151 typedef v8::internal::FunctionLiteral* FunctionLiteral; |
| 152 typedef ObjectLiteral::Property* ObjectLiteralProperty; | 152 typedef ObjectLiteral::Property* ObjectLiteralProperty; |
| 153 typedef ClassLiteral::Property* ClassLiteralProperty; | 153 typedef ClassLiteral::Property* ClassLiteralProperty; |
| 154 typedef ZoneList<v8::internal::Expression*>* ExpressionList; | 154 typedef ZoneList<v8::internal::Expression*>* ExpressionList; |
| 155 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; | 155 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; |
| 156 typedef ParserFormalParameters FormalParameters; | 156 typedef ParserFormalParameters FormalParameters; |
| 157 typedef v8::internal::Statement* Statement; | 157 typedef v8::internal::Statement* Statement; |
| 158 typedef ZoneList<v8::internal::Statement*>* StatementList; | 158 typedef ZoneList<v8::internal::Statement*>* StatementList; |
| 159 typedef v8::internal::Block* Block; | 159 typedef v8::internal::Block* Block; |
| 160 typedef v8::internal::BreakableStatement* BreakableStatementT; | 160 typedef v8::internal::BreakableStatement* BreakableStatement; |
| 161 typedef v8::internal::IterationStatement* IterationStatementT; | 161 typedef v8::internal::IterationStatement* IterationStatement; |
| 162 | 162 |
| 163 // For constructing objects returned by the traversing functions. | 163 // For constructing objects returned by the traversing functions. |
| 164 typedef AstNodeFactory Factory; | 164 typedef AstNodeFactory Factory; |
| 165 | 165 |
| 166 typedef ParserTarget Target; | 166 typedef ParserTarget Target; |
| 167 typedef ParserTargetScope TargetScope; | 167 typedef ParserTargetScope TargetScope; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 class Parser : public ParserBase<Parser> { | 170 class Parser : public ParserBase<Parser> { |
| 171 public: | 171 public: |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 bool* ok); | 274 bool* ok); |
| 275 void DeclareAndInitializeVariables( | 275 void DeclareAndInitializeVariables( |
| 276 Block* block, const DeclarationDescriptor* declaration_descriptor, | 276 Block* block, const DeclarationDescriptor* declaration_descriptor, |
| 277 const DeclarationParsingResult::Declaration* declaration, | 277 const DeclarationParsingResult::Declaration* declaration, |
| 278 ZoneList<const AstRawString*>* names, bool* ok); | 278 ZoneList<const AstRawString*>* names, bool* ok); |
| 279 ZoneList<const AstRawString*>* DeclareLabel( | 279 ZoneList<const AstRawString*>* DeclareLabel( |
| 280 ZoneList<const AstRawString*>* labels, VariableProxy* expr, bool* ok); | 280 ZoneList<const AstRawString*>* labels, VariableProxy* expr, bool* ok); |
| 281 bool ContainsLabel(ZoneList<const AstRawString*>* labels, | 281 bool ContainsLabel(ZoneList<const AstRawString*>* labels, |
| 282 const AstRawString* label); | 282 const AstRawString* label); |
| 283 Expression* RewriteReturn(Expression* return_value, int pos); | 283 Expression* RewriteReturn(Expression* return_value, int pos); |
| 284 Statement* RewriteSwitchStatement(Expression* tag, |
| 285 SwitchStatement* switch_statement, |
| 286 ZoneList<CaseClause*>* cases, Scope* scope); |
| 284 | 287 |
| 285 Statement* DeclareFunction(const AstRawString* variable_name, | 288 Statement* DeclareFunction(const AstRawString* variable_name, |
| 286 FunctionLiteral* function, int pos, | 289 FunctionLiteral* function, int pos, |
| 287 bool is_generator, bool is_async, | 290 bool is_generator, bool is_async, |
| 288 ZoneList<const AstRawString*>* names, bool* ok); | 291 ZoneList<const AstRawString*>* names, bool* ok); |
| 289 | 292 |
| 290 Expression* ParseYieldStarExpression(bool* ok); | 293 Expression* ParseYieldStarExpression(bool* ok); |
| 291 | 294 |
| 292 class PatternRewriter final : public AstVisitor<PatternRewriter> { | 295 class PatternRewriter final : public AstVisitor<PatternRewriter> { |
| 293 public: | 296 public: |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 Block* block_; | 366 Block* block_; |
| 364 const DeclarationDescriptor* descriptor_; | 367 const DeclarationDescriptor* descriptor_; |
| 365 ZoneList<const AstRawString*>* names_; | 368 ZoneList<const AstRawString*>* names_; |
| 366 Expression* current_value_; | 369 Expression* current_value_; |
| 367 int recursion_level_; | 370 int recursion_level_; |
| 368 bool* ok_; | 371 bool* ok_; |
| 369 | 372 |
| 370 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() | 373 DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() |
| 371 }; | 374 }; |
| 372 | 375 |
| 373 CaseClause* ParseCaseClause(bool* default_seen_ptr, bool* ok); | |
| 374 Statement* ParseSwitchStatement(ZoneList<const AstRawString*>* labels, | |
| 375 bool* ok); | |
| 376 Statement* ParseForStatement(ZoneList<const AstRawString*>* labels, bool* ok); | 376 Statement* ParseForStatement(ZoneList<const AstRawString*>* labels, bool* ok); |
| 377 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); | 377 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); |
| 378 TryStatement* ParseTryStatement(bool* ok); | 378 TryStatement* ParseTryStatement(bool* ok); |
| 379 | 379 |
| 380 // !%_IsJSReceiver(result = iterator.next()) && | 380 // !%_IsJSReceiver(result = iterator.next()) && |
| 381 // %ThrowIteratorResultNotAnObject(result) | 381 // %ThrowIteratorResultNotAnObject(result) |
| 382 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result, | 382 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result, |
| 383 int pos); | 383 int pos); |
| 384 | 384 |
| 385 Expression* GetIterator(Expression* iterable, int pos); | 385 Expression* GetIterator(Expression* iterable, int pos); |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 int size) const { | 932 int size) const { |
| 933 return new (zone()) ZoneList<ObjectLiteral::Property*>(size, zone()); | 933 return new (zone()) ZoneList<ObjectLiteral::Property*>(size, zone()); |
| 934 } | 934 } |
| 935 V8_INLINE ZoneList<ClassLiteral::Property*>* NewClassPropertyList( | 935 V8_INLINE ZoneList<ClassLiteral::Property*>* NewClassPropertyList( |
| 936 int size) const { | 936 int size) const { |
| 937 return new (zone()) ZoneList<ClassLiteral::Property*>(size, zone()); | 937 return new (zone()) ZoneList<ClassLiteral::Property*>(size, zone()); |
| 938 } | 938 } |
| 939 V8_INLINE ZoneList<Statement*>* NewStatementList(int size) const { | 939 V8_INLINE ZoneList<Statement*>* NewStatementList(int size) const { |
| 940 return new (zone()) ZoneList<Statement*>(size, zone()); | 940 return new (zone()) ZoneList<Statement*>(size, zone()); |
| 941 } | 941 } |
| 942 V8_INLINE ZoneList<CaseClause*>* NewCaseClauseList(int size) const { |
| 943 return new (zone()) ZoneList<CaseClause*>(size, zone()); |
| 944 } |
| 942 | 945 |
| 943 V8_INLINE Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity, | 946 V8_INLINE Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity, |
| 944 bool ignore_completion_value, int pos) { | 947 bool ignore_completion_value, int pos) { |
| 945 return factory()->NewBlock(labels, capacity, ignore_completion_value, pos); | 948 return factory()->NewBlock(labels, capacity, ignore_completion_value, pos); |
| 946 } | 949 } |
| 947 | 950 |
| 948 V8_INLINE Expression* NewV8Intrinsic(const AstRawString* name, | 951 V8_INLINE Expression* NewV8Intrinsic(const AstRawString* name, |
| 949 ZoneList<Expression*>* args, int pos, | 952 ZoneList<Expression*>* args, int pos, |
| 950 bool* ok); | 953 bool* ok); |
| 951 | 954 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 | 1073 |
| 1071 #ifdef DEBUG | 1074 #ifdef DEBUG |
| 1072 void Print(AstNode* node); | 1075 void Print(AstNode* node); |
| 1073 #endif // DEBUG | 1076 #endif // DEBUG |
| 1074 }; | 1077 }; |
| 1075 | 1078 |
| 1076 } // namespace internal | 1079 } // namespace internal |
| 1077 } // namespace v8 | 1080 } // namespace v8 |
| 1078 | 1081 |
| 1079 #endif // V8_PARSING_PARSER_H_ | 1082 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |