rollback some of wrong code from prev commit

This commit is contained in:
Egor Aristov 2025-12-06 11:24:49 +03:00
parent fd02618c2f
commit f8d55b230d
Signed by: egor3f
GPG Key ID: 40482A264AAEC85F
3 changed files with 1 additions and 9 deletions

View File

@ -10,16 +10,12 @@ export default class GoIpcApi {
} }
async Div(a: number, b: number): Promise<number> { async Div(a: number, b: number): Promise<number> {
a = this.ipc.convType(a, "number");
b = this.ipc.convType(b, "number");
const results = await this.ipc.call("GoIpcApi.Div", a, b); const results = await this.ipc.call("GoIpcApi.Div", a, b);
results[0] = this.ipc.convType(results[0], "number"); results[0] = this.ipc.convType(results[0], "number");
return results[0] as number; return results[0] as number;
} }
async XorData(data1: Buffer, data2: Buffer): Promise<Buffer> { async XorData(data1: Buffer, data2: Buffer): Promise<Buffer> {
data1 = this.ipc.convType(data1, "Buffer");
data2 = this.ipc.convType(data2, "Buffer");
const results = await this.ipc.call("GoIpcApi.XorData", data1, data2); const results = await this.ipc.call("GoIpcApi.XorData", data1, data2);
results[0] = this.ipc.convType(results[0], "Buffer"); results[0] = this.ipc.convType(results[0], "Buffer");
return results[0] as Buffer; return results[0] as Buffer;

View File

@ -16,11 +16,6 @@ export default class {{ $e.Name }} {
async {{ $mtd.Name }}( async {{ $mtd.Name }}(
{{ range $par := $mtd.Params }}{{ $par.Name }}: {{ $par.Type | typedef }}, {{ end }} {{ range $par := $mtd.Params }}{{ $par.Name }}: {{ $par.Type | typedef }}, {{ end }}
): Promise<{{ if len $mtd.Ret }}{{ (index $mtd.Ret 0).Type | typedef }}{{ else }}void{{ end }}> { ): Promise<{{ if len $mtd.Ret }}{{ (index $mtd.Ret 0).Type | typedef }}{{ else }}void{{ end }}> {
{{ range $par := $mtd.Params -}}
{{ $par.Name }} = this.ipc.convType({{ $par.Name }}, '{{ $par.Type | typedef }}');
{{- end -}}
const results = await this.ipc.call('{{ $e.Name }}.{{ $mtd.Name }}', const results = await this.ipc.call('{{ $e.Name }}.{{ $mtd.Name }}',
{{ range $par := $mtd.Params }}{{ $par.Name }}, {{ end }} {{ range $par := $mtd.Params }}{{ $par.Name }}, {{ end }}
); );

View File

@ -146,6 +146,7 @@ abstract class IPCCommon {
if (result instanceof Promise) { if (result instanceof Promise) {
result = await result; result = await result;
} }
result = this.convType(result);
this.sendMsg({type: MsgType.Response, id: msg.id, result: [result]}); this.sendMsg({type: MsgType.Response, id: msg.id, result: [result]});
} catch (err) { } catch (err) {
this.sendMsg({type: MsgType.Response, id: msg.id, error: `${ err }`}); this.sendMsg({type: MsgType.Response, id: msg.id, error: `${ err }`});