Browse Source

[PATCH 047/188] adding type for a wasm instruction

From 327446334d76d0c0c242259447b031766e4373c1 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Thu, 21 Nov 2019 10:24:50 -0500

git-svn-id: branches/wasm@46043 -
nickysn 5 years ago
parent
commit
160b9a3e92
1 changed files with 19 additions and 0 deletions
  1. 19 0
      utils/wasmbin/wasmmodule.pas

+ 19 - 0
utils/wasmbin/wasmmodule.pas

@@ -37,11 +37,16 @@ type
     function isExplicitRef: Boolean;
     function isExplicitRef: Boolean;
   end;
   end;
 
 
+  { TWasmInstr }
+
   TWasmInstr = class(TObject)
   TWasmInstr = class(TObject)
     code        : byte;
     code        : byte;
     operandIdx  : string;
     operandIdx  : string;
     operandNum  : integer;
     operandNum  : integer;
     operandText : string;
     operandText : string;
+    insttype : TWasmFuncType; // used by call_indirect only
+    function addInstType: TWasmFuncType;
+    destructor Destroy; override;
   end;
   end;
 
 
   { TWasmInstrList }
   { TWasmInstrList }
@@ -117,6 +122,20 @@ begin
   l.Clear;
   l.Clear;
 end;
 end;
 
 
+{ TWasmInstr }
+
+function TWasmInstr.addInstType: TWasmFuncType;
+begin
+  if insttype=nil then insttype := TWasmFuncType.Create;
+  result:=insttype;
+end;
+
+destructor TWasmInstr.Destroy;
+begin
+  insttype.Free;
+  inherited Destroy;
+end;
+
 { TWasmInstrList }
 { TWasmInstrList }
 
 
 function TWasmInstrList.GetItem(i: integer): TWasmInstr;
 function TWasmInstrList.GetItem(i: integer): TWasmInstr;