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

Function isSubProtoCreate

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

Source from the content-addressed store, hash-verified

1451}
1452
1453const isSubProtoCreate = (
1454 operand: Node,
1455 parent: Node | undefined,
1456 module: SourceModule
1457): boolean => {
1458 if (
1459 parent?.type !== "CallExpression" ||
1460 parent.arguments[0] !== operand ||
1461 parent.arguments.length !== 1 ||
1462 globalNameOf(unwrapExpression(parent.callee), module) !== "Object.create"
1463 )
1464 return false
1465 const [callOp, assign] = operatorOf(parent)
1466 if (
1467 assign?.type !== "AssignmentExpression" ||
1468 assign.operator !== "=" ||
1469 assign.right !== callOp ||
1470 !isDiscardedAssignment(assign)
1471 )
1472 return false
1473 const left = unwrapExpression(assign.left)
1474 return left.type === "MemberExpression" && memberNameOf(left) === "prototype"
1475}
1476
1477const isNonNullProtoProperty = (
1478 prop: Extract<Node, { type: "Property" }>

Callers 2

buildThisReadsContextFunction · 0.85
ctorExposesPrototypeFunction · 0.85

Calls 5

unwrapExpressionFunction · 0.90
operatorOfFunction · 0.90
memberNameOfFunction · 0.90
globalNameOfFunction · 0.85
isDiscardedAssignmentFunction · 0.85

Tested by

no test coverage detected