Index: src/parsing/token.cc |
diff --git a/src/parsing/token.cc b/src/parsing/token.cc |
index 7edfefa82100c16a11db2773e18b4f3211e34ffd..35038ba766d67d352b4d8d67a59ca01d676c6129 100644 |
--- a/src/parsing/token.cc |
+++ b/src/parsing/token.cc |
@@ -22,6 +22,16 @@ const char* const Token::string_[NUM_TOKENS] = { |
}; |
#undef T |
+#if !V8_CC_MSVC |
+// TODO(vogelheim): Remove #if once MSVC supports constexpr on functions. |
+constexpr |
+#endif |
+uint8_t length(const char* str) { |
+ return str ? static_cast<uint8_t>(strlen(str)) : 0; |
+} |
+#define T(name, string, precedence) length(string), |
+const uint8_t Token::string_length_[NUM_TOKENS] = {TOKEN_LIST(T, T)}; |
+#undef T |
#define T(name, string, precedence) precedence, |
const int8_t Token::precedence_[NUM_TOKENS] = { |