| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 412 } |
| 413 | 413 |
| 414 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { | 414 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { |
| 415 return ObjectLiteral::IsBoilerplateProperty(property); | 415 return ObjectLiteral::IsBoilerplateProperty(property); |
| 416 } | 416 } |
| 417 | 417 |
| 418 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { | 418 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { |
| 419 return string->AsArrayIndex(index); | 419 return string->AsArrayIndex(index); |
| 420 } | 420 } |
| 421 | 421 |
| 422 bool IsConstructorProperty(ObjectLiteral::Property* property) { |
| 423 return property->key()->raw_value()->EqualsString( |
| 424 ast_value_factory()->constructor_string()); |
| 425 } |
| 426 |
| 427 static Expression* GetPropertyValue(ObjectLiteral::Property* property) { |
| 428 return property->value(); |
| 429 } |
| 430 |
| 422 // Functions for encapsulating the differences between parsing and preparsing; | 431 // Functions for encapsulating the differences between parsing and preparsing; |
| 423 // operations interleaved with the recursive descent. | 432 // operations interleaved with the recursive descent. |
| 424 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { | 433 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { |
| 425 fni->PushLiteralName(id); | 434 fni->PushLiteralName(id); |
| 426 } | 435 } |
| 427 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); | 436 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); |
| 428 static void InferFunctionName(FuncNameInferrer* fni, | 437 static void InferFunctionName(FuncNameInferrer* fni, |
| 429 FunctionLiteral* func_to_infer) { | 438 FunctionLiteral* func_to_infer) { |
| 430 fni->AddFunction(func_to_infer); | 439 fni->AddFunction(func_to_infer); |
| 431 } | 440 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 const AstRawString* GetSymbol(Scanner* scanner); | 550 const AstRawString* GetSymbol(Scanner* scanner); |
| 542 const AstRawString* GetNextSymbol(Scanner* scanner); | 551 const AstRawString* GetNextSymbol(Scanner* scanner); |
| 543 const AstRawString* GetNumberAsSymbol(Scanner* scanner); | 552 const AstRawString* GetNumberAsSymbol(Scanner* scanner); |
| 544 | 553 |
| 545 Expression* ThisExpression(Scope* scope, | 554 Expression* ThisExpression(Scope* scope, |
| 546 AstNodeFactory<AstConstructionVisitor>* factory, | 555 AstNodeFactory<AstConstructionVisitor>* factory, |
| 547 int pos = RelocInfo::kNoPosition); | 556 int pos = RelocInfo::kNoPosition); |
| 548 Expression* SuperReference(Scope* scope, | 557 Expression* SuperReference(Scope* scope, |
| 549 AstNodeFactory<AstConstructionVisitor>* factory, | 558 AstNodeFactory<AstConstructionVisitor>* factory, |
| 550 int pos = RelocInfo::kNoPosition); | 559 int pos = RelocInfo::kNoPosition); |
| 551 Expression* ClassLiteral(const AstRawString* name, Expression* extends, | 560 Expression* ClassExpression(const AstRawString* name, Expression* extends, |
| 552 Expression* constructor, | 561 Expression* constructor, |
| 553 ZoneList<ObjectLiteral::Property*>* properties, | 562 ZoneList<ObjectLiteral::Property*>* properties, |
| 554 int pos, | 563 int pos, |
| 555 AstNodeFactory<AstConstructionVisitor>* factory); | 564 AstNodeFactory<AstConstructionVisitor>* factory); |
| 556 | 565 |
| 557 Literal* ExpressionFromLiteral( | 566 Literal* ExpressionFromLiteral( |
| 558 Token::Value token, int pos, Scanner* scanner, | 567 Token::Value token, int pos, Scanner* scanner, |
| 559 AstNodeFactory<AstConstructionVisitor>* factory); | 568 AstNodeFactory<AstConstructionVisitor>* factory); |
| 560 Expression* ExpressionFromIdentifier( | 569 Expression* ExpressionFromIdentifier( |
| 561 const AstRawString* name, int pos, Scope* scope, | 570 const AstRawString* name, int pos, Scope* scope, |
| 562 AstNodeFactory<AstConstructionVisitor>* factory); | 571 AstNodeFactory<AstConstructionVisitor>* factory); |
| 563 Expression* ExpressionFromString( | 572 Expression* ExpressionFromString( |
| 564 int pos, Scanner* scanner, | 573 int pos, Scanner* scanner, |
| 565 AstNodeFactory<AstConstructionVisitor>* factory); | 574 AstNodeFactory<AstConstructionVisitor>* factory); |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 private: | 930 private: |
| 922 static const int kLiteralTypeSlot = 0; | 931 static const int kLiteralTypeSlot = 0; |
| 923 static const int kElementsSlot = 1; | 932 static const int kElementsSlot = 1; |
| 924 | 933 |
| 925 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 934 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 926 }; | 935 }; |
| 927 | 936 |
| 928 } } // namespace v8::internal | 937 } } // namespace v8::internal |
| 929 | 938 |
| 930 #endif // V8_PARSER_H_ | 939 #endif // V8_PARSER_H_ |
| OLD | NEW |