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

Side by Side Diff: src/preparser.h

Issue 883823002: Implement proper scoping for "this" in arrow functions Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make sure an unresolved VariableProxy for "this" is not considered a valid LHS Created 5 years, 10 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
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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 bool AllowsLazyCompilation() const { return false; } 1012 bool AllowsLazyCompilation() const { return false; }
1013 1013
1014 void set_start_position(int position) {} 1014 void set_start_position(int position) {}
1015 void set_end_position(int position) {} 1015 void set_end_position(int position) {}
1016 1016
1017 bool IsDeclared(const PreParserIdentifier& identifier) const { return false; } 1017 bool IsDeclared(const PreParserIdentifier& identifier) const { return false; }
1018 void DeclareParameter(const PreParserIdentifier& identifier, VariableMode) {} 1018 void DeclareParameter(const PreParserIdentifier& identifier, VariableMode) {}
1019 void RecordArgumentsUsage() {} 1019 void RecordArgumentsUsage() {}
1020 void RecordSuperPropertyUsage() {} 1020 void RecordSuperPropertyUsage() {}
1021 void RecordSuperConstructorCallUsage() {} 1021 void RecordSuperConstructorCallUsage() {}
1022 void RecordThisUsage() {}
1023 1022
1024 // Allow scope->Foo() to work. 1023 // Allow scope->Foo() to work.
1025 PreParserScope* operator->() { return this; } 1024 PreParserScope* operator->() { return this; }
1026 1025
1027 private: 1026 private:
1028 ScopeType scope_type_; 1027 ScopeType scope_type_;
1029 StrictMode strict_mode_; 1028 StrictMode strict_mode_;
1030 }; 1029 };
1031 1030
1032 1031
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 // ClassLiteral 1847 // ClassLiteral
1849 // '(' Expression ')' 1848 // '(' Expression ')'
1850 // TemplateLiteral 1849 // TemplateLiteral
1851 1850
1852 int pos = peek_position(); 1851 int pos = peek_position();
1853 ExpressionT result = this->EmptyExpression(); 1852 ExpressionT result = this->EmptyExpression();
1854 Token::Value token = peek(); 1853 Token::Value token = peek();
1855 switch (token) { 1854 switch (token) {
1856 case Token::THIS: { 1855 case Token::THIS: {
1857 Consume(Token::THIS); 1856 Consume(Token::THIS);
1858 scope_->RecordThisUsage();
1859 result = this->ThisExpression(scope_, factory()); 1857 result = this->ThisExpression(scope_, factory());
1860 break; 1858 break;
1861 } 1859 }
1862 1860
1863 case Token::NULL_LITERAL: 1861 case Token::NULL_LITERAL:
1864 case Token::TRUE_LITERAL: 1862 case Token::TRUE_LITERAL:
1865 case Token::FALSE_LITERAL: 1863 case Token::FALSE_LITERAL:
1866 case Token::NUMBER: 1864 case Token::NUMBER:
1867 Next(); 1865 Next();
1868 result = this->ExpressionFromLiteral(token, pos, scanner(), factory()); 1866 result = this->ExpressionFromLiteral(token, pos, scanner(), factory());
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 DCHECK(IsAccessorAccessorConflict(old_type, type)); 3059 DCHECK(IsAccessorAccessorConflict(old_type, type));
3062 // Both accessors of the same type. 3060 // Both accessors of the same type.
3063 parser()->ReportMessage("accessor_get_set"); 3061 parser()->ReportMessage("accessor_get_set");
3064 } 3062 }
3065 *ok = false; 3063 *ok = false;
3066 } 3064 }
3067 } 3065 }
3068 } } // v8::internal 3066 } } // v8::internal
3069 3067
3070 #endif // V8_PREPARSER_H 3068 #endif // V8_PREPARSER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698