Files
micropython/tests/ports/webassembly/fun_call.mjs.exp
T
Damien George 01a11ea45e webassembly/objjsproxy: Support arbitrary number of args with kwargs.
When calling from Python into JavaScript and passing along keyword
arguments, the FFI bindings currently only support at most 1 positional
argument. For example:

    import js
    js.func(1, b=2, c=3)

This commit fixes that by supporting arbitrary number of positional
arguments, in combination with keyword arguments.  So now the following
works:

    import js
    js.func(1, 2, c=3, d=4)

Tests are added for these new, supported cases.

Signed-off-by: Damien George <damien@micropython.org>
2025-10-06 12:35:20 +11:00

28 lines
610 B
Plaintext

undefined undefined undefined undefined undefined
1 undefined undefined undefined undefined
1 2 undefined undefined undefined
1 2 3 undefined undefined
1 2 3 4 undefined
1 2 3 4 5
1 2 3 4 5
[]
[ { a: 1 } ]
[ { a: 1, b: 2 } ]
[ { a: 1, b: 2, c: 3 } ]
[ { a: 1, b: 2, c: 3, d: 4 } ]
[ { a: 1, b: 2, c: 3, d: 4, e: 5 } ]
[ 1 ]
[ 1, { b: 2 } ]
[ 1, { b: 2, c: 3 } ]
[ 1, { b: 2, c: 3, d: 4 } ]
[ 1, { b: 2, c: 3, d: 4, e: 5 } ]
[ 1, 2 ]
[ 1, 2, { c: 3 } ]
[ 1, 2, { c: 3, d: 4 } ]
[ 1, 2, { c: 3, d: 4, e: 5 } ]
[ 1, 2, 3 ]
[ 1, 2, 3, { d: 4 } ]
[ 1, 2, 3, { d: 4, e: 5 } ]
[ 1, 2, 3, 4 ]
[ 1, 2, 3, 4, { e: 5 } ]