Skip to content

Commit

Permalink
Update schema with member-access x-ref
Browse files Browse the repository at this point in the history
Summary:
This diff adds support to the C# schema for capturing 'member access' expressions, e.g.

 {F1494280477}

This allows us to wire up a new x-ref for the variable/parameter being accessed (in this example, `someLocalVariable`).

In this iteration we will index member access expressions that are part of method-invocation expressions (other member-access x-ref sites will be added in future as well as other alternatives for `MemberInvocationExpression`).

Reviewed By: malanka

Differential Revision: D56465646

fbshipit-source-id: e0df1dae66212eae446d6b4e98d199a04018d1d0
  • Loading branch information
Tom Bates authored and facebook-github-bot committed Apr 23, 2024
1 parent 8bcc177 commit 283e66f
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion glean/schema/source/csharp.angle
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,24 @@ predicate ObjectCreationLocation:
predicate MethodInvocationLocation:
{ method: Method
, location: Location
, expression: maybe MethodInvocationExpression
}

type MethodInvocationExpression =
{ memberAccess: MemberAccessLocation
}

predicate MemberAccessLocation:
{ expression: MemberAccessExpression
, location: Location
}

type MemberAccessExpression =
{ local: Local
| parameter: Parameter
| field: Field
| property: Property
| method: Method
}

# A Horizon Unity platform package, e.g. apps/horizon
Expand Down Expand Up @@ -428,11 +446,23 @@ predicate FileEntityXRefs:
}
stored
{ File, Span, Defn } where
( MethodInvocationLocation { MDefn, { fileLocation = SrcLoc } };
( MethodInvocationLocation { MDefn, { fileLocation = SrcLoc }, _ };
{ method = MDefn } = Defn;
) | (
ObjectCreationLocation { AType, _, { fileLocation = { File, Span }} };
{ type = AType } = Defn;
) | (
MemberAccessLocation { expression = Expr, location = { fileLocation = SrcLoc } };
( { local = Local } = Expr; { local = Local } = Defn
) | (
{ parameter = Param } = Expr; { parameter = Param } = Defn
) | (
{ field = Field } = Expr; { field = Field } = Defn
) | (
{ property = Prop } = Expr; { property = Prop } = Defn
) | (
{ method = Method } = Expr; { method = Method } = Defn
);
);
{ File, Span } = SrcLoc;

Expand Down

0 comments on commit 283e66f

Please sign in to comment.