diff options
Diffstat (limited to 'src/token.h')
-rw-r--r-- | src/token.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/token.h b/src/token.h index 8a3b1f00..719e1aee 100644 --- a/src/token.h +++ b/src/token.h @@ -41,7 +41,7 @@ enum class TokenType { #undef WABT_TOKEN_LAST First = First_Bare, - Last = Last_Type, + Last = Last_RefKind, }; const char* GetTokenTypeName(TokenType); @@ -70,6 +70,11 @@ inline bool IsTokenTypeLiteral(TokenType token_type) { token_type <= TokenType::Last_Literal; } +inline bool IsTokenTypeRefKind(TokenType token_type) { + return token_type >= TokenType::First_RefKind && + token_type <= TokenType::Last_RefKind; +} + struct Token { Token() : token_type_(TokenType::Invalid) {} Token(Location, TokenType); @@ -83,7 +88,9 @@ struct Token { TokenType token_type() const { return token_type_; } bool HasText() const { return IsTokenTypeString(token_type_); } - bool HasType() const { return IsTokenTypeType(token_type_); } + bool HasType() const { + return IsTokenTypeType(token_type_) || IsTokenTypeRefKind(token_type_); + } bool HasOpcode() const { return IsTokenTypeOpcode(token_type_); } bool HasLiteral() const { return IsTokenTypeLiteral(token_type_); } |