瀏覽代碼

[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 年之前
父節點
當前提交
18c78e1465
共有 1 個文件被更改,包括 18 次插入0 次删除
  1. 18 0
      utils/wasmbin/wasmmodule.pas

+ 18 - 0
utils/wasmbin/wasmmodule.pas

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