| 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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
| 6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 return PreParserExpression::Super(); | 1318 return PreParserExpression::Super(); |
| 1319 } | 1319 } |
| 1320 | 1320 |
| 1321 static PreParserExpression ClassExpression( | 1321 static PreParserExpression ClassExpression( |
| 1322 PreParserIdentifier name, PreParserExpression extends, | 1322 PreParserIdentifier name, PreParserExpression extends, |
| 1323 PreParserExpression constructor, PreParserExpressionList properties, | 1323 PreParserExpression constructor, PreParserExpressionList properties, |
| 1324 int start_position, int end_position, PreParserFactory* factory) { | 1324 int start_position, int end_position, PreParserFactory* factory) { |
| 1325 return PreParserExpression::Default(); | 1325 return PreParserExpression::Default(); |
| 1326 } | 1326 } |
| 1327 | 1327 |
| 1328 static PreParserExpression DefaultConstructor(bool call_super, |
| 1329 PreParserScope* scope, int pos, |
| 1330 int end_pos) { |
| 1331 return PreParserExpression::Default(); |
| 1332 } |
| 1333 |
| 1328 static PreParserExpression ExpressionFromLiteral( | 1334 static PreParserExpression ExpressionFromLiteral( |
| 1329 Token::Value token, int pos, Scanner* scanner, | 1335 Token::Value token, int pos, Scanner* scanner, |
| 1330 PreParserFactory* factory) { | 1336 PreParserFactory* factory) { |
| 1331 return PreParserExpression::Default(); | 1337 return PreParserExpression::Default(); |
| 1332 } | 1338 } |
| 1333 | 1339 |
| 1334 static PreParserExpression ExpressionFromIdentifier( | 1340 static PreParserExpression ExpressionFromIdentifier( |
| 1335 PreParserIdentifier name, int pos, PreParserScope* scope, | 1341 PreParserIdentifier name, int pos, PreParserScope* scope, |
| 1336 PreParserFactory* factory) { | 1342 PreParserFactory* factory) { |
| 1337 return PreParserExpression::FromIdentifier(name); | 1343 return PreParserExpression::FromIdentifier(name); |
| (...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2740 ReportMessageAt(class_name_location, "unexpected_strict_reserved"); | 2746 ReportMessageAt(class_name_location, "unexpected_strict_reserved"); |
| 2741 *ok = false; | 2747 *ok = false; |
| 2742 return this->EmptyExpression(); | 2748 return this->EmptyExpression(); |
| 2743 } | 2749 } |
| 2744 if (this->IsEvalOrArguments(name)) { | 2750 if (this->IsEvalOrArguments(name)) { |
| 2745 ReportMessageAt(class_name_location, "strict_eval_arguments"); | 2751 ReportMessageAt(class_name_location, "strict_eval_arguments"); |
| 2746 *ok = false; | 2752 *ok = false; |
| 2747 return this->EmptyExpression(); | 2753 return this->EmptyExpression(); |
| 2748 } | 2754 } |
| 2749 | 2755 |
| 2756 bool has_extends = false; |
| 2750 ExpressionT extends = this->EmptyExpression(); | 2757 ExpressionT extends = this->EmptyExpression(); |
| 2751 if (Check(Token::EXTENDS)) { | 2758 if (Check(Token::EXTENDS)) { |
| 2752 typename Traits::Type::ScopePtr scope = this->NewScope(scope_, BLOCK_SCOPE); | 2759 typename Traits::Type::ScopePtr scope = this->NewScope(scope_, BLOCK_SCOPE); |
| 2753 BlockState block_state(&scope_, Traits::Type::ptr_to_scope(scope)); | 2760 BlockState block_state(&scope_, Traits::Type::ptr_to_scope(scope)); |
| 2754 scope_->SetStrictMode(STRICT); | 2761 scope_->SetStrictMode(STRICT); |
| 2755 extends = this->ParseLeftHandSideExpression(CHECK_OK); | 2762 extends = this->ParseLeftHandSideExpression(CHECK_OK); |
| 2763 has_extends = true; |
| 2756 } | 2764 } |
| 2757 | 2765 |
| 2758 // TODO(arv): Implement scopes and name binding in class body only. | 2766 // TODO(arv): Implement scopes and name binding in class body only. |
| 2759 typename Traits::Type::ScopePtr scope = this->NewScope(scope_, BLOCK_SCOPE); | 2767 typename Traits::Type::ScopePtr scope = this->NewScope(scope_, BLOCK_SCOPE); |
| 2760 BlockState block_state(&scope_, Traits::Type::ptr_to_scope(scope)); | 2768 BlockState block_state(&scope_, Traits::Type::ptr_to_scope(scope)); |
| 2761 scope_->SetStrictMode(STRICT); | 2769 scope_->SetStrictMode(STRICT); |
| 2762 scope_->SetScopeName(name); | 2770 scope_->SetScopeName(name); |
| 2763 | 2771 |
| 2764 typename Traits::Type::PropertyList properties = | 2772 typename Traits::Type::PropertyList properties = |
| 2765 this->NewPropertyList(4, zone_); | 2773 this->NewPropertyList(4, zone_); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2784 | 2792 |
| 2785 if (fni_ != NULL) { | 2793 if (fni_ != NULL) { |
| 2786 fni_->Infer(); | 2794 fni_->Infer(); |
| 2787 fni_->Leave(); | 2795 fni_->Leave(); |
| 2788 } | 2796 } |
| 2789 } | 2797 } |
| 2790 | 2798 |
| 2791 int end_pos = peek_position(); | 2799 int end_pos = peek_position(); |
| 2792 Expect(Token::RBRACE, CHECK_OK); | 2800 Expect(Token::RBRACE, CHECK_OK); |
| 2793 | 2801 |
| 2802 if (!has_seen_constructor) { |
| 2803 constructor = |
| 2804 this->DefaultConstructor(has_extends, scope_, pos, end_pos + 1); |
| 2805 } |
| 2806 |
| 2794 return this->ClassExpression(name, extends, constructor, properties, pos, | 2807 return this->ClassExpression(name, extends, constructor, properties, pos, |
| 2795 end_pos + 1, factory()); | 2808 end_pos + 1, factory()); |
| 2796 } | 2809 } |
| 2797 | 2810 |
| 2798 | 2811 |
| 2799 template <typename Traits> | 2812 template <typename Traits> |
| 2800 typename ParserBase<Traits>::ExpressionT | 2813 typename ParserBase<Traits>::ExpressionT |
| 2801 ParserBase<Traits>::CheckAndRewriteReferenceExpression( | 2814 ParserBase<Traits>::CheckAndRewriteReferenceExpression( |
| 2802 ExpressionT expression, | 2815 ExpressionT expression, |
| 2803 Scanner::Location location, const char* message, bool* ok) { | 2816 Scanner::Location location, const char* message, bool* ok) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2848 DCHECK(IsAccessorAccessorConflict(old_type, type)); | 2861 DCHECK(IsAccessorAccessorConflict(old_type, type)); |
| 2849 // Both accessors of the same type. | 2862 // Both accessors of the same type. |
| 2850 parser()->ReportMessage("accessor_get_set"); | 2863 parser()->ReportMessage("accessor_get_set"); |
| 2851 } | 2864 } |
| 2852 *ok = false; | 2865 *ok = false; |
| 2853 } | 2866 } |
| 2854 } | 2867 } |
| 2855 } } // v8::internal | 2868 } } // v8::internal |
| 2856 | 2869 |
| 2857 #endif // V8_PREPARSER_H | 2870 #endif // V8_PREPARSER_H |
| OLD | NEW |