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