fix(javascript): own reference roles and invocation result identities

This commit is contained in:
morluto committed 2026-10-24 02:50:51 +08:00
1 parent 990d1de4d0
commit 965aff805d
8 files changed
+212 -72

No files matched your search

@@ -51,3 +51,12 @@ export const semanticCallableResultExpressions = (
}
return output;
};
/** A callable's direct invocation result differs from its body result syntax. */
export const semanticCallableResultKind = (
callable: t.Node,
): "value" | "promise" | "iterator" | "async-iterator" => {
if (!t.isFunction(callable)) return "value";
if (callable.generator) return callable.async ? "async-iterator" : "iterator";
return callable.async ? "promise" : "value";
};