Browse Source

[PATCH 137/188] parsing anonymous local variables declaration

From 59d381d7192f2953e268da6a21b3c9107631638d Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Wed, 25 Mar 2020 10:17:15 -0400

git-svn-id: branches/wasm@46133 -
nickysn 5 years ago
parent
commit
afb9a8008e
1 changed files with 13 additions and 2 deletions
  1. 13 2
      utils/wasmbin/watparser.pas

+ 13 - 2
utils/wasmbin/watparser.pas

@@ -348,13 +348,24 @@ begin
 
 
   ConsumeAnyOpenToken(sc, tk);
   ConsumeAnyOpenToken(sc, tk);
 
 
-  if tk in [weType, weParam, weResult] then
+  if tk in [weType, weParam, weResult] then begin
     ParseTypeUse(sc, dst.functype, true);
     ParseTypeUse(sc, dst.functype, true);
+    ConsumeAnyOpenToken(sc, tk);
+  end;
 
 
   while tk = weLocal do begin
   while tk = weLocal do begin
     p:=dst.AddLocal;
     p:=dst.AddLocal;
     sc.Next;
     sc.Next;
-    ParseParam(sc, p.id, p.tp);
+    ParseParam(sc, p.id, p.tp, true, false);
+    if p.id = '' then begin
+      while sc.token in WasmTypeTokens do begin
+        p:=dst.AddLocal;
+        TokenTypeToValType(sc.token, p.tp);
+        sc.Next;
+      end;
+    end;
+    if sc.token=weCloseBrace then sc.Next;
+
     ConsumeAnyOpenToken(sc, tk);
     ConsumeAnyOpenToken(sc, tk);
   end;
   end;