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_PARSING_PARSER_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H |
6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_H |
7 | 7 |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/base/hashmap.h" | 10 #include "src/base/hashmap.h" |
(...skipping 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 bool* ok) { | 3055 bool* ok) { |
3056 Expect(Token::SUPER, CHECK_OK); | 3056 Expect(Token::SUPER, CHECK_OK); |
3057 int pos = position(); | 3057 int pos = position(); |
3058 | 3058 |
3059 Scope* scope = scope_->ReceiverScope(); | 3059 Scope* scope = scope_->ReceiverScope(); |
3060 FunctionKind kind = scope->function_kind(); | 3060 FunctionKind kind = scope->function_kind(); |
3061 if (IsConciseMethod(kind) || IsAccessorFunction(kind) || | 3061 if (IsConciseMethod(kind) || IsAccessorFunction(kind) || |
3062 IsClassConstructor(kind)) { | 3062 IsClassConstructor(kind)) { |
3063 if (peek() == Token::PERIOD || peek() == Token::LBRACK) { | 3063 if (peek() == Token::PERIOD || peek() == Token::LBRACK) { |
3064 scope->RecordSuperPropertyUsage(); | 3064 scope->RecordSuperPropertyUsage(); |
3065 return this->SuperPropertyReference(scope_, factory(), pos); | 3065 return this->NewSuperPropertyReference(scope_, factory(), pos); |
3066 } | 3066 } |
3067 // new super() is never allowed. | 3067 // new super() is never allowed. |
3068 // super() is only allowed in derived constructor | 3068 // super() is only allowed in derived constructor |
3069 if (!is_new && peek() == Token::LPAREN && IsSubclassConstructor(kind)) { | 3069 if (!is_new && peek() == Token::LPAREN && IsSubclassConstructor(kind)) { |
3070 // TODO(rossberg): This might not be the correct FunctionState for the | 3070 // TODO(rossberg): This might not be the correct FunctionState for the |
3071 // method here. | 3071 // method here. |
3072 function_state_->set_super_location(scanner()->location()); | 3072 function_state_->set_super_location(scanner()->location()); |
3073 return this->SuperCallReference(scope_, factory(), pos); | 3073 return this->NewSuperCallReference(scope_, factory(), pos); |
3074 } | 3074 } |
3075 } | 3075 } |
3076 | 3076 |
3077 ReportMessageAt(scanner()->location(), MessageTemplate::kUnexpectedSuper); | 3077 ReportMessageAt(scanner()->location(), MessageTemplate::kUnexpectedSuper); |
3078 *ok = false; | 3078 *ok = false; |
3079 return this->EmptyExpression(); | 3079 return this->EmptyExpression(); |
3080 } | 3080 } |
3081 | 3081 |
3082 template <class Traits> | 3082 template <class Traits> |
3083 void ParserBase<Traits>::ExpectMetaProperty(Vector<const char> property_name, | 3083 void ParserBase<Traits>::ExpectMetaProperty(Vector<const char> property_name, |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3665 has_seen_constructor_ = true; | 3665 has_seen_constructor_ = true; |
3666 return; | 3666 return; |
3667 } | 3667 } |
3668 } | 3668 } |
3669 | 3669 |
3670 | 3670 |
3671 } // namespace internal | 3671 } // namespace internal |
3672 } // namespace v8 | 3672 } // namespace v8 |
3673 | 3673 |
3674 #endif // V8_PARSING_PARSER_BASE_H | 3674 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |