mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 20:09:25 +02:00
[PATCH 075/188] adding import section, and inline export information
From 3b0bab6d9ccf9602d575a41bddb69e5927882d5c Mon Sep 17 00:00:00 2001 From: Dmitry Boyarintsev <skalogryz.lists@gmail.com> Date: Fri, 6 Mar 2020 16:06:20 -0500 git-svn-id: branches/wasm@46071 -
This commit is contained in:
parent
707c3803df
commit
72433c672e
@ -20,6 +20,11 @@ type
|
||||
NoStrip : Boolean;
|
||||
end;
|
||||
|
||||
TExportInfo = record
|
||||
isExport : Boolean;
|
||||
name : string;
|
||||
end;
|
||||
|
||||
{ TWasmParam }
|
||||
|
||||
TWasmParam = class(TObject)
|
||||
@ -114,10 +119,21 @@ type
|
||||
constructor Create;
|
||||
end;
|
||||
|
||||
{ TWasmImport }
|
||||
|
||||
TWasmImport = class(TObject)
|
||||
LinkInfo : TLinkInfo;
|
||||
module : string;
|
||||
name : string;
|
||||
fn : TWasmFunc;
|
||||
function AddFunc: TWasmFunc;
|
||||
end;
|
||||
|
||||
{ TWasmModule }
|
||||
|
||||
TWasmModule = class(TObject)
|
||||
private
|
||||
imports : TList;
|
||||
types : TList;
|
||||
funcs : TList;
|
||||
exp : TList;
|
||||
@ -125,6 +141,9 @@ type
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
|
||||
function AddImport: TWasmImport;
|
||||
function ImportCount: Integer;
|
||||
|
||||
function AddFunc: TWasmFunc;
|
||||
function GetFunc(i: integer): TWasmFunc;
|
||||
function FuncCount: integer;
|
||||
@ -205,6 +224,14 @@ begin
|
||||
l.Clear;
|
||||
end;
|
||||
|
||||
{ TWasmImport }
|
||||
|
||||
function TWasmImport.AddFunc: TWasmFunc;
|
||||
begin
|
||||
if not Assigned(fn) then fn:= TWasmFunc.Create;
|
||||
Result:=fn;
|
||||
end;
|
||||
|
||||
{ TWasmExport }
|
||||
|
||||
constructor TWasmExport.Create;
|
||||
@ -371,10 +398,13 @@ begin
|
||||
types := TList.Create;
|
||||
funcs := TList.Create;
|
||||
exp := TList.Create;
|
||||
imports := TList.Create;
|
||||
end;
|
||||
|
||||
destructor TWasmModule.Destroy;
|
||||
begin
|
||||
ClearList(imports);
|
||||
imports.Free;
|
||||
ClearList(exp);
|
||||
exp.Free;
|
||||
ClearList(types);
|
||||
@ -384,6 +414,17 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TWasmModule.AddImport: TWasmImport;
|
||||
begin
|
||||
Result:=TWasmImport.Create;
|
||||
imports.Add(Result);
|
||||
end;
|
||||
|
||||
function TWasmModule.ImportCount: Integer;
|
||||
begin
|
||||
Result:=imports.Count;
|
||||
end;
|
||||
|
||||
function TWasmModule.AddFunc: TWasmFunc;
|
||||
begin
|
||||
Result:=TWasmFunc.Create;
|
||||
|
Loading…
Reference in New Issue
Block a user