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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) { | 741 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) { |
742 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); | 742 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); |
743 } | 743 } |
744 ZoneList<v8::internal::Statement*>* NewStatementList(int size, Zone* zone) { | 744 ZoneList<v8::internal::Statement*>* NewStatementList(int size, Zone* zone) { |
745 return new(zone) ZoneList<v8::internal::Statement*>(size, zone); | 745 return new(zone) ZoneList<v8::internal::Statement*>(size, zone); |
746 } | 746 } |
747 V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type, | 747 V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type, |
748 FunctionKind kind = kNormalFunction); | 748 FunctionKind kind = kNormalFunction); |
749 | 749 |
750 bool DeclareFormalParameter(Scope* scope, const AstRawString* name, | 750 bool DeclareFormalParameter(Scope* scope, const AstRawString* name, |
751 bool is_rest) { | 751 bool is_rest, int pos) { |
752 bool is_duplicate = false; | 752 bool is_duplicate = false; |
753 Variable* var = scope->DeclareParameter(name, VAR, is_rest, &is_duplicate); | 753 Variable* var = |
| 754 scope->DeclareParameter(name, VAR, is_rest, &is_duplicate, pos); |
754 if (is_sloppy(scope->language_mode())) { | 755 if (is_sloppy(scope->language_mode())) { |
755 // TODO(sigurds) Mark every parameter as maybe assigned. This is a | 756 // TODO(sigurds) Mark every parameter as maybe assigned. This is a |
756 // conservative approximation necessary to account for parameters | 757 // conservative approximation necessary to account for parameters |
757 // that are assigned via the arguments array. | 758 // that are assigned via the arguments array. |
758 var->set_maybe_assigned(); | 759 var->set_maybe_assigned(); |
759 } | 760 } |
760 return is_duplicate; | 761 return is_duplicate; |
761 } | 762 } |
762 | 763 |
763 void DeclareArrowFunctionParameters(Scope* scope, Expression* expr, | 764 void DeclareArrowFunctionParameters(Scope* scope, Expression* expr, |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 | 1019 |
1019 Expression* pattern_; | 1020 Expression* pattern_; |
1020 int initializer_position_; | 1021 int initializer_position_; |
1021 Block* block_; | 1022 Block* block_; |
1022 const DeclarationDescriptor* descriptor_; | 1023 const DeclarationDescriptor* descriptor_; |
1023 ZoneList<const AstRawString*>* names_; | 1024 ZoneList<const AstRawString*>* names_; |
1024 Expression* current_value_; | 1025 Expression* current_value_; |
1025 bool* ok_; | 1026 bool* ok_; |
1026 }; | 1027 }; |
1027 | 1028 |
1028 | |
1029 void ParseVariableDeclarations(VariableDeclarationContext var_context, | 1029 void ParseVariableDeclarations(VariableDeclarationContext var_context, |
1030 DeclarationParsingResult* parsing_result, | 1030 DeclarationParsingResult* parsing_result, |
1031 bool* ok); | 1031 bool* ok); |
1032 Statement* ParseExpressionOrLabelledStatement( | 1032 Statement* ParseExpressionOrLabelledStatement( |
1033 ZoneList<const AstRawString*>* labels, bool* ok); | 1033 ZoneList<const AstRawString*>* labels, bool* ok); |
1034 IfStatement* ParseIfStatement(ZoneList<const AstRawString*>* labels, | 1034 IfStatement* ParseIfStatement(ZoneList<const AstRawString*>* labels, |
1035 bool* ok); | 1035 bool* ok); |
1036 Statement* ParseContinueStatement(bool* ok); | 1036 Statement* ParseContinueStatement(bool* ok); |
1037 Statement* ParseBreakStatement(ZoneList<const AstRawString*>* labels, | 1037 Statement* ParseBreakStatement(ZoneList<const AstRawString*>* labels, |
1038 bool* ok); | 1038 bool* ok); |
(...skipping 25 matching lines...) Expand all Loading... |
1064 // Initialize the components of a for-in / for-of statement. | 1064 // Initialize the components of a for-in / for-of statement. |
1065 void InitializeForEachStatement(ForEachStatement* stmt, | 1065 void InitializeForEachStatement(ForEachStatement* stmt, |
1066 Expression* each, | 1066 Expression* each, |
1067 Expression* subject, | 1067 Expression* subject, |
1068 Statement* body); | 1068 Statement* body); |
1069 Statement* DesugarLexicalBindingsInForStatement( | 1069 Statement* DesugarLexicalBindingsInForStatement( |
1070 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, | 1070 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, |
1071 ForStatement* loop, Statement* init, Expression* cond, Statement* next, | 1071 ForStatement* loop, Statement* init, Expression* cond, Statement* next, |
1072 Statement* body, bool* ok); | 1072 Statement* body, bool* ok); |
1073 | 1073 |
| 1074 ZoneList<Statement*>* DesugarInitializeParameters( |
| 1075 Scope* scope, bool has_parameter_expressions, |
| 1076 ZoneList<Expression*>* initializers); |
| 1077 |
1074 FunctionLiteral* ParseFunctionLiteral( | 1078 FunctionLiteral* ParseFunctionLiteral( |
1075 const AstRawString* name, Scanner::Location function_name_location, | 1079 const AstRawString* name, Scanner::Location function_name_location, |
1076 bool name_is_strict_reserved, FunctionKind kind, | 1080 bool name_is_strict_reserved, FunctionKind kind, |
1077 int function_token_position, FunctionLiteral::FunctionType type, | 1081 int function_token_position, FunctionLiteral::FunctionType type, |
1078 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 1082 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
1079 | 1083 |
1080 | 1084 |
1081 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 1085 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
1082 Scanner::Location class_name_location, | 1086 Scanner::Location class_name_location, |
1083 bool name_is_strict_reserved, int pos, | 1087 bool name_is_strict_reserved, int pos, |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 } | 1275 } |
1272 | 1276 |
1273 | 1277 |
1274 Expression* ParserTraits::SpreadCallNew( | 1278 Expression* ParserTraits::SpreadCallNew( |
1275 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { | 1279 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
1276 return parser_->SpreadCallNew(function, args, pos); | 1280 return parser_->SpreadCallNew(function, args, pos); |
1277 } | 1281 } |
1278 } } // namespace v8::internal | 1282 } } // namespace v8::internal |
1279 | 1283 |
1280 #endif // V8_PARSER_H_ | 1284 #endif // V8_PARSER_H_ |
OLD | NEW |