Browse Source

[PATCH 040/188] proper objects allocation

From 56d965ec422be5f5487522acbf335ee2f21a3dd4 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Wed, 20 Nov 2019 12:28:05 -0500

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

+ 18 - 0
utils/wasmbin/wasmmodule.pas

@@ -18,6 +18,8 @@ type
     params : TList;
     results : TList;
   public
+    constructor Create;
+    destructor Destroy; override;
     function AddResult(tp: byte = 0): TWasmParam;
     function AddParam(tp: byte = 0; const id: string = ''): TWasmParam;
     function GetParam(i: integer): TWasmParam;
@@ -76,6 +78,22 @@ end;
 
 { TWasmType }
 
+constructor TWasmType.Create;
+begin
+  inherited Create;
+  params:=Tlist.Create;
+  results:=Tlist.Create;
+end;
+
+destructor TWasmType.Destroy;
+begin
+  ClearList(params);
+  ClearList(results);
+  params.free;
+  results.free;
+  inherited Destroy;
+end;
+
 function TWasmType.AddResult(tp: byte): TWasmParam;
 begin
   Result:=TWasmParam.Create;