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