Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: src/preparser.h

Issue 1140633003: Reapply "Resolve references to "this" the same way as normal variables"" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: ScopeInfo records slot of "this" binding; formatting Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ppc/lithium-codegen-ppc.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 Consume(Token::THIS); 2277 Consume(Token::THIS);
2278 if (is_strong(language_mode())) { 2278 if (is_strong(language_mode())) {
2279 // Constructors' usages of 'this' in strong mode are parsed separately. 2279 // Constructors' usages of 'this' in strong mode are parsed separately.
2280 // TODO(rossberg): this does not work with arrow functions yet. 2280 // TODO(rossberg): this does not work with arrow functions yet.
2281 if (i::IsConstructor(function_state_->kind())) { 2281 if (i::IsConstructor(function_state_->kind())) {
2282 ReportMessage(MessageTemplate::kStrongConstructorThis); 2282 ReportMessage(MessageTemplate::kStrongConstructorThis);
2283 *ok = false; 2283 *ok = false;
2284 break; 2284 break;
2285 } 2285 }
2286 } 2286 }
2287 scope_->RecordThisUsage();
2288 result = this->ThisExpression(scope_, factory(), beg_pos); 2287 result = this->ThisExpression(scope_, factory(), beg_pos);
2289 break; 2288 break;
2290 } 2289 }
2291 2290
2292 case Token::NULL_LITERAL: 2291 case Token::NULL_LITERAL:
2293 case Token::TRUE_LITERAL: 2292 case Token::TRUE_LITERAL:
2294 case Token::FALSE_LITERAL: 2293 case Token::FALSE_LITERAL:
2295 BindingPatternUnexpectedToken(classifier); 2294 BindingPatternUnexpectedToken(classifier);
2296 Next(); 2295 Next();
2297 result = 2296 result =
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
3353 ExpressionClassifier* classifier, bool* ok) { 3352 ExpressionClassifier* classifier, bool* ok) {
3354 // InitializationExpression :: (strong mode) 3353 // InitializationExpression :: (strong mode)
3355 // 'this' '.' IdentifierName '=' AssignmentExpression 3354 // 'this' '.' IdentifierName '=' AssignmentExpression
3356 // 'this' '[' Expression ']' '=' AssignmentExpression 3355 // 'this' '[' Expression ']' '=' AssignmentExpression
3357 3356
3358 if (fni_ != NULL) fni_->Enter(); 3357 if (fni_ != NULL) fni_->Enter();
3359 3358
3360 Consume(Token::THIS); 3359 Consume(Token::THIS);
3361 int pos = position(); 3360 int pos = position();
3362 function_state_->set_this_location(scanner()->location()); 3361 function_state_->set_this_location(scanner()->location());
3363 scope_->RecordThisUsage();
3364 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos); 3362 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos);
3365 3363
3366 ExpressionT left = this->EmptyExpression(); 3364 ExpressionT left = this->EmptyExpression();
3367 switch (peek()) { 3365 switch (peek()) {
3368 case Token::LBRACK: { 3366 case Token::LBRACK: {
3369 Consume(Token::LBRACK); 3367 Consume(Token::LBRACK);
3370 int pos = position(); 3368 int pos = position();
3371 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); 3369 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK);
3372 left = factory()->NewProperty(this_expr, index, pos); 3370 left = factory()->NewProperty(this_expr, index, pos);
3373 if (fni_ != NULL) { 3371 if (fni_ != NULL) {
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
3960 *ok = false; 3958 *ok = false;
3961 return; 3959 return;
3962 } 3960 }
3963 has_seen_constructor_ = true; 3961 has_seen_constructor_ = true;
3964 return; 3962 return;
3965 } 3963 }
3966 } 3964 }
3967 } } // v8::internal 3965 } } // v8::internal
3968 3966
3969 #endif // V8_PREPARSER_H 3967 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/ppc/lithium-codegen-ppc.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698