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(); | |
arv (Not doing code reviews)
2015/05/06 14:23:52
It is not clear to me how this works now? Don't we
wingo
2015/05/06 14:37:42
ThisExpression for the full parser will create an
| |
2219 result = this->ThisExpression(scope_, factory(), beg_pos); | 2218 result = this->ThisExpression(scope_, factory(), beg_pos); |
2220 break; | 2219 break; |
2221 } | 2220 } |
2222 | 2221 |
2223 case Token::NULL_LITERAL: | 2222 case Token::NULL_LITERAL: |
2224 case Token::TRUE_LITERAL: | 2223 case Token::TRUE_LITERAL: |
2225 case Token::FALSE_LITERAL: | 2224 case Token::FALSE_LITERAL: |
2226 BindingPatternUnexpectedToken(classifier); | 2225 BindingPatternUnexpectedToken(classifier); |
2227 Next(); | 2226 Next(); |
2228 result = | 2227 result = |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3234 ExpressionClassifier* classifier, bool* ok) { | 3233 ExpressionClassifier* classifier, bool* ok) { |
3235 // InitializationExpression :: (strong mode) | 3234 // InitializationExpression :: (strong mode) |
3236 // 'this' '.' IdentifierName '=' AssignmentExpression | 3235 // 'this' '.' IdentifierName '=' AssignmentExpression |
3237 // 'this' '[' Expression ']' '=' AssignmentExpression | 3236 // 'this' '[' Expression ']' '=' AssignmentExpression |
3238 | 3237 |
3239 if (fni_ != NULL) fni_->Enter(); | 3238 if (fni_ != NULL) fni_->Enter(); |
3240 | 3239 |
3241 Consume(Token::THIS); | 3240 Consume(Token::THIS); |
3242 int pos = position(); | 3241 int pos = position(); |
3243 function_state_->set_this_location(scanner()->location()); | 3242 function_state_->set_this_location(scanner()->location()); |
3244 scope_->RecordThisUsage(); | |
3245 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos); | 3243 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos); |
3246 | 3244 |
3247 ExpressionT left = this->EmptyExpression(); | 3245 ExpressionT left = this->EmptyExpression(); |
3248 switch (peek()) { | 3246 switch (peek()) { |
3249 case Token::LBRACK: { | 3247 case Token::LBRACK: { |
3250 Consume(Token::LBRACK); | 3248 Consume(Token::LBRACK); |
3251 int pos = position(); | 3249 int pos = position(); |
3252 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); | 3250 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); |
3253 left = factory()->NewProperty(this_expr, index, pos); | 3251 left = factory()->NewProperty(this_expr, index, pos); |
3254 if (fni_ != NULL) { | 3252 if (fni_ != NULL) { |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3840 *ok = false; | 3838 *ok = false; |
3841 return; | 3839 return; |
3842 } | 3840 } |
3843 has_seen_constructor_ = true; | 3841 has_seen_constructor_ = true; |
3844 return; | 3842 return; |
3845 } | 3843 } |
3846 } | 3844 } |
3847 } } // v8::internal | 3845 } } // v8::internal |
3848 | 3846 |
3849 #endif // V8_PREPARSER_H | 3847 #endif // V8_PREPARSER_H |
OLD | NEW |