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