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 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2257 Consume(Token::THIS); | 2257 Consume(Token::THIS); |
2258 if (is_strong(language_mode())) { | 2258 if (is_strong(language_mode())) { |
2259 // Constructors' usages of 'this' in strong mode are parsed separately. | 2259 // Constructors' usages of 'this' in strong mode are parsed separately. |
2260 // TODO(rossberg): this does not work with arrow functions yet. | 2260 // TODO(rossberg): this does not work with arrow functions yet. |
2261 if (i::IsConstructor(function_state_->kind())) { | 2261 if (i::IsConstructor(function_state_->kind())) { |
2262 ReportMessage("strong_constructor_this"); | 2262 ReportMessage("strong_constructor_this"); |
2263 *ok = false; | 2263 *ok = false; |
2264 break; | 2264 break; |
2265 } | 2265 } |
2266 } | 2266 } |
2267 scope_->RecordThisUsage(); | |
2268 result = this->ThisExpression(scope_, factory(), beg_pos); | 2267 result = this->ThisExpression(scope_, factory(), beg_pos); |
2269 break; | 2268 break; |
2270 } | 2269 } |
2271 | 2270 |
2272 case Token::NULL_LITERAL: | 2271 case Token::NULL_LITERAL: |
2273 case Token::TRUE_LITERAL: | 2272 case Token::TRUE_LITERAL: |
2274 case Token::FALSE_LITERAL: | 2273 case Token::FALSE_LITERAL: |
2275 BindingPatternUnexpectedToken(classifier); | 2274 BindingPatternUnexpectedToken(classifier); |
2276 Next(); | 2275 Next(); |
2277 result = | 2276 result = |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3329 ExpressionClassifier* classifier, bool* ok) { | 3328 ExpressionClassifier* classifier, bool* ok) { |
3330 // InitializationExpression :: (strong mode) | 3329 // InitializationExpression :: (strong mode) |
3331 // 'this' '.' IdentifierName '=' AssignmentExpression | 3330 // 'this' '.' IdentifierName '=' AssignmentExpression |
3332 // 'this' '[' Expression ']' '=' AssignmentExpression | 3331 // 'this' '[' Expression ']' '=' AssignmentExpression |
3333 | 3332 |
3334 if (fni_ != NULL) fni_->Enter(); | 3333 if (fni_ != NULL) fni_->Enter(); |
3335 | 3334 |
3336 Consume(Token::THIS); | 3335 Consume(Token::THIS); |
3337 int pos = position(); | 3336 int pos = position(); |
3338 function_state_->set_this_location(scanner()->location()); | 3337 function_state_->set_this_location(scanner()->location()); |
3339 scope_->RecordThisUsage(); | |
3340 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos); | 3338 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos); |
3341 | 3339 |
3342 ExpressionT left = this->EmptyExpression(); | 3340 ExpressionT left = this->EmptyExpression(); |
3343 switch (peek()) { | 3341 switch (peek()) { |
3344 case Token::LBRACK: { | 3342 case Token::LBRACK: { |
3345 Consume(Token::LBRACK); | 3343 Consume(Token::LBRACK); |
3346 int pos = position(); | 3344 int pos = position(); |
3347 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); | 3345 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); |
3348 left = factory()->NewProperty(this_expr, index, pos); | 3346 left = factory()->NewProperty(this_expr, index, pos); |
3349 if (fni_ != NULL) { | 3347 if (fni_ != NULL) { |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3923 *ok = false; | 3921 *ok = false; |
3924 return; | 3922 return; |
3925 } | 3923 } |
3926 has_seen_constructor_ = true; | 3924 has_seen_constructor_ = true; |
3927 return; | 3925 return; |
3928 } | 3926 } |
3929 } | 3927 } |
3930 } } // v8::internal | 3928 } } // v8::internal |
3931 | 3929 |
3932 #endif // V8_PREPARSER_H | 3930 #endif // V8_PREPARSER_H |
OLD | NEW |