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

Unified Diff: src/token.h

Issue 584993002: ES6: Implement object literal property shorthand (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: git rebase Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/token.h
diff --git a/src/token.h b/src/token.h
index 9c719b827e328b339b37ea9f7358171e6742d6d7..bab925accecb0e3245247beb83f84c58f57ef510 100644
--- a/src/token.h
+++ b/src/token.h
@@ -6,6 +6,7 @@
#define V8_TOKEN_H_
#include "src/base/logging.h"
+#include "src/globals.h"
namespace v8 {
namespace internal {
@@ -187,6 +188,24 @@ class Token {
return token_type[tok] == 'K';
}
+ static bool IsIdentifier(Value tok, StrictMode strict_mode,
+ bool is_generator) {
+ switch (tok) {
+ case IDENTIFIER:
+ return true;
+ case FUTURE_STRICT_RESERVED_WORD:
+ case LET:
+ case STATIC:
+ return strict_mode == SLOPPY;
+ case YIELD:
+ return !is_generator && strict_mode == SLOPPY;
+ default:
+ return false;
+ }
+ UNREACHABLE();
+ return false;
+ }
+
static bool IsAssignmentOp(Value tok) {
return INIT_VAR <= tok && tok <= ASSIGN_MOD;
}
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698