MCPcopy Create free account
hub / github.com/arktypeio/arktype / isNonEscapingRead

Function isNonEscapingRead

ark/aot/usage.ts:2972–2985  ·  view source on GitHub ↗
(node: Node, module: SourceModule)

Source from the content-addressed store, hash-verified

2970
2971// whether a computed `this[k]` value cannot escape as a callable function
2972const isNonEscapingRead = (node: Node, module: SourceModule): boolean => {
2973 const [operand, parent] = operatorOf(node)
2974 if (!parent) return false
2975 if (parent.type === "ExpressionStatement") return true
2976 if (parent.type === "UnaryExpression") return true
2977 if (parent.type === "BinaryExpression") return parent.operator !== "in"
2978 if (parent.type === "TemplateLiteral")
2979 return parent.parent?.type !== "TaggedTemplateExpression"
2980 if (parent.type === "CallExpression" && parent.callee !== operand) {
2981 const name = globalNameOf(parent.callee, module)
2982 return !!name && nonCallingGlobals.has(name)
2983 }
2984 return false
2985}

Callers 1

isContainedThisFunction · 0.85

Calls 3

operatorOfFunction · 0.90
globalNameOfFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected