diff options
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`; + } + """ + .} |