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

Side by Side Diff: src/preparser.h

Issue 1134453002: Revert of Remove Scope::scope_uses_arguments_ flag (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 | « no previous file | src/scopes.h » ('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 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 // TODO(dslomov): allow 'undefined' in nested patterns. 2064 // TODO(dslomov): allow 'undefined' in nested patterns.
2065 classifier->RecordBindingPatternError(scanner()->location(), 2065 classifier->RecordBindingPatternError(scanner()->location(),
2066 "strong_undefined"); 2066 "strong_undefined");
2067 classifier->RecordAssignmentPatternError(scanner()->location(), 2067 classifier->RecordAssignmentPatternError(scanner()->location(),
2068 "strong_undefined"); 2068 "strong_undefined");
2069 } 2069 }
2070 if (is_strong(language_mode()) && this->IsArguments(name)) { 2070 if (is_strong(language_mode()) && this->IsArguments(name)) {
2071 classifier->RecordExpressionError(scanner()->location(), 2071 classifier->RecordExpressionError(scanner()->location(),
2072 "strong_arguments"); 2072 "strong_arguments");
2073 } 2073 }
2074 if (this->IsArguments(name)) scope_->RecordArgumentsUsage();
2074 return name; 2075 return name;
2075 } else if (is_sloppy(language_mode()) && 2076 } else if (is_sloppy(language_mode()) &&
2076 (next == Token::FUTURE_STRICT_RESERVED_WORD || 2077 (next == Token::FUTURE_STRICT_RESERVED_WORD ||
2077 next == Token::LET || next == Token::STATIC || 2078 next == Token::LET || next == Token::STATIC ||
2078 (next == Token::YIELD && !is_generator()))) { 2079 (next == Token::YIELD && !is_generator()))) {
2079 return this->GetSymbol(scanner()); 2080 return this->GetSymbol(scanner());
2080 } else { 2081 } else {
2081 this->ReportUnexpectedToken(next); 2082 this->ReportUnexpectedToken(next);
2082 *ok = false; 2083 *ok = false;
2083 return Traits::EmptyIdentifier(); 2084 return Traits::EmptyIdentifier();
(...skipping 12 matching lines...) Expand all
2096 next == Token::STATIC || 2097 next == Token::STATIC ||
2097 (next == Token::YIELD && !this->is_generator())) { 2098 (next == Token::YIELD && !this->is_generator())) {
2098 *is_strict_reserved = true; 2099 *is_strict_reserved = true;
2099 } else { 2100 } else {
2100 ReportUnexpectedToken(next); 2101 ReportUnexpectedToken(next);
2101 *ok = false; 2102 *ok = false;
2102 return Traits::EmptyIdentifier(); 2103 return Traits::EmptyIdentifier();
2103 } 2104 }
2104 2105
2105 IdentifierT name = this->GetSymbol(scanner()); 2106 IdentifierT name = this->GetSymbol(scanner());
2107 if (this->IsArguments(name)) scope_->RecordArgumentsUsage();
2106 return name; 2108 return name;
2107 } 2109 }
2108 2110
2109 2111
2110 template <class Traits> 2112 template <class Traits>
2111 typename ParserBase<Traits>::IdentifierT 2113 typename ParserBase<Traits>::IdentifierT
2112 ParserBase<Traits>::ParseIdentifierName(bool* ok) { 2114 ParserBase<Traits>::ParseIdentifierName(bool* ok) {
2113 Token::Value next = Next(); 2115 Token::Value next = Next();
2114 if (next != Token::IDENTIFIER && next != Token::FUTURE_RESERVED_WORD && 2116 if (next != Token::IDENTIFIER && next != Token::FUTURE_RESERVED_WORD &&
2115 next != Token::LET && next != Token::STATIC && next != Token::YIELD && 2117 next != Token::LET && next != Token::STATIC && next != Token::YIELD &&
2116 next != Token::FUTURE_STRICT_RESERVED_WORD && !Token::IsKeyword(next)) { 2118 next != Token::FUTURE_STRICT_RESERVED_WORD && !Token::IsKeyword(next)) {
2117 this->ReportUnexpectedToken(next); 2119 this->ReportUnexpectedToken(next);
2118 *ok = false; 2120 *ok = false;
2119 return Traits::EmptyIdentifier(); 2121 return Traits::EmptyIdentifier();
2120 } 2122 }
2121 2123
2122 IdentifierT name = this->GetSymbol(scanner()); 2124 IdentifierT name = this->GetSymbol(scanner());
2125 if (this->IsArguments(name)) scope_->RecordArgumentsUsage();
2123 return name; 2126 return name;
2124 } 2127 }
2125 2128
2126 2129
2127 template <class Traits> 2130 template <class Traits>
2128 typename ParserBase<Traits>::IdentifierT 2131 typename ParserBase<Traits>::IdentifierT
2129 ParserBase<Traits>::ParseIdentifierNameOrGetOrSet(bool* is_get, 2132 ParserBase<Traits>::ParseIdentifierNameOrGetOrSet(bool* is_get,
2130 bool* is_set, 2133 bool* is_set,
2131 bool* ok) { 2134 bool* ok) {
2132 IdentifierT result = ParseIdentifierName(ok); 2135 IdentifierT result = ParseIdentifierName(ok);
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after
3835 *ok = false; 3838 *ok = false;
3836 return; 3839 return;
3837 } 3840 }
3838 has_seen_constructor_ = true; 3841 has_seen_constructor_ = true;
3839 return; 3842 return;
3840 } 3843 }
3841 } 3844 }
3842 } } // v8::internal 3845 } } // v8::internal
3843 3846
3844 #endif // V8_PREPARSER_H 3847 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « no previous file | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698