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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 // Initialize the components of a for-in / for-of statement. | 1065 // Initialize the components of a for-in / for-of statement. |
1065 void InitializeForEachStatement(ForEachStatement* stmt, | 1066 void InitializeForEachStatement(ForEachStatement* stmt, |
1066 Expression* each, | 1067 Expression* each, |
1067 Expression* subject, | 1068 Expression* subject, |
1068 Statement* body); | 1069 Statement* body); |
1069 Statement* DesugarLexicalBindingsInForStatement( | 1070 Statement* DesugarLexicalBindingsInForStatement( |
1070 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, | 1071 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, |
1071 ForStatement* loop, Statement* init, Expression* cond, Statement* next, | 1072 ForStatement* loop, Statement* init, Expression* cond, Statement* next, |
1072 Statement* body, bool* ok); | 1073 Statement* body, bool* ok); |
1073 | 1074 |
| 1075 ZoneList<Statement*>* DesugarInitializeParameters( |
| 1076 Scope* scope, bool hasParameterExpressions, |
| 1077 ZoneList<Expression*>* initializers); |
| 1078 |
1074 FunctionLiteral* ParseFunctionLiteral( | 1079 FunctionLiteral* ParseFunctionLiteral( |
1075 const AstRawString* name, Scanner::Location function_name_location, | 1080 const AstRawString* name, Scanner::Location function_name_location, |
1076 bool name_is_strict_reserved, FunctionKind kind, | 1081 bool name_is_strict_reserved, FunctionKind kind, |
1077 int function_token_position, FunctionLiteral::FunctionType type, | 1082 int function_token_position, FunctionLiteral::FunctionType type, |
1078 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 1083 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
1079 | 1084 |
1080 | 1085 |
1081 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 1086 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
1082 Scanner::Location class_name_location, | 1087 Scanner::Location class_name_location, |
1083 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... |
1271 } | 1276 } |
1272 | 1277 |
1273 | 1278 |
1274 Expression* ParserTraits::SpreadCallNew( | 1279 Expression* ParserTraits::SpreadCallNew( |
1275 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { | 1280 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
1276 return parser_->SpreadCallNew(function, args, pos); | 1281 return parser_->SpreadCallNew(function, args, pos); |
1277 } | 1282 } |
1278 } } // namespace v8::internal | 1283 } } // namespace v8::internal |
1279 | 1284 |
1280 #endif // V8_PARSER_H_ | 1285 #endif // V8_PARSER_H_ |
OLD | NEW |