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" // For CachedDataMode | 10 #include "src/compiler.h" // For CachedDataMode |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 const AstRawString* GetNumberAsSymbol(Scanner* scanner); | 535 const AstRawString* GetNumberAsSymbol(Scanner* scanner); |
536 | 536 |
537 Expression* ThisExpression(Scope* scope, AstNodeFactory* factory, | 537 Expression* ThisExpression(Scope* scope, AstNodeFactory* factory, |
538 int pos = RelocInfo::kNoPosition); | 538 int pos = RelocInfo::kNoPosition); |
539 Expression* SuperReference(Scope* scope, AstNodeFactory* factory, | 539 Expression* SuperReference(Scope* scope, AstNodeFactory* factory, |
540 int pos = RelocInfo::kNoPosition); | 540 int pos = RelocInfo::kNoPosition); |
541 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, | 541 Expression* DefaultConstructor(bool call_super, Scope* scope, int pos, |
542 int end_pos); | 542 int end_pos); |
543 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, | 543 Literal* ExpressionFromLiteral(Token::Value token, int pos, Scanner* scanner, |
544 AstNodeFactory* factory); | 544 AstNodeFactory* factory); |
545 Expression* ExpressionFromIdentifier(const AstRawString* name, int pos, | 545 Expression* ExpressionFromIdentifier(const AstRawString* name, |
| 546 int start_position, int end_position, |
546 Scope* scope, AstNodeFactory* factory); | 547 Scope* scope, AstNodeFactory* factory); |
547 Expression* ExpressionFromString(int pos, Scanner* scanner, | 548 Expression* ExpressionFromString(int pos, Scanner* scanner, |
548 AstNodeFactory* factory); | 549 AstNodeFactory* factory); |
549 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory); | 550 Expression* GetIterator(Expression* iterable, AstNodeFactory* factory); |
550 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { | 551 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { |
551 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); | 552 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); |
552 } | 553 } |
553 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) { | 554 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) { |
554 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); | 555 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); |
555 } | 556 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 // function f() { { { var x; } let x; } } | 792 // function f() { { { var x; } let x; } } |
792 // function g() { { var x; let x; } } | 793 // function g() { { var x; let x; } } |
793 // | 794 // |
794 // The var declarations are hoisted to the function scope, but originate from | 795 // The var declarations are hoisted to the function scope, but originate from |
795 // a scope where the name has also been let bound or the var declaration is | 796 // a scope where the name has also been let bound or the var declaration is |
796 // hoisted over such a scope. | 797 // hoisted over such a scope. |
797 void CheckConflictingVarDeclarations(Scope* scope, bool* ok); | 798 void CheckConflictingVarDeclarations(Scope* scope, bool* ok); |
798 | 799 |
799 // Parser support | 800 // Parser support |
800 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode); | 801 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode); |
801 void Declare(Declaration* declaration, bool resolve, bool* ok); | 802 Variable* Declare(Declaration* declaration, bool resolve, bool* ok); |
802 | 803 |
803 bool TargetStackContainsLabel(const AstRawString* label); | 804 bool TargetStackContainsLabel(const AstRawString* label); |
804 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); | 805 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); |
805 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); | 806 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); |
806 | 807 |
807 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); | 808 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); |
808 | 809 |
809 // Factory methods. | 810 // Factory methods. |
810 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, | 811 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, |
811 int end_pos); | 812 int end_pos); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 } | 941 } |
941 | 942 |
942 | 943 |
943 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 944 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
944 int start, Expression* tag) { | 945 int start, Expression* tag) { |
945 return parser_->CloseTemplateLiteral(state, start, tag); | 946 return parser_->CloseTemplateLiteral(state, start, tag); |
946 } | 947 } |
947 } } // namespace v8::internal | 948 } } // namespace v8::internal |
948 | 949 |
949 #endif // V8_PARSER_H_ | 950 #endif // V8_PARSER_H_ |
OLD | NEW |