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