| 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 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 Consume(Token::THIS); | 2213 Consume(Token::THIS); |
| 2214 if (is_strong(language_mode())) { | 2214 if (is_strong(language_mode())) { |
| 2215 // Constructors' usages of 'this' in strong mode are parsed separately. | 2215 // Constructors' usages of 'this' in strong mode are parsed separately. |
| 2216 // TODO(rossberg): this does not work with arrow functions yet. | 2216 // TODO(rossberg): this does not work with arrow functions yet. |
| 2217 if (i::IsConstructor(function_state_->kind())) { | 2217 if (i::IsConstructor(function_state_->kind())) { |
| 2218 ReportMessage("strong_constructor_this"); | 2218 ReportMessage("strong_constructor_this"); |
| 2219 *ok = false; | 2219 *ok = false; |
| 2220 break; | 2220 break; |
| 2221 } | 2221 } |
| 2222 } | 2222 } |
| 2223 scope_->RecordThisUsage(); | |
| 2224 result = this->ThisExpression(scope_, factory(), beg_pos); | 2223 result = this->ThisExpression(scope_, factory(), beg_pos); |
| 2225 break; | 2224 break; |
| 2226 } | 2225 } |
| 2227 | 2226 |
| 2228 case Token::NULL_LITERAL: | 2227 case Token::NULL_LITERAL: |
| 2229 case Token::TRUE_LITERAL: | 2228 case Token::TRUE_LITERAL: |
| 2230 case Token::FALSE_LITERAL: | 2229 case Token::FALSE_LITERAL: |
| 2231 BindingPatternUnexpectedToken(classifier); | 2230 BindingPatternUnexpectedToken(classifier); |
| 2232 Next(); | 2231 Next(); |
| 2233 result = | 2232 result = |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3239 ExpressionClassifier* classifier, bool* ok) { | 3238 ExpressionClassifier* classifier, bool* ok) { |
| 3240 // InitializationExpression :: (strong mode) | 3239 // InitializationExpression :: (strong mode) |
| 3241 // 'this' '.' IdentifierName '=' AssignmentExpression | 3240 // 'this' '.' IdentifierName '=' AssignmentExpression |
| 3242 // 'this' '[' Expression ']' '=' AssignmentExpression | 3241 // 'this' '[' Expression ']' '=' AssignmentExpression |
| 3243 | 3242 |
| 3244 if (fni_ != NULL) fni_->Enter(); | 3243 if (fni_ != NULL) fni_->Enter(); |
| 3245 | 3244 |
| 3246 Consume(Token::THIS); | 3245 Consume(Token::THIS); |
| 3247 int pos = position(); | 3246 int pos = position(); |
| 3248 function_state_->set_this_location(scanner()->location()); | 3247 function_state_->set_this_location(scanner()->location()); |
| 3249 scope_->RecordThisUsage(); | |
| 3250 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos); | 3248 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos); |
| 3251 | 3249 |
| 3252 ExpressionT left = this->EmptyExpression(); | 3250 ExpressionT left = this->EmptyExpression(); |
| 3253 switch (peek()) { | 3251 switch (peek()) { |
| 3254 case Token::LBRACK: { | 3252 case Token::LBRACK: { |
| 3255 Consume(Token::LBRACK); | 3253 Consume(Token::LBRACK); |
| 3256 int pos = position(); | 3254 int pos = position(); |
| 3257 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); | 3255 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); |
| 3258 left = factory()->NewProperty(this_expr, index, pos); | 3256 left = factory()->NewProperty(this_expr, index, pos); |
| 3259 if (fni_ != NULL) { | 3257 if (fni_ != NULL) { |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3845 *ok = false; | 3843 *ok = false; |
| 3846 return; | 3844 return; |
| 3847 } | 3845 } |
| 3848 has_seen_constructor_ = true; | 3846 has_seen_constructor_ = true; |
| 3849 return; | 3847 return; |
| 3850 } | 3848 } |
| 3851 } | 3849 } |
| 3852 } } // v8::internal | 3850 } } // v8::internal |
| 3853 | 3851 |
| 3854 #endif // V8_PREPARSER_H | 3852 #endif // V8_PREPARSER_H |
| OLD | NEW |