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

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: mjsunit/debug-scopes: Skip "this" the same as "arguments" 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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 bool AllowsLazyCompilation() const { return false; } 1023 bool AllowsLazyCompilation() const { return false; }
1024 1024
1025 void set_start_position(int position) {} 1025 void set_start_position(int position) {}
1026 void set_end_position(int position) {} 1026 void set_end_position(int position) {}
1027 1027
1028 bool IsDeclared(const PreParserIdentifier& identifier) const { return false; } 1028 bool IsDeclared(const PreParserIdentifier& identifier) const { return false; }
1029 void DeclareParameter(const PreParserIdentifier& identifier, VariableMode) {} 1029 void DeclareParameter(const PreParserIdentifier& identifier, VariableMode) {}
1030 void RecordArgumentsUsage() {} 1030 void RecordArgumentsUsage() {}
1031 void RecordSuperPropertyUsage() {} 1031 void RecordSuperPropertyUsage() {}
1032 void RecordSuperConstructorCallUsage() {} 1032 void RecordSuperConstructorCallUsage() {}
1033 void RecordThisUsage() {}
1034 1033
1035 // Allow scope->Foo() to work. 1034 // Allow scope->Foo() to work.
1036 PreParserScope* operator->() { return this; } 1035 PreParserScope* operator->() { return this; }
1037 1036
1038 private: 1037 private:
1039 ScopeType scope_type_; 1038 ScopeType scope_type_;
1040 StrictMode strict_mode_; 1039 StrictMode strict_mode_;
1041 }; 1040 };
1042 1041
1043 1042
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 // ClassLiteral 1858 // ClassLiteral
1860 // '(' Expression ')' 1859 // '(' Expression ')'
1861 // TemplateLiteral 1860 // TemplateLiteral
1862 1861
1863 int pos = peek_position(); 1862 int pos = peek_position();
1864 ExpressionT result = this->EmptyExpression(); 1863 ExpressionT result = this->EmptyExpression();
1865 Token::Value token = peek(); 1864 Token::Value token = peek();
1866 switch (token) { 1865 switch (token) {
1867 case Token::THIS: { 1866 case Token::THIS: {
1868 Consume(Token::THIS); 1867 Consume(Token::THIS);
1869 scope_->RecordThisUsage();
1870 result = this->ThisExpression(scope_, factory()); 1868 result = this->ThisExpression(scope_, factory());
1871 break; 1869 break;
1872 } 1870 }
1873 1871
1874 case Token::NULL_LITERAL: 1872 case Token::NULL_LITERAL:
1875 case Token::TRUE_LITERAL: 1873 case Token::TRUE_LITERAL:
1876 case Token::FALSE_LITERAL: 1874 case Token::FALSE_LITERAL:
1877 case Token::NUMBER: 1875 case Token::NUMBER:
1878 Next(); 1876 Next();
1879 result = this->ExpressionFromLiteral(token, pos, scanner(), factory()); 1877 result = this->ExpressionFromLiteral(token, pos, scanner(), factory());
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
3068 *ok = false; 3066 *ok = false;
3069 return; 3067 return;
3070 } 3068 }
3071 has_seen_constructor_ = true; 3069 has_seen_constructor_ = true;
3072 return; 3070 return;
3073 } 3071 }
3074 } 3072 }
3075 } } // v8::internal 3073 } } // v8::internal
3076 3074
3077 #endif // V8_PREPARSER_H 3075 #endif // V8_PREPARSER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698