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 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2057 // TemplateLiteral | 2057 // TemplateLiteral |
2058 | 2058 |
2059 int beg_pos = scanner()->peek_location().beg_pos; | 2059 int beg_pos = scanner()->peek_location().beg_pos; |
2060 int end_pos = scanner()->peek_location().end_pos; | 2060 int end_pos = scanner()->peek_location().end_pos; |
2061 ExpressionT result = this->EmptyExpression(); | 2061 ExpressionT result = this->EmptyExpression(); |
2062 Token::Value token = peek(); | 2062 Token::Value token = peek(); |
2063 switch (token) { | 2063 switch (token) { |
2064 case Token::THIS: { | 2064 case Token::THIS: { |
2065 BindingPatternUnexpectedToken(classifier); | 2065 BindingPatternUnexpectedToken(classifier); |
2066 Consume(Token::THIS); | 2066 Consume(Token::THIS); |
2067 if (is_strong(language_mode())) { | 2067 if (FLAG_strong_this && is_strong(language_mode())) { |
2068 // Constructors' usages of 'this' in strong mode are parsed separately. | 2068 // Constructors' usages of 'this' in strong mode are parsed separately. |
2069 // TODO(rossberg): this does not work with arrow functions yet. | 2069 // TODO(rossberg): this does not work with arrow functions yet. |
2070 if (i::IsConstructor(function_state_->kind())) { | 2070 if (i::IsConstructor(function_state_->kind())) { |
2071 ReportMessage(MessageTemplate::kStrongConstructorThis); | 2071 ReportMessage(MessageTemplate::kStrongConstructorThis); |
2072 *ok = false; | 2072 *ok = false; |
2073 break; | 2073 break; |
2074 } | 2074 } |
2075 } | 2075 } |
2076 result = this->ThisExpression(scope_, factory(), beg_pos); | 2076 result = this->ThisExpression(scope_, factory(), beg_pos); |
2077 break; | 2077 break; |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3846 *ok = false; | 3846 *ok = false; |
3847 return; | 3847 return; |
3848 } | 3848 } |
3849 has_seen_constructor_ = true; | 3849 has_seen_constructor_ = true; |
3850 return; | 3850 return; |
3851 } | 3851 } |
3852 } | 3852 } |
3853 } } // v8::internal | 3853 } } // v8::internal |
3854 | 3854 |
3855 #endif // V8_PREPARSER_H | 3855 #endif // V8_PREPARSER_H |
OLD | NEW |