OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 487 |
488 // Determine if the expression is a variable proxy and mark it as being used | 488 // Determine if the expression is a variable proxy and mark it as being used |
489 // in an assignment or with a increment/decrement operator. This is currently | 489 // in an assignment or with a increment/decrement operator. This is currently |
490 // used on for the statically checking assignments to harmony const bindings. | 490 // used on for the statically checking assignments to harmony const bindings. |
491 static Expression* MarkExpressionAsLValue(Expression* expression); | 491 static Expression* MarkExpressionAsLValue(Expression* expression); |
492 | 492 |
493 // Checks LHS expression for assignment and prefix/postfix increment/decrement | 493 // Checks LHS expression for assignment and prefix/postfix increment/decrement |
494 // in strict mode. | 494 // in strict mode. |
495 void CheckStrictModeLValue(Expression*expression, bool* ok); | 495 void CheckStrictModeLValue(Expression*expression, bool* ok); |
496 | 496 |
| 497 // Returns true if we have a binary expression between two numeric |
| 498 // literals. In that case, *x will be changed to an expression which is the |
| 499 // computed value. |
| 500 bool ShortcutNumericLiteralBinaryExpression( |
| 501 Expression** x, Expression* y, Token::Value op, int pos, |
| 502 AstNodeFactory<AstConstructionVisitor>* factory); |
| 503 |
497 // Reporting errors. | 504 // Reporting errors. |
498 void ReportMessageAt(Scanner::Location source_location, | 505 void ReportMessageAt(Scanner::Location source_location, |
499 const char* message, | 506 const char* message, |
500 Vector<const char*> args); | 507 Vector<const char*> args); |
501 void ReportMessage(const char* message, Vector<Handle<String> > args); | 508 void ReportMessage(const char* message, Vector<Handle<String> > args); |
502 void ReportMessageAt(Scanner::Location source_location, | 509 void ReportMessageAt(Scanner::Location source_location, |
503 const char* message, | 510 const char* message, |
504 Vector<Handle<String> > args); | 511 Vector<Handle<String> > args); |
505 | 512 |
506 // "null" return type creators. | 513 // "null" return type creators. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 // Temporary glue; these functions will move to ParserBase. | 553 // Temporary glue; these functions will move to ParserBase. |
547 Expression* ParseV8Intrinsic(bool* ok); | 554 Expression* ParseV8Intrinsic(bool* ok); |
548 FunctionLiteral* ParseFunctionLiteral( | 555 FunctionLiteral* ParseFunctionLiteral( |
549 Handle<String> name, | 556 Handle<String> name, |
550 Scanner::Location function_name_location, | 557 Scanner::Location function_name_location, |
551 bool name_is_strict_reserved, | 558 bool name_is_strict_reserved, |
552 bool is_generator, | 559 bool is_generator, |
553 int function_token_position, | 560 int function_token_position, |
554 FunctionLiteral::FunctionType type, | 561 FunctionLiteral::FunctionType type, |
555 bool* ok); | 562 bool* ok); |
556 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok); | 563 Expression* ParseUnaryExpression(bool* ok); |
557 | 564 |
558 private: | 565 private: |
559 Parser* parser_; | 566 Parser* parser_; |
560 }; | 567 }; |
561 | 568 |
562 | 569 |
563 class Parser : public ParserBase<ParserTraits> { | 570 class Parser : public ParserBase<ParserTraits> { |
564 public: | 571 public: |
565 explicit Parser(CompilationInfo* info); | 572 explicit Parser(CompilationInfo* info); |
566 ~Parser() { | 573 ~Parser() { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 WhileStatement* ParseWhileStatement(ZoneStringList* labels, bool* ok); | 696 WhileStatement* ParseWhileStatement(ZoneStringList* labels, bool* ok); |
690 Statement* ParseForStatement(ZoneStringList* labels, bool* ok); | 697 Statement* ParseForStatement(ZoneStringList* labels, bool* ok); |
691 Statement* ParseThrowStatement(bool* ok); | 698 Statement* ParseThrowStatement(bool* ok); |
692 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); | 699 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); |
693 TryStatement* ParseTryStatement(bool* ok); | 700 TryStatement* ParseTryStatement(bool* ok); |
694 DebuggerStatement* ParseDebuggerStatement(bool* ok); | 701 DebuggerStatement* ParseDebuggerStatement(bool* ok); |
695 | 702 |
696 // Support for hamony block scoped bindings. | 703 // Support for hamony block scoped bindings. |
697 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); | 704 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); |
698 | 705 |
699 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok); | |
700 Expression* ParseUnaryExpression(bool* ok); | 706 Expression* ParseUnaryExpression(bool* ok); |
701 Expression* ParsePostfixExpression(bool* ok); | 707 Expression* ParsePostfixExpression(bool* ok); |
702 Expression* ParseLeftHandSideExpression(bool* ok); | 708 Expression* ParseLeftHandSideExpression(bool* ok); |
703 Expression* ParseMemberWithNewPrefixesExpression(bool* ok); | 709 Expression* ParseMemberWithNewPrefixesExpression(bool* ok); |
704 Expression* ParseMemberExpression(bool* ok); | 710 Expression* ParseMemberExpression(bool* ok); |
705 Expression* ParseMemberExpressionContinuation(Expression* expression, | 711 Expression* ParseMemberExpressionContinuation(Expression* expression, |
706 bool* ok); | 712 bool* ok); |
707 Expression* ParseObjectLiteral(bool* ok); | 713 Expression* ParseObjectLiteral(bool* ok); |
708 | 714 |
709 // Initialize the components of a for-in / for-of statement. | 715 // Initialize the components of a for-in / for-of statement. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 private: | 828 private: |
823 static const int kLiteralTypeSlot = 0; | 829 static const int kLiteralTypeSlot = 0; |
824 static const int kElementsSlot = 1; | 830 static const int kElementsSlot = 1; |
825 | 831 |
826 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 832 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
827 }; | 833 }; |
828 | 834 |
829 } } // namespace v8::internal | 835 } } // namespace v8::internal |
830 | 836 |
831 #endif // V8_PARSER_H_ | 837 #endif // V8_PARSER_H_ |
OLD | NEW |