diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2024-04-11 15:14:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-11 09:14:56 +0200 |
commit | 779bc8474b0e4d5d77d2619bd50eaa0fc111d1e6 (patch) | |
tree | d52d43d6a688b3cb93f2838c154e9096752489b8 /lib/system | |
parent | 2bd2f2885873f5eb2c722b3647fd11ee480a2452 (diff) | |
download | Nim-779bc8474b0e4d5d77d2619bd50eaa0fc111d1e6.tar.gz |
fixes #4299 #12492 #10849; lambda lifting for JS backend (#23484)
fixes #4299 fixes #12492 fixes #10849 It binds `function` with `env`: `function.bind(:env)` to ease codegen for now
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/jssys.nim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/system/jssys.nim b/lib/system/jssys.nim index 868abfd53..fb9481ffd 100644 --- a/lib/system/jssys.nim +++ b/lib/system/jssys.nim @@ -781,3 +781,15 @@ if (!Math.trunc) { }; } """.} + +proc cmpClosures(a, b: JSRef): bool {.compilerproc, asmNoStackFrame.} = + # Both `a` and `b` need to be a closure + {.emit: """ + if (`a` !== null && `a`.ClP_0 !== undefined && + `b` !== null && `b`.ClP_0 !== undefined) { + return `a`.ClP_0 == `b`.ClP_0 && `a`.ClE_0 == `b`.ClE_0; + } else { + return `a` == `b`; + } + """ + .} |