| 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/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/parsing/parser-base.h" | 10 #include "src/parsing/parser-base.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 V8_INLINE const AstRawString* EmptyIdentifierString() const; | 295 V8_INLINE const AstRawString* EmptyIdentifierString() const; |
| 296 | 296 |
| 297 // Odd-ball literal creators. | 297 // Odd-ball literal creators. |
| 298 Literal* GetLiteralTheHole(int position, AstNodeFactory* factory) const; | 298 Literal* GetLiteralTheHole(int position, AstNodeFactory* factory) const; |
| 299 | 299 |
| 300 // Producing data during the recursive descent. | 300 // Producing data during the recursive descent. |
| 301 const AstRawString* GetSymbol(Scanner* scanner) const; | 301 const AstRawString* GetSymbol(Scanner* scanner) const; |
| 302 const AstRawString* GetNextSymbol(Scanner* scanner) const; | 302 const AstRawString* GetNextSymbol(Scanner* scanner) const; |
| 303 const AstRawString* GetNumberAsSymbol(Scanner* scanner) const; | 303 const AstRawString* GetNumberAsSymbol(Scanner* scanner) const; |
| 304 | 304 |
| 305 Expression* ThisExpression(int pos = kNoSourcePosition) const; | 305 Expression* ThisExpression(int pos = kNoSourcePosition); |
| 306 Expression* NewSuperPropertyReference(AstNodeFactory* factory, int pos) const; | 306 Expression* NewSuperPropertyReference(AstNodeFactory* factory, int pos); |
| 307 Expression* NewSuperCallReference(AstNodeFactory* factory, int pos) const; | 307 Expression* NewSuperCallReference(AstNodeFactory* factory, int pos); |
| 308 Expression* NewTargetExpression(int pos) const; | 308 Expression* NewTargetExpression(int pos); |
| 309 Expression* FunctionSentExpression(AstNodeFactory* factory, int pos) const; | 309 Expression* FunctionSentExpression(AstNodeFactory* factory, int pos) const; |
| 310 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, | 310 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, |
| 311 AstNodeFactory* factory) const; | 311 AstNodeFactory* factory) const; |
| 312 Expression* ExpressionFromIdentifier(const AstRawString* name, | 312 Expression* ExpressionFromIdentifier(const AstRawString* name, |
| 313 int start_position, int end_position, | 313 int start_position, int end_position, |
| 314 InferName = InferName::kYes) const; | 314 InferName = InferName::kYes); |
| 315 Expression* ExpressionFromString(int pos, Scanner* scanner, | 315 Expression* ExpressionFromString(int pos, Scanner* scanner, |
| 316 AstNodeFactory* factory) const; | 316 AstNodeFactory* factory) const; |
| 317 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory, | 317 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory, |
| 318 int pos); | 318 int pos); |
| 319 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, | 319 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, |
| 320 Zone* zone) const { | 320 Zone* zone) const { |
| 321 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); | 321 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); |
| 322 } | 322 } |
| 323 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, | 323 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, |
| 324 Zone* zone) const { | 324 Zone* zone) const { |
| 325 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); | 325 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); |
| 326 } | 326 } |
| 327 ZoneList<v8::internal::Statement*>* NewStatementList(int size, | 327 ZoneList<v8::internal::Statement*>* NewStatementList(int size, |
| 328 Zone* zone) const { | 328 Zone* zone) const { |
| 329 return new(zone) ZoneList<v8::internal::Statement*>(size, zone); | 329 return new(zone) ZoneList<v8::internal::Statement*>(size, zone); |
| 330 } | 330 } |
| 331 | 331 |
| 332 V8_INLINE void AddParameterInitializationBlock( | 332 V8_INLINE void AddParameterInitializationBlock( |
| 333 const ParserFormalParameters& parameters, | 333 const ParserFormalParameters& parameters, |
| 334 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) const; | 334 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok); |
| 335 | 335 |
| 336 void ParseAsyncArrowSingleExpressionBody( | 336 void ParseAsyncArrowSingleExpressionBody( |
| 337 ZoneList<Statement*>* body, bool accept_IN, | 337 ZoneList<Statement*>* body, bool accept_IN, |
| 338 Type::ExpressionClassifier* classifier, int pos, bool* ok); | 338 Type::ExpressionClassifier* classifier, int pos, bool* ok); |
| 339 | 339 |
| 340 V8_INLINE void AddFormalParameter(ParserFormalParameters* parameters, | 340 V8_INLINE void AddFormalParameter(ParserFormalParameters* parameters, |
| 341 Expression* pattern, | 341 Expression* pattern, |
| 342 Expression* initializer, | 342 Expression* initializer, |
| 343 int initializer_end_position, bool is_rest); | 343 int initializer_end_position, bool is_rest); |
| 344 V8_INLINE void DeclareFormalParameter( | 344 V8_INLINE void DeclareFormalParameter( |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 if (is_sloppy(scope->language_mode())) { | 1099 if (is_sloppy(scope->language_mode())) { |
| 1100 // TODO(sigurds) Mark every parameter as maybe assigned. This is a | 1100 // TODO(sigurds) Mark every parameter as maybe assigned. This is a |
| 1101 // conservative approximation necessary to account for parameters | 1101 // conservative approximation necessary to account for parameters |
| 1102 // that are assigned via the arguments array. | 1102 // that are assigned via the arguments array. |
| 1103 var->set_maybe_assigned(); | 1103 var->set_maybe_assigned(); |
| 1104 } | 1104 } |
| 1105 } | 1105 } |
| 1106 | 1106 |
| 1107 void ParserTraits::AddParameterInitializationBlock( | 1107 void ParserTraits::AddParameterInitializationBlock( |
| 1108 const ParserFormalParameters& parameters, | 1108 const ParserFormalParameters& parameters, |
| 1109 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) const { | 1109 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) { |
| 1110 if (!parameters.is_simple) { | 1110 if (!parameters.is_simple) { |
| 1111 auto* init_block = | 1111 auto* init_block = |
| 1112 parser_->BuildParameterInitializationBlock(parameters, ok); | 1112 parser_->BuildParameterInitializationBlock(parameters, ok); |
| 1113 if (!*ok) return; | 1113 if (!*ok) return; |
| 1114 | 1114 |
| 1115 if (is_async) { | 1115 if (is_async) { |
| 1116 init_block = parser_->BuildRejectPromiseOnException(init_block); | 1116 init_block = parser_->BuildRejectPromiseOnException(init_block); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 if (init_block != nullptr) { | 1119 if (init_block != nullptr) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1132 | 1132 |
| 1133 Expression* ParserTraits::RewriteYieldStar(Expression* generator, | 1133 Expression* ParserTraits::RewriteYieldStar(Expression* generator, |
| 1134 Expression* iterable, int pos) { | 1134 Expression* iterable, int pos) { |
| 1135 return parser_->RewriteYieldStar(generator, iterable, pos); | 1135 return parser_->RewriteYieldStar(generator, iterable, pos); |
| 1136 } | 1136 } |
| 1137 | 1137 |
| 1138 } // namespace internal | 1138 } // namespace internal |
| 1139 } // namespace v8 | 1139 } // namespace v8 |
| 1140 | 1140 |
| 1141 #endif // V8_PARSING_PARSER_H_ | 1141 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |