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

Function isPrototypeMutatorCall

ark/aot/usage.ts:1222–1246  ·  view source on GitHub ↗
(
	operand: Node,
	parent: Node | undefined,
	module: SourceModule
)

Source from the content-addressed store, hash-verified

1220 (parent?.type === "BinaryExpression" && isEqualityOperator(parent.operator))
1221
1222const isPrototypeMutatorCall = (
1223 operand: Node,
1224 parent: Node | undefined,
1225 module: SourceModule
1226): boolean => {
1227 if (parent?.type !== "CallExpression" || parent.arguments[0] !== operand)
1228 return false
1229 const callee = unwrapExpression(parent.callee)
1230 const name = globalNameOf(callee, module)
1231 if (name && prototypeMutators.has(name)) return true
1232 if (callee.type !== "MemberExpression") return false
1233 const method = memberNameOf(callee)
1234 const owner = unwrapExpression(callee.object)
1235 if (
1236 typeof method !== "string" ||
1237 owner.type !== "MemberExpression" ||
1238 !isGlobalHost(owner.object, module)
1239 )
1240 return false
1241 const ownerName = memberNameOf(owner)
1242 return (
1243 typeof ownerName === "string" &&
1244 prototypeMutators.has(`${ownerName}.${method}`)
1245 )
1246}
1247
1248const isArrayOrObjectLiteral = (node: Node | undefined): boolean => {
1249 if (!node) return false

Callers 1

isBuiltinPrototypePatchFunction · 0.85

Calls 5

unwrapExpressionFunction · 0.90
memberNameOfFunction · 0.90
globalNameOfFunction · 0.85
isGlobalHostFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected