diff options
author | Sam Clegg <sbc@chromium.org> | 2019-11-26 09:45:14 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-26 09:45:14 -0600 |
commit | f1716357df721cbbaeacfcf8b1e7a12d4cb99459 (patch) | |
tree | f34fc05f9963956db564904c4ebe7abfabb67d05 /src/wast-parser.cc | |
parent | 4386b19e2854e8d5f303bd7236a20092ff77cb9a (diff) | |
download | wabt-f1716357df721cbbaeacfcf8b1e7a12d4cb99459.tar.gz wabt-f1716357df721cbbaeacfcf8b1e7a12d4cb99459.tar.bz2 wabt-f1716357df721cbbaeacfcf8b1e7a12d4cb99459.zip |
reference-types: add support for typed select (#1253)
Diffstat (limited to 'src/wast-parser.cc')
-rw-r--r-- | src/wast-parser.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/wast-parser.cc b/src/wast-parser.cc index 3a1042da..635b1b3a 100644 --- a/src/wast-parser.cc +++ b/src/wast-parser.cc @@ -1533,10 +1533,19 @@ Result WastParser::ParsePlainInstr(std::unique_ptr<Expr>* out_expr) { out_expr->reset(new DropExpr(loc)); break; - case TokenType::Select: + case TokenType::Select: { Consume(); - out_expr->reset(new SelectExpr(loc)); + TypeVector result; + if (options_->features.reference_types_enabled() && + MatchLpar(TokenType::Result)) { + CHECK_RESULT(ParseValueTypeList(&result)); + EXPECT(Rpar); + } else { + result.push_back(Type::Any); + } + out_expr->reset(new SelectExpr(result, loc)); break; + } case TokenType::Br: Consume(); |