mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 11:26:33 +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;
|
NoStrip : Boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TExportInfo = record
|
||||||
|
isExport : Boolean;
|
||||||
|
name : string;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWasmParam }
|
{ TWasmParam }
|
||||||
|
|
||||||
TWasmParam = class(TObject)
|
TWasmParam = class(TObject)
|
||||||
@ -114,10 +119,21 @@ type
|
|||||||
constructor Create;
|
constructor Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TWasmImport }
|
||||||
|
|
||||||
|
TWasmImport = class(TObject)
|
||||||
|
LinkInfo : TLinkInfo;
|
||||||
|
module : string;
|
||||||
|
name : string;
|
||||||
|
fn : TWasmFunc;
|
||||||
|
function AddFunc: TWasmFunc;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWasmModule }
|
{ TWasmModule }
|
||||||
|
|
||||||
TWasmModule = class(TObject)
|
TWasmModule = class(TObject)
|
||||||
private
|
private
|
||||||
|
imports : TList;
|
||||||
types : TList;
|
types : TList;
|
||||||
funcs : TList;
|
funcs : TList;
|
||||||
exp : TList;
|
exp : TList;
|
||||||
@ -125,6 +141,9 @@ type
|
|||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
|
function AddImport: TWasmImport;
|
||||||
|
function ImportCount: Integer;
|
||||||
|
|
||||||
function AddFunc: TWasmFunc;
|
function AddFunc: TWasmFunc;
|
||||||
function GetFunc(i: integer): TWasmFunc;
|
function GetFunc(i: integer): TWasmFunc;
|
||||||
function FuncCount: integer;
|
function FuncCount: integer;
|
||||||
@ -205,6 +224,14 @@ begin
|
|||||||
l.Clear;
|
l.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TWasmImport }
|
||||||
|
|
||||||
|
function TWasmImport.AddFunc: TWasmFunc;
|
||||||
|
begin
|
||||||
|
if not Assigned(fn) then fn:= TWasmFunc.Create;
|
||||||
|
Result:=fn;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWasmExport }
|
{ TWasmExport }
|
||||||
|
|
||||||
constructor TWasmExport.Create;
|
constructor TWasmExport.Create;
|
||||||
@ -371,10 +398,13 @@ begin
|
|||||||
types := TList.Create;
|
types := TList.Create;
|
||||||
funcs := TList.Create;
|
funcs := TList.Create;
|
||||||
exp := TList.Create;
|
exp := TList.Create;
|
||||||
|
imports := TList.Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TWasmModule.Destroy;
|
destructor TWasmModule.Destroy;
|
||||||
begin
|
begin
|
||||||
|
ClearList(imports);
|
||||||
|
imports.Free;
|
||||||
ClearList(exp);
|
ClearList(exp);
|
||||||
exp.Free;
|
exp.Free;
|
||||||
ClearList(types);
|
ClearList(types);
|
||||||
@ -384,6 +414,17 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
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;
|
function TWasmModule.AddFunc: TWasmFunc;
|
||||||
begin
|
begin
|
||||||
Result:=TWasmFunc.Create;
|
Result:=TWasmFunc.Create;
|
||||||
|
Loading…
Reference in New Issue
Block a user