| 56 | } |
| 57 | |
| 58 | function canCallFunctionWithDifferentOverloads (binding) { |
| 59 | let outsideRef = {}; |
| 60 | const testFunc = (a, b) => a * a - b * b; |
| 61 | const testFuncB = (a, b, c) => a + b - c * c; |
| 62 | const testFuncC = (a, b, c) => { |
| 63 | outsideRef.a = a; |
| 64 | outsideRef.b = b; |
| 65 | outsideRef.c = c; |
| 66 | }; |
| 67 | const testFuncD = (a, b, c, d) => { |
| 68 | outsideRef.result = a + b * c - d; |
| 69 | return outsideRef.result; |
| 70 | }; |
| 71 | |
| 72 | assert(binding.CallWithVec(testFunc, 5, 4) === testFunc(5, 4)); |
| 73 | assert(binding.CallWithInitList(testFuncB, 2, 4, 5) === testFuncB(2, 4, 5)); |
| 74 | |
| 75 | binding.CallWithRecvVector(testFuncC, outsideRef, 1, 2, 4); |
| 76 | assert(outsideRef.a === 1 && outsideRef.b === 2 && outsideRef.c === 4); |
| 77 | |
| 78 | outsideRef = {}; |
| 79 | binding.CallWithRecvInitList(testFuncC, outsideRef, 1, 2, 4); |
| 80 | assert(outsideRef.a === 1 && outsideRef.b === 2 && outsideRef.c === 4); |
| 81 | |
| 82 | outsideRef = {}; |
| 83 | binding.CallWithRecvArgc(testFuncD, outsideRef, 2, 4, 5, 6); |
| 84 | assert(outsideRef.result === testFuncD(2, 4, 5, 6)); |
| 85 | } |
| 86 | |
| 87 | async function canCallAsyncFunctionWithDifferentOverloads (binding) { |
| 88 | const testFunc = () => 2100; |