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, int pos) { | 751 bool is_rest) { |
752 bool is_duplicate = false; | 752 bool is_duplicate = false; |
753 Variable* var = | 753 Variable* var = scope->DeclareParameter(name, VAR, is_rest, &is_duplicate); |
754 scope->DeclareParameter(name, VAR, is_rest, &is_duplicate, pos); | |
755 if (is_sloppy(scope->language_mode())) { | 754 if (is_sloppy(scope->language_mode())) { |
756 // TODO(sigurds) Mark every parameter as maybe assigned. This is a | 755 // TODO(sigurds) Mark every parameter as maybe assigned. This is a |
757 // conservative approximation necessary to account for parameters | 756 // conservative approximation necessary to account for parameters |
758 // that are assigned via the arguments array. | 757 // that are assigned via the arguments array. |
759 var->set_maybe_assigned(); | 758 var->set_maybe_assigned(); |
760 } | 759 } |
761 return is_duplicate; | 760 return is_duplicate; |
762 } | 761 } |
763 | 762 |
764 void DeclareArrowFunctionParameters(Scope* scope, Expression* expr, | 763 void DeclareArrowFunctionParameters(Scope* scope, Expression* expr, |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 | 1018 |
1020 Expression* pattern_; | 1019 Expression* pattern_; |
1021 int initializer_position_; | 1020 int initializer_position_; |
1022 Block* block_; | 1021 Block* block_; |
1023 const DeclarationDescriptor* descriptor_; | 1022 const DeclarationDescriptor* descriptor_; |
1024 ZoneList<const AstRawString*>* names_; | 1023 ZoneList<const AstRawString*>* names_; |
1025 Expression* current_value_; | 1024 Expression* current_value_; |
1026 bool* ok_; | 1025 bool* ok_; |
1027 }; | 1026 }; |
1028 | 1027 |
| 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 | |
1078 FunctionLiteral* ParseFunctionLiteral( | 1074 FunctionLiteral* ParseFunctionLiteral( |
1079 const AstRawString* name, Scanner::Location function_name_location, | 1075 const AstRawString* name, Scanner::Location function_name_location, |
1080 bool name_is_strict_reserved, FunctionKind kind, | 1076 bool name_is_strict_reserved, FunctionKind kind, |
1081 int function_token_position, FunctionLiteral::FunctionType type, | 1077 int function_token_position, FunctionLiteral::FunctionType type, |
1082 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); | 1078 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
1083 | 1079 |
1084 | 1080 |
1085 ClassLiteral* ParseClassLiteral(const AstRawString* name, | 1081 ClassLiteral* ParseClassLiteral(const AstRawString* name, |
1086 Scanner::Location class_name_location, | 1082 Scanner::Location class_name_location, |
1087 bool name_is_strict_reserved, int pos, | 1083 bool name_is_strict_reserved, int pos, |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 } | 1271 } |
1276 | 1272 |
1277 | 1273 |
1278 Expression* ParserTraits::SpreadCallNew( | 1274 Expression* ParserTraits::SpreadCallNew( |
1279 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { | 1275 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
1280 return parser_->SpreadCallNew(function, args, pos); | 1276 return parser_->SpreadCallNew(function, args, pos); |
1281 } | 1277 } |
1282 } } // namespace v8::internal | 1278 } } // namespace v8::internal |
1283 | 1279 |
1284 #endif // V8_PARSER_H_ | 1280 #endif // V8_PARSER_H_ |
OLD | NEW |