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/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 }; | 1040 }; |
1041 | 1041 |
1042 class PatternRewriter : private AstVisitor { | 1042 class PatternRewriter : private AstVisitor { |
1043 public: | 1043 public: |
1044 static void DeclareAndInitializeVariables( | 1044 static void DeclareAndInitializeVariables( |
1045 Block* block, const DeclarationDescriptor* declaration_descriptor, | 1045 Block* block, const DeclarationDescriptor* declaration_descriptor, |
1046 const DeclarationParsingResult::Declaration* declaration, | 1046 const DeclarationParsingResult::Declaration* declaration, |
1047 ZoneList<const AstRawString*>* names, bool* ok); | 1047 ZoneList<const AstRawString*>* names, bool* ok); |
1048 | 1048 |
1049 static void RewriteDestructuringAssignment( | 1049 static void RewriteDestructuringAssignment( |
1050 Parser* parser, RewritableAssignmentExpression* expr, Scope* Scope, | 1050 Parser* parser, RewritableAssignmentExpression* expr, Scope* Scope); |
1051 bool* ok); | 1051 |
| 1052 static Expression* RewriteDestructuringAssignment(Parser* parser, |
| 1053 Assignment* assignment, |
| 1054 Scope* scope); |
1052 | 1055 |
1053 void set_initializer_position(int pos) { initializer_position_ = pos; } | 1056 void set_initializer_position(int pos) { initializer_position_ = pos; } |
1054 | 1057 |
1055 private: | 1058 private: |
1056 PatternRewriter() {} | 1059 PatternRewriter() {} |
1057 | 1060 |
1058 #define DECLARE_VISIT(type) void Visit##type(v8::internal::type* node) override; | 1061 #define DECLARE_VISIT(type) void Visit##type(v8::internal::type* node) override; |
1059 // Visiting functions for AST nodes make this an AstVisitor. | 1062 // Visiting functions for AST nodes make this an AstVisitor. |
1060 AST_NODE_LIST(DECLARE_VISIT) | 1063 AST_NODE_LIST(DECLARE_VISIT) |
1061 #undef DECLARE_VISIT | 1064 #undef DECLARE_VISIT |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 TryStatement* ParseTryStatement(bool* ok); | 1140 TryStatement* ParseTryStatement(bool* ok); |
1138 DebuggerStatement* ParseDebuggerStatement(bool* ok); | 1141 DebuggerStatement* ParseDebuggerStatement(bool* ok); |
1139 | 1142 |
1140 // !%_IsJSReceiver(result = iterator.next()) && | 1143 // !%_IsJSReceiver(result = iterator.next()) && |
1141 // %ThrowIteratorResultNotAnObject(result) | 1144 // %ThrowIteratorResultNotAnObject(result) |
1142 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result, | 1145 Expression* BuildIteratorNextResult(Expression* iterator, Variable* result, |
1143 int pos); | 1146 int pos); |
1144 | 1147 |
1145 | 1148 |
1146 // Initialize the components of a for-in / for-of statement. | 1149 // Initialize the components of a for-in / for-of statement. |
1147 void InitializeForEachStatement(ForEachStatement* stmt, | 1150 void InitializeForEachStatement(ForEachStatement* stmt, Expression* each, |
1148 Expression* each, | 1151 Expression* subject, Statement* body, |
1149 Expression* subject, | 1152 bool is_destructuring); |
1150 Statement* body); | |
1151 Statement* DesugarLexicalBindingsInForStatement( | 1153 Statement* DesugarLexicalBindingsInForStatement( |
1152 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, | 1154 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, |
1153 ForStatement* loop, Statement* init, Expression* cond, Statement* next, | 1155 ForStatement* loop, Statement* init, Expression* cond, Statement* next, |
1154 Statement* body, bool* ok); | 1156 Statement* body, bool* ok); |
1155 | 1157 |
1156 void RewriteDoExpression(Expression* expr, bool* ok); | 1158 void RewriteDoExpression(Expression* expr, bool* ok); |
1157 | 1159 |
1158 FunctionLiteral* ParseFunctionLiteral( | 1160 FunctionLiteral* ParseFunctionLiteral( |
1159 const AstRawString* name, Scanner::Location function_name_location, | 1161 const AstRawString* name, Scanner::Location function_name_location, |
1160 FunctionNameValidity function_name_validity, FunctionKind kind, | 1162 FunctionNameValidity function_name_validity, FunctionKind kind, |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 | 1445 |
1444 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1446 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
1445 return parser_->ParseDoExpression(ok); | 1447 return parser_->ParseDoExpression(ok); |
1446 } | 1448 } |
1447 | 1449 |
1448 | 1450 |
1449 } // namespace internal | 1451 } // namespace internal |
1450 } // namespace v8 | 1452 } // namespace v8 |
1451 | 1453 |
1452 #endif // V8_PARSING_PARSER_H_ | 1454 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |