[PATCH 177/188] update parsing of module level elements

From ee529729a987fda74c312a4e49e8246f127920ce Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <skalogryz.lists@gmail.com>
Date: Wed, 8 Apr 2020 11:58:48 -0400

git-svn-id: branches/wasm@46173 -
This commit is contained in:
nickysn 2020-08-03 13:02:08 +00:00
parent 2168969b3f
commit cdc7401d91

View File

@ -593,13 +593,9 @@ begin
if sc.token = weElem then sc.Next; if sc.token = weElem then sc.Next;
if parseIdOffset then begin if parseIdOffset then begin
if sc.token<>weIdent then ParseId(sc, dst.tableId);
ErrorExpectButFound(sc, 'identifier');
dst.tableIdx := sc.resInt32;
sc.Next;
if (sc.token = weOpenBrace) then begin if (sc.token = weOpenBrace) then begin
sc.Next;
ParseInstrList(sc, dst.AddOffset); ParseInstrList(sc, dst.AddOffset);
ConsumeToken(sc, weCloseBrace); ConsumeToken(sc, weCloseBrace);
end; end;
@ -679,6 +675,7 @@ var
imp : TWasmImport; imp : TWasmImport;
m : TWasmMemory; m : TWasmMemory;
g : TWasmGlobal; g : TWasmGlobal;
e : TWasmElement;
begin begin
if not ConsumeOpenToken(sc, weModule) then if not ConsumeOpenToken(sc, weModule) then
ErrorExpectButFound(sc, 'module'); ErrorExpectButFound(sc, 'module');
@ -732,6 +729,11 @@ begin
symlist.Clear; symlist.Clear;
ParseGlobal(sc, g); ParseGlobal(sc, g);
end; end;
weElem: begin
e:=dst.AddElement;
symlist.Clear;
ParseElem(sc, e, true);
end;
else else
ErrorExpectButFound(sc, 'func', TokenStr[sc.token]); ErrorExpectButFound(sc, 'func', TokenStr[sc.token]);
end; end;