Browse Source

[PATCH 119/188] adding jump label for the block instructions

From ab6e29ce727c317aaa7cb02414ccfc43280fd7af Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Wed, 18 Mar 2020 15:15:34 -0400

git-svn-id: branches/wasm@46115 -
nickysn 5 years ago
parent
commit
7f6bc39369
2 changed files with 7 additions and 0 deletions
  1. 2 0
      utils/wasmbin/wasmmodule.pas
  2. 5 0
      utils/wasmbin/watparser.pas

+ 2 - 0
utils/wasmbin/wasmmodule.pas

@@ -80,6 +80,8 @@ type
     operandText : string;
     insttype    : TWasmFuncType; // used by call_indirect only
 
+    jumplabel   : string;   // the label is used only for "loop", "block" and "if"
+
     hasRelocIdx : Boolean;
     relocIdx    : integer;
     relocType   : Byte;

+ 5 - 0
utils/wasmbin/watparser.pas

@@ -263,6 +263,11 @@ begin
       //ipTable,   // a complex structure... used for br_table only
       ipResType:  // result type used for blocks, such as If, block or loop
       begin
+        if sc.token = weIdent then begin
+          ci.jumplabel := sc.resText;
+          sc.Next;
+        end;
+
         if (sc.token = weOpenBrace) then begin
           ConsumeToken(sc, weOpenBrace);
           ConsumeToken(sc, weResult);