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.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wast-parser.cc b/src/wast-parser.cc
index 85258b37..3682d743 100644
--- a/src/wast-parser.cc
+++ b/src/wast-parser.cc
@@ -2011,7 +2011,12 @@ Result WastParser::ParseScriptModule(
auto tsm = MakeUnique<TextScriptModule>();
tsm->module.name = name;
tsm->module.loc = loc;
- CHECK_RESULT(ParseModuleFieldList(&tsm->module));
+ if (IsModuleField(PeekPair())) {
+ CHECK_RESULT(ParseModuleFieldList(&tsm->module));
+ } else if (!PeekMatch(TokenType::Rpar)) {
+ ConsumeIfLpar();
+ return ErrorExpected({"a module field"});
+ }
*out_module = std::move(tsm);
break;
}