Skip to content

Commit

Permalink
Updated schema
Browse files Browse the repository at this point in the history
Summary:
- The `Symbol` facts record info from the semantic model, e.g. what classes / interfaces exist (and info about them, e.g. accessibility, type arguments)
- The `Syntax` facts record info about the syntax and associates it with symbols, e.g. the locations where symbols are defined or referenced (xrefs)

Reviewed By: pepeiborra

Differential Revision: D51166093

fbshipit-source-id: 9c16ae169403158cae2ef0daf887d6e6cb7b8a23
  • Loading branch information
Tom Bates authored and facebook-github-bot committed Nov 10, 2023
1 parent c2c2cd4 commit 9b72960
Showing 1 changed file with 108 additions and 37 deletions.
145 changes: 108 additions & 37 deletions glean/schema/source/csharp.angle
Original file line number Diff line number Diff line change
@@ -1,41 +1,112 @@
schema csharp.1 {
import src.1

# AlphaNamespace and type names (§7.8)
# https://fburl.com/d94ubqay
predicate AlphaName : string

# AlphaNamespace declarations (§13.3)
# https://fburl.com/gv0o62tb
predicate AlphaNamespace :
{
name : maybe AlphaName,
containing_namespace : maybe AlphaNamespace,
is_global : bool,
locations : [src.FileLocation],
}

# Classes (§14)
# https://fburl.com/mb38zzjh
predicate AlphaClassDefinition :
{
name : AlphaName,
containing_namespace : maybe AlphaNamespace,
locations : [src.FileLocation],
}

# Projects (.csproj)
# https://fburl.com/0axo3xpz
predicate AlphaProject :
{
solution : maybe AlphaSolution,
file : src.File,
}

# Solutions (.sln)
# https://fburl.com/var17xpf
predicate AlphaSolution :
{
file : src.File,
}
# Namespace and type names (§7.8)
# https://fburl.com/d94ubqay
type AlphaV2Name = string

# Namespaces (§13.3)
# https://fburl.com/gv0o62tb
predicate AlphaV2NamespaceSymbol:
{ name : AlphaV2Name
, containing_namespace : maybe AlphaV2NamespaceSymbol
}

# Classes (§14)
# https://fburl.com/mb38zzjh
predicate AlphaV2ClassSymbol:
{ name : AlphaV2Name
, containing_namespace : AlphaV2NamespaceSymbol
}

# Interfaces (§18)
# https://fburl.com/9awakpxi
predicate AlphaV2InterfaceSymbol:
{ name : AlphaV2Name
, containing_namespace : AlphaV2NamespaceSymbol
}

# MethodKind Enum
# https://fburl.com/f4f1gtl1
type AlphaV2MethodKind = enum
{ anonymous_function
| builtin_operator
| constructor
| conversion
| declare_method
| delegate_invoke
| destructor
| event_add
| event_raise
| event_remove
| explicit_interface_implementation
| function_pointer_signature
| lambda_method
| local_function
| ordinary
| property_get
| property_set
| reduced_extension
| shared_constructor
| static_constructor
| user_defined_operator
}

# INamedTypeSymbol Interface
# https://fburl.com/9pg1rmon
type AlphaV2NamedTypeSymbol =
{ class_ : AlphaV2ClassSymbol
| interface_ : AlphaV2InterfaceSymbol
}

# IMethodSymbol Interface
# https://fburl.com/qh1vhxzs
predicate AlphaV2MethodSymbol:
{ name : AlphaV2Name
, kind : AlphaV2MethodKind
, containing_type : AlphaV2NamedTypeSymbol
}

# NamespaceDeclarationSyntax Class
# https://fburl.com/rx4jbunu
predicate AlphaV2NamespaceDeclarationSyntax:
{ symbol : AlphaV2NamespaceSymbol
, location : src.FileLocation
}

# ClassDeclarationSyntax Class
# https://fburl.com/oyak5vc7
predicate AlphaV2ClassDeclarationSyntax:
{ symbol : AlphaV2ClassSymbol
, location : src.FileLocation
}

# ObjectCreationExpressionSyntax Class
# https://fburl.com/7r9cp3dp
predicate AlphaV2ObjectCreationExpressionSyntax:
{ constructed_from : AlphaV2NamedTypeSymbol
, symbol : AlphaV2MethodSymbol
, location : src.FileLocation
}

# InterfaceDeclarationSyntax Class
# https://fburl.com/6iyi7sc5
predicate AlphaV2InterfaceDeclarationSyntax:
{ symbol : AlphaV2InterfaceSymbol
, location : src.FileLocation
}

# InvocationExpressionSyntax Class
# https://fburl.com/4yp4myhd
predicate AlphaV2InvocationExpressionSyntax:
{ symbol : AlphaV2MethodSymbol
, location : src.FileLocation
}

# MethodDeclarationSyntax Class
# https://fburl.com/h368lhr1
predicate AlphaV2MethodDeclarationSyntax:
{ symbol : AlphaV2MethodSymbol
, location : src.FileLocation
}
}

0 comments on commit 9b72960

Please sign in to comment.