summaryrefslogtreecommitdiff
path: root/src/wast-parser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/wast-parser.cc')
-rw-r--r--src/wast-parser.cc29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/wast-parser.cc b/src/wast-parser.cc
index a3d2df53..a5edc6e3 100644
--- a/src/wast-parser.cc
+++ b/src/wast-parser.cc
@@ -222,7 +222,6 @@ bool IsCommand(TokenTypePair pair) {
case TokenType::AssertInvalid:
case TokenType::AssertMalformed:
case TokenType::AssertReturn:
- case TokenType::AssertReturnFunc:
case TokenType::AssertTrap:
case TokenType::AssertUnlinkable:
case TokenType::Get:
@@ -1733,8 +1732,11 @@ Result WastParser::ParsePlainInstr(std::unique_ptr<Expr>* out_expr) {
Var dst(0);
Var src(0);
if (options_->features.reference_types_enabled()) {
+ // TODO: disabled for now, since the spec tests don't currently use.
+#if 0
CHECK_RESULT(ParseVar(&dst));
CHECK_RESULT(ParseVar(&src));
+#endif
}
out_expr->reset(new TableCopyExpr(dst, src, loc));
break;
@@ -2174,7 +2176,8 @@ Result WastParser::ParseHostRef(Const* const_) {
Result WastParser::ParseConstList(ConstVector* consts, ConstType type) {
WABT_TRACE(ParseConstList);
while (PeekMatchLpar(TokenType::Const) || PeekMatchLpar(TokenType::RefNull) ||
- PeekMatchLpar(TokenType::RefHost)) {
+ PeekMatchLpar(TokenType::RefHost) ||
+ PeekMatchLpar(TokenType::RefFunc)) {
Consume();
Const const_;
switch (Peek()) {
@@ -2189,6 +2192,14 @@ Result WastParser::ParseConstList(ConstVector* consts, ConstType type) {
const_.ref_bits = 0;
break;
}
+ case TokenType::RefFunc: {
+ auto token = Consume();
+ ErrorUnlessOpcodeEnabled(token);
+ const_.loc = GetLocation();
+ const_.type = Type::Funcref;
+ const_.ref_bits = 0;
+ break;
+ }
case TokenType::RefHost:
CHECK_RESULT(ParseHostRef(&const_));
break;
@@ -2476,9 +2487,6 @@ Result WastParser::ParseCommand(Script* script, CommandPtr* out_command) {
case TokenType::AssertReturn:
return ParseAssertReturnCommand(out_command);
- case TokenType::AssertReturnFunc:
- return ParseAssertReturnFuncCommand(out_command);
-
case TokenType::AssertTrap:
return ParseAssertTrapCommand(out_command);
@@ -2531,17 +2539,6 @@ Result WastParser::ParseAssertReturnCommand(CommandPtr* out_command) {
return Result::Ok;
}
-Result WastParser::ParseAssertReturnFuncCommand(CommandPtr* out_command) {
- WABT_TRACE(ParseAssertReturnFuncCommand);
- EXPECT(Lpar);
- EXPECT(AssertReturnFunc);
- auto command = MakeUnique<AssertReturnFuncCommand>();
- CHECK_RESULT(ParseAction(&command->action));
- EXPECT(Rpar);
- *out_command = std::move(command);
- return Result::Ok;
-}
-
Result WastParser::ParseAssertTrapCommand(CommandPtr* out_command) {
WABT_TRACE(ParseAssertTrapCommand);
EXPECT(Lpar);