diff options
-rw-r--r-- | src/wast-parser.cc | 2 | ||||
-rw-r--r-- | test/regress/empty-quoted-module.txt | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/wast-parser.cc b/src/wast-parser.cc index a596f018..11d0d338 100644 --- a/src/wast-parser.cc +++ b/src/wast-parser.cc @@ -720,6 +720,7 @@ void WastParser::ErrorUnlessOpcodeEnabled(const Token& token) { Result WastParser::ErrorExpected(const std::vector<std::string>& expected, const char* example) { + GetToken(); Token token = Consume(); std::string expected_str; if (!expected.empty()) { @@ -752,7 +753,6 @@ Result WastParser::ErrorExpected(const std::vector<std::string>& expected, Result WastParser::ErrorIfLpar(const std::vector<std::string>& expected, const char* example) { if (Match(TokenType::Lpar)) { - GetToken(); return ErrorExpected(expected, example); } return Result::Ok; diff --git a/test/regress/empty-quoted-module.txt b/test/regress/empty-quoted-module.txt new file mode 100644 index 00000000..ca7bf6ad --- /dev/null +++ b/test/regress/empty-quoted-module.txt @@ -0,0 +1,6 @@ +;;; TOOL: wat2wasm +;;; ERROR: 1 +(module quote "") +(;; STDERR ;;; +out/test/regress/empty-quoted-module.txt:4:1: error: unexpected token "EOF", expected a binary module or a text module. +;;; STDERR ;;) |