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

Side by Side Diff: src/token.h

Issue 894683003: Introduce LanguageMode, drop StrictMode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased (w/ conflicts) 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
« no previous file with comments | « src/scopes.cc ('k') | src/x64/full-codegen-x64.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_TOKEN_H_ 5 #ifndef V8_TOKEN_H_
6 #define V8_TOKEN_H_ 6 #define V8_TOKEN_H_
7 7
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 10
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 static const char* Name(Value tok) { 186 static const char* Name(Value tok) {
187 DCHECK(tok < NUM_TOKENS); // tok is unsigned 187 DCHECK(tok < NUM_TOKENS); // tok is unsigned
188 return name_[tok]; 188 return name_[tok];
189 } 189 }
190 190
191 // Predicates 191 // Predicates
192 static bool IsKeyword(Value tok) { 192 static bool IsKeyword(Value tok) {
193 return token_type[tok] == 'K'; 193 return token_type[tok] == 'K';
194 } 194 }
195 195
196 static bool IsIdentifier(Value tok, StrictMode strict_mode, 196 static bool IsIdentifier(Value tok, LanguageMode language_mode,
197 bool is_generator) { 197 bool is_generator) {
198 switch (tok) { 198 switch (tok) {
199 case IDENTIFIER: 199 case IDENTIFIER:
200 return true; 200 return true;
201 case FUTURE_STRICT_RESERVED_WORD: 201 case FUTURE_STRICT_RESERVED_WORD:
202 case LET: 202 case LET:
203 case STATIC: 203 case STATIC:
204 return strict_mode == SLOPPY; 204 return is_sloppy(language_mode);
205 case YIELD: 205 case YIELD:
206 return !is_generator && strict_mode == SLOPPY; 206 return !is_generator && is_sloppy(language_mode);
207 default: 207 default:
208 return false; 208 return false;
209 } 209 }
210 UNREACHABLE(); 210 UNREACHABLE();
211 return false; 211 return false;
212 } 212 }
213 213
214 static bool IsAssignmentOp(Value tok) { 214 static bool IsAssignmentOp(Value tok) {
215 return INIT_VAR <= tok && tok <= ASSIGN_MOD; 215 return INIT_VAR <= tok && tok <= ASSIGN_MOD;
216 } 216 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 private: 312 private:
313 static const char* const name_[NUM_TOKENS]; 313 static const char* const name_[NUM_TOKENS];
314 static const char* const string_[NUM_TOKENS]; 314 static const char* const string_[NUM_TOKENS];
315 static const int8_t precedence_[NUM_TOKENS]; 315 static const int8_t precedence_[NUM_TOKENS];
316 static const char token_type[NUM_TOKENS]; 316 static const char token_type[NUM_TOKENS];
317 }; 317 };
318 318
319 } } // namespace v8::internal 319 } } // namespace v8::internal
320 320
321 #endif // V8_TOKEN_H_ 321 #endif // V8_TOKEN_H_
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698