mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
Keep the promise identity keys in the Node island build of the async unit
This commit is contained in:
@@ -391,6 +391,9 @@ void scr_promise_share_identity(ScrPromise *dst, ScrPromise *src) {
|
||||
dst->identity->rc++;
|
||||
}
|
||||
|
||||
#ifdef SCR_NODE_ISLANDS
|
||||
/* Node islands (NI-5) key their export table by a promise's identity
|
||||
* (scr_node_island_export.c); other programs link none of this. */
|
||||
const void *scr_promise_identity_key(ScrPromise *p) {
|
||||
if (!p->identity) {
|
||||
p->identity = malloc(sizeof *p->identity);
|
||||
@@ -406,6 +409,7 @@ void scr_promise_identity_drop(const void *key) {
|
||||
ScrPromiseIdentity *identity = (ScrPromiseIdentity *)key;
|
||||
if (--identity->rc == 0) free(identity);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool scr_promise_identity_equal(ScrPromise *a, ScrPromise *b) {
|
||||
return a == b || (a->identity != NULL && a->identity == b->identity);
|
||||
|
||||
Reference in New Issue
Block a user