mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-04-25 13:12:16 +00:00
bug with arguments
This commit is contained in:
parent
3d3280d2e7
commit
18771e655d
@ -11,3 +11,6 @@ func passFunctionAsArg(node: string, str: string, c: string -> string):
|
|||||||
-- then return on a node
|
-- then return on a node
|
||||||
Peer.identify()
|
Peer.identify()
|
||||||
print(res)
|
print(res)
|
||||||
|
|
||||||
|
func reproArgsBug426(log: string -> (), arg: string):
|
||||||
|
log(arg)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {Fluence, FluencePeer, setLogLevel} from '@fluencelabs/fluence';
|
import {Fluence, FluencePeer, setLogLevel} from '@fluencelabs/fluence';
|
||||||
import { registerPrintln } from '../compiled/examples/println';
|
import { registerPrintln } from '../compiled/examples/println';
|
||||||
import { callArrowCall } from '../examples/callArrowCall';
|
import {callArrowCall, reproArgsBug426Call} from '../examples/callArrowCall';
|
||||||
import { dataAliasCall } from '../examples/dataAliasCall';
|
import { dataAliasCall } from '../examples/dataAliasCall';
|
||||||
import { onCall } from '../examples/onCall';
|
import { onCall } from '../examples/onCall';
|
||||||
import { funcCall } from '../examples/funcCall';
|
import { funcCall } from '../examples/funcCall';
|
||||||
@ -73,6 +73,12 @@ describe('Testing examples', () => {
|
|||||||
expect(callArrowResult).toBe('Hello, callArrow call!');
|
expect(callArrowResult).toBe('Hello, callArrow call!');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('callArrow.aqua args bug 426', async () => {
|
||||||
|
let argResult = await reproArgsBug426Call();
|
||||||
|
|
||||||
|
expect(argResult).toBe("privet");
|
||||||
|
});
|
||||||
|
|
||||||
it('streamRestrictions.aqua', async () => {
|
it('streamRestrictions.aqua', async () => {
|
||||||
let streamResResult = await streamResCall();
|
let streamResResult = await streamResCall();
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||||
* Aqua version: 0.6.0-263
|
* Aqua version: 0.6.0-SNAPSHOT
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||||
@ -137,3 +137,83 @@ export function passFunctionAsArg(...args: any) {
|
|||||||
script
|
script
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export function reproArgsBug426(
|
||||||
|
log: (arg0: string, callParams: CallParams<'arg0'>) => void | Promise<void>,
|
||||||
|
arg: string,
|
||||||
|
config?: {ttl?: number}
|
||||||
|
): Promise<void>;
|
||||||
|
|
||||||
|
export function reproArgsBug426(
|
||||||
|
peer: FluencePeer,
|
||||||
|
log: (arg0: string, callParams: CallParams<'arg0'>) => void | Promise<void>,
|
||||||
|
arg: string,
|
||||||
|
config?: {ttl?: number}
|
||||||
|
): Promise<void>;
|
||||||
|
|
||||||
|
export function reproArgsBug426(...args: any) {
|
||||||
|
|
||||||
|
let script = `
|
||||||
|
(xor
|
||||||
|
(seq
|
||||||
|
(seq
|
||||||
|
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||||
|
(call %init_peer_id% ("getDataSrv" "arg") [] arg)
|
||||||
|
)
|
||||||
|
(xor
|
||||||
|
(call %init_peer_id% ("callbackSrv" "log") [arg])
|
||||||
|
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||||
|
)
|
||||||
|
`
|
||||||
|
return callFunction(
|
||||||
|
args,
|
||||||
|
{
|
||||||
|
"functionName" : "reproArgsBug426",
|
||||||
|
"returnType" : {
|
||||||
|
"tag" : "void"
|
||||||
|
},
|
||||||
|
"argDefs" : [
|
||||||
|
{
|
||||||
|
"name" : "log",
|
||||||
|
"argType" : {
|
||||||
|
"tag" : "callback",
|
||||||
|
"callback" : {
|
||||||
|
"argDefs" : [
|
||||||
|
{
|
||||||
|
"name" : "arg0",
|
||||||
|
"argType" : {
|
||||||
|
"tag" : "primitive"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"returnType" : {
|
||||||
|
"tag" : "void"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "arg",
|
||||||
|
"argType" : {
|
||||||
|
"tag" : "primitive"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"names" : {
|
||||||
|
"relay" : "-relay-",
|
||||||
|
"getDataSrv" : "getDataSrv",
|
||||||
|
"callbackSrv" : "callbackSrv",
|
||||||
|
"responseSrv" : "callbackSrv",
|
||||||
|
"responseFnName" : "response",
|
||||||
|
"errorHandlingSrv" : "errorHandlingSrv",
|
||||||
|
"errorFnName" : "error"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
script
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Fluence } from '@fluencelabs/fluence';
|
import { Fluence } from '@fluencelabs/fluence';
|
||||||
import { passFunctionAsArg } from '../compiled/examples/callArrow';
|
import {passFunctionAsArg, reproArgsBug426} from '../compiled/examples/callArrow';
|
||||||
|
|
||||||
export async function callArrowCall(): Promise<string> {
|
export async function callArrowCall(): Promise<string> {
|
||||||
const relayPeerId = Fluence.getPeer().getStatus().relayPeerId;
|
const relayPeerId = Fluence.getPeer().getStatus().relayPeerId;
|
||||||
@ -11,3 +11,12 @@ export async function callArrowCall(): Promise<string> {
|
|||||||
}, {ttl: 10000});
|
}, {ttl: 10000});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function reproArgsBug426Call(): Promise<string> {
|
||||||
|
const relayPeerId = Fluence.getPeer().getStatus().relayPeerId;
|
||||||
|
return new Promise<string>((resolve, reject) => {
|
||||||
|
reproArgsBug426((a: string) => {
|
||||||
|
resolve(a);
|
||||||
|
}, "privet");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user