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; |
} |