| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 bool* ok); | 279 bool* ok); |
| 280 void DeclareAndInitializeVariables( | 280 void DeclareAndInitializeVariables( |
| 281 Block* block, const DeclarationDescriptor* declaration_descriptor, | 281 Block* block, const DeclarationDescriptor* declaration_descriptor, |
| 282 const DeclarationParsingResult::Declaration* declaration, | 282 const DeclarationParsingResult::Declaration* declaration, |
| 283 ZoneList<const AstRawString*>* names, bool* ok); | 283 ZoneList<const AstRawString*>* names, bool* ok); |
| 284 ZoneList<const AstRawString*>* DeclareLabel( | 284 ZoneList<const AstRawString*>* DeclareLabel( |
| 285 ZoneList<const AstRawString*>* labels, Expression* expr, bool* ok); | 285 ZoneList<const AstRawString*>* labels, Expression* expr, bool* ok); |
| 286 bool ContainsLabel(ZoneList<const AstRawString*>* labels, | 286 bool ContainsLabel(ZoneList<const AstRawString*>* labels, |
| 287 const AstRawString* label); | 287 const AstRawString* label); |
| 288 Expression* RewriteReturn(Expression* return_value, int pos); | 288 Expression* RewriteReturn(Expression* return_value, int pos); |
| 289 Statement* RewriteSwitchStatement(Expression* tag, |
| 290 SwitchStatement* switch_statement, |
| 291 ZoneList<CaseClause*>* cases, Scope* scope); |
| 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: |
| 294 static void DeclareAndInitializeVariables( | 297 static void DeclareAndInitializeVariables( |
| 295 Parser* parser, Block* block, | 298 Parser* parser, Block* block, |
| 296 const DeclarationDescriptor* declaration_descriptor, | 299 const DeclarationDescriptor* declaration_descriptor, |
| 297 const DeclarationParsingResult::Declaration* declaration, | 300 const DeclarationParsingResult::Declaration* declaration, |
| 298 ZoneList<const AstRawString*>* names, bool* ok); | 301 ZoneList<const AstRawString*>* names, bool* ok); |
| (...skipping 64 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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 int size) const { | 922 int size) const { |
| 923 return new (zone()) ZoneList<ObjectLiteral::Property*>(size, zone()); | 923 return new (zone()) ZoneList<ObjectLiteral::Property*>(size, zone()); |
| 924 } | 924 } |
| 925 V8_INLINE ZoneList<ClassLiteral::Property*>* NewClassPropertyList( | 925 V8_INLINE ZoneList<ClassLiteral::Property*>* NewClassPropertyList( |
| 926 int size) const { | 926 int size) const { |
| 927 return new (zone()) ZoneList<ClassLiteral::Property*>(size, zone()); | 927 return new (zone()) ZoneList<ClassLiteral::Property*>(size, zone()); |
| 928 } | 928 } |
| 929 V8_INLINE ZoneList<Statement*>* NewStatementList(int size) const { | 929 V8_INLINE ZoneList<Statement*>* NewStatementList(int size) const { |
| 930 return new (zone()) ZoneList<Statement*>(size, zone()); | 930 return new (zone()) ZoneList<Statement*>(size, zone()); |
| 931 } | 931 } |
| 932 V8_INLINE ZoneList<CaseClause*>* NewCaseClauseList(int size) const { |
| 933 return new (zone()) ZoneList<CaseClause*>(size, zone()); |
| 934 } |
| 932 | 935 |
| 933 V8_INLINE Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity, | 936 V8_INLINE Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity, |
| 934 bool ignore_completion_value, int pos) { | 937 bool ignore_completion_value, int pos) { |
| 935 return factory()->NewBlock(labels, capacity, ignore_completion_value, pos); | 938 return factory()->NewBlock(labels, capacity, ignore_completion_value, pos); |
| 936 } | 939 } |
| 937 | 940 |
| 938 V8_INLINE Expression* NewV8Intrinsic(const AstRawString* name, | 941 V8_INLINE Expression* NewV8Intrinsic(const AstRawString* name, |
| 939 ZoneList<Expression*>* args, int pos, | 942 ZoneList<Expression*>* args, int pos, |
| 940 bool* ok); | 943 bool* ok); |
| 941 | 944 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 | 1063 |
| 1061 #ifdef DEBUG | 1064 #ifdef DEBUG |
| 1062 void Print(AstNode* node); | 1065 void Print(AstNode* node); |
| 1063 #endif // DEBUG | 1066 #endif // DEBUG |
| 1064 }; | 1067 }; |
| 1065 | 1068 |
| 1066 } // namespace internal | 1069 } // namespace internal |
| 1067 } // namespace v8 | 1070 } // namespace v8 |
| 1068 | 1071 |
| 1069 #endif // V8_PARSING_PARSER_H_ | 1072 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |