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

Side by Side Diff: src/preparser.h

Issue 1134003003: Revert "Resolve references to "this" the same way as normal variables" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@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 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
2223 result = this->ThisExpression(scope_, factory(), beg_pos); 2224 result = this->ThisExpression(scope_, factory(), beg_pos);
2224 break; 2225 break;
2225 } 2226 }
2226 2227
2227 case Token::NULL_LITERAL: 2228 case Token::NULL_LITERAL:
2228 case Token::TRUE_LITERAL: 2229 case Token::TRUE_LITERAL:
2229 case Token::FALSE_LITERAL: 2230 case Token::FALSE_LITERAL:
2230 BindingPatternUnexpectedToken(classifier); 2231 BindingPatternUnexpectedToken(classifier);
2231 Next(); 2232 Next();
2232 result = 2233 result =
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
3238 ExpressionClassifier* classifier, bool* ok) { 3239 ExpressionClassifier* classifier, bool* ok) {
3239 // InitializationExpression :: (strong mode) 3240 // InitializationExpression :: (strong mode)
3240 // 'this' '.' IdentifierName '=' AssignmentExpression 3241 // 'this' '.' IdentifierName '=' AssignmentExpression
3241 // 'this' '[' Expression ']' '=' AssignmentExpression 3242 // 'this' '[' Expression ']' '=' AssignmentExpression
3242 3243
3243 if (fni_ != NULL) fni_->Enter(); 3244 if (fni_ != NULL) fni_->Enter();
3244 3245
3245 Consume(Token::THIS); 3246 Consume(Token::THIS);
3246 int pos = position(); 3247 int pos = position();
3247 function_state_->set_this_location(scanner()->location()); 3248 function_state_->set_this_location(scanner()->location());
3249 scope_->RecordThisUsage();
3248 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos); 3250 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos);
3249 3251
3250 ExpressionT left = this->EmptyExpression(); 3252 ExpressionT left = this->EmptyExpression();
3251 switch (peek()) { 3253 switch (peek()) {
3252 case Token::LBRACK: { 3254 case Token::LBRACK: {
3253 Consume(Token::LBRACK); 3255 Consume(Token::LBRACK);
3254 int pos = position(); 3256 int pos = position();
3255 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); 3257 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK);
3256 left = factory()->NewProperty(this_expr, index, pos); 3258 left = factory()->NewProperty(this_expr, index, pos);
3257 if (fni_ != NULL) { 3259 if (fni_ != NULL) {
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
3843 *ok = false; 3845 *ok = false;
3844 return; 3846 return;
3845 } 3847 }
3846 has_seen_constructor_ = true; 3848 has_seen_constructor_ = true;
3847 return; 3849 return;
3848 } 3850 }
3849 } 3851 }
3850 } } // v8::internal 3852 } } // v8::internal
3851 3853
3852 #endif // V8_PREPARSER_H 3854 #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