MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / getFieldReference

Function getFieldReference

packages/language/src/utils.ts:435–443  ·  view source on GitHub ↗
(expr: Expression)

Source from the content-addressed store, hash-verified

433 * Gets the data field referenced by the given expression, if any. Returns `undefined` if the expression is not a reference to a data field.
434 */
435export function getFieldReference(expr: Expression): DataField | undefined {
436 if (isReferenceExpr(expr) && isDataField(expr.target.ref)) {
437 return expr.target.ref;
438 } else if (isMemberAccessExpr(expr) && isDataField(expr.member.ref)) {
439 return expr.member.ref;
440 } else {
441 return undefined;
442 }
443}
444
445// TODO: move to policy plugin
446export function isCheckInvocation(node: AstNode) {

Callers

nothing calls this directly

Calls 3

isReferenceExprFunction · 0.90
isDataFieldFunction · 0.90
isMemberAccessExprFunction · 0.90

Tested by

no test coverage detected