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 2736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 FunctionKind kind = function_state->kind(); | 2747 FunctionKind kind = function_state->kind(); |
2748 if (IsConciseMethod(kind) || IsAccessorFunction(kind) || | 2748 if (IsConciseMethod(kind) || IsAccessorFunction(kind) || |
2749 i::IsConstructor(kind)) { | 2749 i::IsConstructor(kind)) { |
2750 if (peek() == Token::PERIOD || peek() == Token::LBRACK) { | 2750 if (peek() == Token::PERIOD || peek() == Token::LBRACK) { |
2751 scope_->RecordSuperPropertyUsage(); | 2751 scope_->RecordSuperPropertyUsage(); |
2752 return this->SuperReference(scope_, factory()); | 2752 return this->SuperReference(scope_, factory()); |
2753 } | 2753 } |
2754 // new super() is never allowed. | 2754 // new super() is never allowed. |
2755 // super() is only allowed in derived constructor | 2755 // super() is only allowed in derived constructor |
2756 if (!is_new && peek() == Token::LPAREN && IsSubclassConstructor(kind)) { | 2756 if (!is_new && peek() == Token::LPAREN && IsSubclassConstructor(kind)) { |
2757 scope_->RecordSuperConstructorCallUsage(); | |
2758 return this->SuperReference(scope_, factory()); | 2757 return this->SuperReference(scope_, factory()); |
2759 } | 2758 } |
2760 } | 2759 } |
2761 | 2760 |
2762 ReportMessageAt(scanner()->location(), "unexpected_super"); | 2761 ReportMessageAt(scanner()->location(), "unexpected_super"); |
2763 *ok = false; | 2762 *ok = false; |
2764 return this->EmptyExpression(); | 2763 return this->EmptyExpression(); |
2765 } | 2764 } |
2766 | 2765 |
2767 | 2766 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3077 *ok = false; | 3076 *ok = false; |
3078 return; | 3077 return; |
3079 } | 3078 } |
3080 has_seen_constructor_ = true; | 3079 has_seen_constructor_ = true; |
3081 return; | 3080 return; |
3082 } | 3081 } |
3083 } | 3082 } |
3084 } } // v8::internal | 3083 } } // v8::internal |
3085 | 3084 |
3086 #endif // V8_PREPARSER_H | 3085 #endif // V8_PREPARSER_H |
OLD | NEW |