mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 17:47:56 +02:00
+ added TWasmFuncType.ToString implementation
This commit is contained in:
parent
4f4beb6225
commit
52f0ec579e
@ -151,6 +151,7 @@ uses
|
||||
procedure add_param(param: TWasmBasicType);
|
||||
procedure add_result(res: TWasmBasicType);
|
||||
function Equals(Obj: TObject): boolean; override;
|
||||
function ToString: ansistring; override;
|
||||
end;
|
||||
|
||||
{# This should define the array of instructions as string }
|
||||
@ -677,4 +678,27 @@ uses
|
||||
Result:=inherited Equals(Obj);
|
||||
end;
|
||||
|
||||
function TWasmFuncType.ToString: ansistring;
|
||||
const
|
||||
wasm_basic_type_str : array [TWasmBasicType] of string = ('i32','i64','f32','f64','funcref','externref','v128');
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result:='(';
|
||||
for i:=0 to high(params) do
|
||||
begin
|
||||
if i<>0 then
|
||||
Result:=Result+', ';
|
||||
Result:=Result+wasm_basic_type_str[params[i]];
|
||||
end;
|
||||
Result:=Result+') -> (';
|
||||
for i:=0 to high(results) do
|
||||
begin
|
||||
if i<>0 then
|
||||
Result:=Result+', ';
|
||||
Result:=Result+wasm_basic_type_str[results[i]];
|
||||
end;
|
||||
Result:=Result+')';
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user