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

Side by Side Diff: src/preparser.h

Issue 1146733002: Revert of Reapply "Resolve references to "this" the same way as normal variables"" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: 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 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
2267 result = this->ThisExpression(scope_, factory(), beg_pos); 2268 result = this->ThisExpression(scope_, factory(), beg_pos);
2268 break; 2269 break;
2269 } 2270 }
2270 2271
2271 case Token::NULL_LITERAL: 2272 case Token::NULL_LITERAL:
2272 case Token::TRUE_LITERAL: 2273 case Token::TRUE_LITERAL:
2273 case Token::FALSE_LITERAL: 2274 case Token::FALSE_LITERAL:
2274 BindingPatternUnexpectedToken(classifier); 2275 BindingPatternUnexpectedToken(classifier);
2275 Next(); 2276 Next();
2276 result = 2277 result =
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
3328 ExpressionClassifier* classifier, bool* ok) { 3329 ExpressionClassifier* classifier, bool* ok) {
3329 // InitializationExpression :: (strong mode) 3330 // InitializationExpression :: (strong mode)
3330 // 'this' '.' IdentifierName '=' AssignmentExpression 3331 // 'this' '.' IdentifierName '=' AssignmentExpression
3331 // 'this' '[' Expression ']' '=' AssignmentExpression 3332 // 'this' '[' Expression ']' '=' AssignmentExpression
3332 3333
3333 if (fni_ != NULL) fni_->Enter(); 3334 if (fni_ != NULL) fni_->Enter();
3334 3335
3335 Consume(Token::THIS); 3336 Consume(Token::THIS);
3336 int pos = position(); 3337 int pos = position();
3337 function_state_->set_this_location(scanner()->location()); 3338 function_state_->set_this_location(scanner()->location());
3339 scope_->RecordThisUsage();
3338 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos); 3340 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos);
3339 3341
3340 ExpressionT left = this->EmptyExpression(); 3342 ExpressionT left = this->EmptyExpression();
3341 switch (peek()) { 3343 switch (peek()) {
3342 case Token::LBRACK: { 3344 case Token::LBRACK: {
3343 Consume(Token::LBRACK); 3345 Consume(Token::LBRACK);
3344 int pos = position(); 3346 int pos = position();
3345 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); 3347 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK);
3346 left = factory()->NewProperty(this_expr, index, pos); 3348 left = factory()->NewProperty(this_expr, index, pos);
3347 if (fni_ != NULL) { 3349 if (fni_ != NULL) {
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
3921 *ok = false; 3923 *ok = false;
3922 return; 3924 return;
3923 } 3925 }
3924 has_seen_constructor_ = true; 3926 has_seen_constructor_ = true;
3925 return; 3927 return;
3926 } 3928 }
3927 } 3929 }
3928 } } // v8::internal 3930 } } // v8::internal
3929 3931
3930 #endif // V8_PREPARSER_H 3932 #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