| 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/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 551 |
| 552 Expression* ThisExpression(int pos); | 552 Expression* ThisExpression(int pos); |
| 553 Expression* NewSuperPropertyReference(AstNodeFactory* factory, int pos); | 553 Expression* NewSuperPropertyReference(AstNodeFactory* factory, int pos); |
| 554 Expression* NewSuperCallReference(AstNodeFactory* factory, int pos); | 554 Expression* NewSuperCallReference(AstNodeFactory* factory, int pos); |
| 555 Expression* NewTargetExpression(int pos); | 555 Expression* NewTargetExpression(int pos); |
| 556 Expression* FunctionSentExpression(AstNodeFactory* factory, int pos); | 556 Expression* FunctionSentExpression(AstNodeFactory* factory, int pos); |
| 557 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, | 557 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, |
| 558 AstNodeFactory* factory); | 558 AstNodeFactory* factory); |
| 559 Expression* ExpressionFromIdentifier(const AstRawString* name, | 559 Expression* ExpressionFromIdentifier(const AstRawString* name, |
| 560 int start_position, int end_position, | 560 int start_position, int end_position, |
| 561 InferName = InferName::Yes); | 561 InferName = InferName::kYes); |
| 562 Expression* ExpressionFromString(int pos, Scanner* scanner, | 562 Expression* ExpressionFromString(int pos, Scanner* scanner, |
| 563 AstNodeFactory* factory); | 563 AstNodeFactory* factory); |
| 564 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory, | 564 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory, |
| 565 int pos); | 565 int pos); |
| 566 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { | 566 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { |
| 567 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); | 567 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); |
| 568 } | 568 } |
| 569 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) { | 569 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) { |
| 570 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); | 570 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); |
| 571 } | 571 } |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 private: | 762 private: |
| 763 friend class ParserTraits; | 763 friend class ParserTraits; |
| 764 | 764 |
| 765 // Runtime encoding of different completion modes. | 765 // Runtime encoding of different completion modes. |
| 766 enum CompletionKind { | 766 enum CompletionKind { |
| 767 kNormalCompletion, | 767 kNormalCompletion, |
| 768 kThrowCompletion, | 768 kThrowCompletion, |
| 769 kAbruptCompletion | 769 kAbruptCompletion |
| 770 }; | 770 }; |
| 771 | 771 |
| 772 enum class FunctionBodyType { kNormal, kSingleExpression }; |
| 773 |
| 772 DeclarationScope* GetDeclarationScope() const { | 774 DeclarationScope* GetDeclarationScope() const { |
| 773 return scope()->GetDeclarationScope(); | 775 return scope()->GetDeclarationScope(); |
| 774 } | 776 } |
| 775 DeclarationScope* GetClosureScope() const { | 777 DeclarationScope* GetClosureScope() const { |
| 776 return scope()->GetClosureScope(); | 778 return scope()->GetClosureScope(); |
| 777 } | 779 } |
| 778 Variable* NewTemporary(const AstRawString* name) { | 780 Variable* NewTemporary(const AstRawString* name) { |
| 779 return scope()->NewTemporary(name); | 781 return scope()->NewTemporary(name); |
| 780 } | 782 } |
| 781 | 783 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 bool finalize, | 1036 bool finalize, |
| 1035 int next_result_pos = kNoSourcePosition); | 1037 int next_result_pos = kNoSourcePosition); |
| 1036 Statement* DesugarLexicalBindingsInForStatement( | 1038 Statement* DesugarLexicalBindingsInForStatement( |
| 1037 Scope* inner_scope, VariableMode mode, | 1039 Scope* inner_scope, VariableMode mode, |
| 1038 ZoneList<const AstRawString*>* names, ForStatement* loop, Statement* init, | 1040 ZoneList<const AstRawString*>* names, ForStatement* loop, Statement* init, |
| 1039 Expression* cond, Statement* next, Statement* body, bool* ok); | 1041 Expression* cond, Statement* next, Statement* body, bool* ok); |
| 1040 | 1042 |
| 1041 void DesugarAsyncFunctionBody(const AstRawString* function_name, Scope* scope, | 1043 void DesugarAsyncFunctionBody(const AstRawString* function_name, Scope* scope, |
| 1042 ZoneList<Statement*>* body, | 1044 ZoneList<Statement*>* body, |
| 1043 Type::ExpressionClassifier* classifier, | 1045 Type::ExpressionClassifier* classifier, |
| 1044 FunctionKind kind, FunctionBody type, | 1046 FunctionKind kind, FunctionBodyType type, |
| 1045 bool accept_IN, int pos, bool* ok); | 1047 bool accept_IN, int pos, bool* ok); |
| 1046 | 1048 |
| 1047 void RewriteDoExpression(Expression* expr, bool* ok); | 1049 void RewriteDoExpression(Expression* expr, bool* ok); |
| 1048 | 1050 |
| 1049 FunctionLiteral* ParseFunctionLiteral( | 1051 FunctionLiteral* ParseFunctionLiteral( |
| 1050 const AstRawString* name, Scanner::Location function_name_location, | 1052 const AstRawString* name, Scanner::Location function_name_location, |
| 1051 FunctionNameValidity function_name_validity, FunctionKind kind, | 1053 FunctionNameValidity function_name_validity, FunctionKind kind, |
| 1052 int function_token_position, FunctionLiteral::FunctionType type, | 1054 int function_token_position, FunctionLiteral::FunctionType type, |
| 1053 LanguageMode language_mode, bool* ok); | 1055 LanguageMode language_mode, bool* ok); |
| 1054 | 1056 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 | 1377 |
| 1376 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1378 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
| 1377 return parser_->ParseDoExpression(ok); | 1379 return parser_->ParseDoExpression(ok); |
| 1378 } | 1380 } |
| 1379 | 1381 |
| 1380 | 1382 |
| 1381 } // namespace internal | 1383 } // namespace internal |
| 1382 } // namespace v8 | 1384 } // namespace v8 |
| 1383 | 1385 |
| 1384 #endif // V8_PARSING_PARSER_H_ | 1386 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |