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 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 FunctionLiteral::FunctionType function_type, | 1095 FunctionLiteral::FunctionType function_type, |
1096 FunctionLiteral::IsFunctionFlag is_function, | 1096 FunctionLiteral::IsFunctionFlag is_function, |
1097 FunctionLiteral::IsParenthesizedFlag is_parenthesized, FunctionKind kind, | 1097 FunctionLiteral::IsParenthesizedFlag is_parenthesized, FunctionKind kind, |
1098 int position) { | 1098 int position) { |
1099 return PreParserExpression::Default(); | 1099 return PreParserExpression::Default(); |
1100 } | 1100 } |
1101 PreParserExpression NewClassLiteral(PreParserIdentifier name, | 1101 PreParserExpression NewClassLiteral(PreParserIdentifier name, |
1102 PreParserExpression extends, | 1102 PreParserExpression extends, |
1103 PreParserExpression constructor, | 1103 PreParserExpression constructor, |
1104 PreParserExpressionList properties, | 1104 PreParserExpressionList properties, |
1105 int position) { | 1105 int start_position, int end_position) { |
1106 return PreParserExpression::Default(); | 1106 return PreParserExpression::Default(); |
1107 } | 1107 } |
1108 | 1108 |
1109 // Return the object itself as AstVisitor and implement the needed | 1109 // Return the object itself as AstVisitor and implement the needed |
1110 // dummy method right in this class. | 1110 // dummy method right in this class. |
1111 PreParserFactory* visitor() { return this; } | 1111 PreParserFactory* visitor() { return this; } |
1112 BailoutReason dont_optimize_reason() { return kNoReason; } | 1112 BailoutReason dont_optimize_reason() { return kNoReason; } |
1113 int* ast_properties() { | 1113 int* ast_properties() { |
1114 static int dummy = 42; | 1114 static int dummy = 42; |
1115 return &dummy; | 1115 return &dummy; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 static PreParserExpression ThisExpression(PreParserScope* scope, | 1327 static PreParserExpression ThisExpression(PreParserScope* scope, |
1328 PreParserFactory* factory) { | 1328 PreParserFactory* factory) { |
1329 return PreParserExpression::This(); | 1329 return PreParserExpression::This(); |
1330 } | 1330 } |
1331 | 1331 |
1332 static PreParserExpression SuperReference(PreParserScope* scope, | 1332 static PreParserExpression SuperReference(PreParserScope* scope, |
1333 PreParserFactory* factory) { | 1333 PreParserFactory* factory) { |
1334 return PreParserExpression::Super(); | 1334 return PreParserExpression::Super(); |
1335 } | 1335 } |
1336 | 1336 |
1337 static PreParserExpression ClassExpression(PreParserIdentifier name, | 1337 static PreParserExpression ClassExpression( |
1338 PreParserExpression extends, | 1338 PreParserIdentifier name, PreParserExpression extends, |
1339 PreParserExpression constructor, | 1339 PreParserExpression constructor, PreParserExpressionList properties, |
1340 PreParserExpressionList properties, | 1340 int start_position, int end_position, PreParserFactory* factory) { |
1341 int position, | |
1342 PreParserFactory* factory) { | |
1343 return PreParserExpression::Default(); | 1341 return PreParserExpression::Default(); |
1344 } | 1342 } |
1345 | 1343 |
1346 static PreParserExpression ExpressionFromLiteral( | 1344 static PreParserExpression ExpressionFromLiteral( |
1347 Token::Value token, int pos, Scanner* scanner, | 1345 Token::Value token, int pos, Scanner* scanner, |
1348 PreParserFactory* factory) { | 1346 PreParserFactory* factory) { |
1349 return PreParserExpression::Default(); | 1347 return PreParserExpression::Default(); |
1350 } | 1348 } |
1351 | 1349 |
1352 static PreParserExpression ExpressionFromIdentifier( | 1350 static PreParserExpression ExpressionFromIdentifier( |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2798 constructor = this->GetPropertyValue(property); | 2796 constructor = this->GetPropertyValue(property); |
2799 } else { | 2797 } else { |
2800 properties->Add(property, zone()); | 2798 properties->Add(property, zone()); |
2801 } | 2799 } |
2802 | 2800 |
2803 if (fni_ != NULL) { | 2801 if (fni_ != NULL) { |
2804 fni_->Infer(); | 2802 fni_->Infer(); |
2805 fni_->Leave(); | 2803 fni_->Leave(); |
2806 } | 2804 } |
2807 } | 2805 } |
| 2806 |
| 2807 int end_pos = peek_position(); |
2808 Expect(Token::RBRACE, CHECK_OK); | 2808 Expect(Token::RBRACE, CHECK_OK); |
2809 | 2809 |
2810 return this->ClassExpression(name, extends, constructor, properties, pos, | 2810 return this->ClassExpression(name, extends, constructor, properties, pos, |
2811 factory()); | 2811 end_pos + 1, factory()); |
2812 } | 2812 } |
2813 | 2813 |
2814 | 2814 |
2815 template <typename Traits> | 2815 template <typename Traits> |
2816 typename ParserBase<Traits>::ExpressionT | 2816 typename ParserBase<Traits>::ExpressionT |
2817 ParserBase<Traits>::CheckAndRewriteReferenceExpression( | 2817 ParserBase<Traits>::CheckAndRewriteReferenceExpression( |
2818 ExpressionT expression, | 2818 ExpressionT expression, |
2819 Scanner::Location location, const char* message, bool* ok) { | 2819 Scanner::Location location, const char* message, bool* ok) { |
2820 if (strict_mode() == STRICT && this->IsIdentifier(expression) && | 2820 if (strict_mode() == STRICT && this->IsIdentifier(expression) && |
2821 this->IsEvalOrArguments(this->AsIdentifier(expression))) { | 2821 this->IsEvalOrArguments(this->AsIdentifier(expression))) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2864 DCHECK(IsAccessorAccessorConflict(old_type, type)); | 2864 DCHECK(IsAccessorAccessorConflict(old_type, type)); |
2865 // Both accessors of the same type. | 2865 // Both accessors of the same type. |
2866 parser()->ReportMessage("accessor_get_set"); | 2866 parser()->ReportMessage("accessor_get_set"); |
2867 } | 2867 } |
2868 *ok = false; | 2868 *ok = false; |
2869 } | 2869 } |
2870 } | 2870 } |
2871 } } // v8::internal | 2871 } } // v8::internal |
2872 | 2872 |
2873 #endif // V8_PREPARSER_H | 2873 #endif // V8_PREPARSER_H |
OLD | NEW |