| description | CodeQL AST node reference for the C# language |
|---|
Based on the C# PrintAst.expected test results, here are the core CodeQL AST classes for the C# language:
Class- Class declarationNamespaceDeclaration- Namespace declarationMethod- Method declarationProperty- Property declarationField- Field declarationParameter- Method parameterDelegateType- Delegate type declarationInstanceConstructor- Instance constructorStaticConstructor- Static constructorDestructor- Destructor/finalizer
TypeMention- Reference to a typeTypeParameter- Generic type parameterTypeAccess- Access to a typeTypeAccessPatternExpr- Type access in pattern expressions
BlockStmt- Block statement{...}ExprStmt- Expression statementLocalVariableDeclStmt- Local variable declaration statementReturnStmt- Return statementIfStmt- If statementTryStmt- Try statementThrowStmt- Throw statementUsingBlockStmt- Using statement with blockFixedStmt- Fixed statement (for unsafe code)LabelStmt- Label statementEmptyStmt- Empty statement;
LocalVariableDeclAndInitExpr- Local variable declaration and initializationLocalVariableAccess- Access to local variableParameterAccess- Access to parameterFieldAccess- Access to fieldPropertyCall- Property access/callMethodCall- Method callMethodAccess- Method accessObjectCreation- Object creation expressionnew T()AnonymousObjectCreation- Anonymous object creationArrayCreation- Array creation expressionArrayAccess- Array element accessAssignExpr- Assignment expression=AssignAddExpr- Addition assignment+=AssignSubExpr- Subtraction assignment-=ThisAccess-thisaccessCastExpr- Type cast expressionIsExpr- Type check expressionisDefaultValueExpr- Default value expressiondefault(...)
AddExpr- Addition expression+SubExpr- Subtraction expression-DivExpr- Division expression/BitwiseAndExpr- Bitwise AND expression&LogicalOrExpr- Logical OR expression||LTExpr- Less than expression<GEExpr- Greater than or equal expression>=PostIncrExpr- Post-increment expression++OperatorCall- Operator call
IntLiteral- Integer literalStringLiteralUtf16- String literalBoolLiteral- Boolean literal (true/false)DoubleLiteral- Double literalCharLiteral- Character literalNullLiteral- Null literal
ObjectInitializer- Object initializer{ ... }MemberInitializer- Member initializer in object initializerCollectionInitializer- Collection initializer{ ..., ... }ElementInitializer- Element initializer in collectionArrayInitializer- Array initializer{ ..., ... }
DelegateCall- Delegate callImplicitDelegateCreation- Implicit delegate creationExplicitDelegateCreation- Explicit delegate creationEventAccess- Event accessEventCall- Event callAddEventExpr- Event subscription+=RemoveEventExpr- Event unsubscription-=
Getter- Property getterSetter- Property setter
MemberConstantAccess- Access to member constantLocalFunctionAccess- Access to local functionAddressOfExpr- Address-of expression&(unsafe code)
This repo contains a variant of the open-source PrintAst.ql query for csharp language, with modifications for local testing:
The following links can be fetched to get the expected results for different unit tests of the open-source PrintAst.ql query for the csharp language:
- library-tests/arguments/PrintAst.expected
- library-tests/assignments/PrintAst.expected
- library-tests/attributes/PrintAst.expected
- library-tests/comments/PrintAst.expected
- library-tests/constructors/PrintAst.expected
- library-tests/conversion/operator/PrintAst.expected
- library-tests/csharp6/PrintAst.expected
- library-tests/csharp7/PrintAst.expected
- library-tests/csharp7.1/PrintAst.expected
- library-tests/csharp7.2/PrintAst.expected
- library-tests/csharp7.3/PrintAst.expected
- library-tests/csharp8/PrintAst.expected
- library-tests/csharp9/PrintAst.expected
- library-tests/csharp11/PrintAst.expected
- library-tests/dataflow/implicittostring/PrintAst.expected
- library-tests/dataflow/tuples/PrintAst.expected
- library-tests/definitions/PrintAst.expected
- library-tests/delegates/PrintAst.expected
- library-tests/dynamic/PrintAst.expected
- library-tests/enums/PrintAst.expected
- library-tests/exceptions/PrintAst.expected
- library-tests/expressions/PrintAst.expected
- library-tests/events/PrintAst.expected
- library-tests/fields/PrintAst.expected
- library-tests/generics/PrintAst.expected
- library-tests/goto/PrintAst.expected
- library-tests/indexers/PrintAst.expected
- library-tests/initializers/PrintAst.expected
- library-tests/linq/PrintAst.expected
- library-tests/members/PrintAst.expected
- library-tests/methods/PrintAst.expected
- library-tests/namespaces/PrintAst.expected
- library-tests/nestedtypes/PrintAst.expected
- library-tests/operators/PrintAst.expected
- library-tests/partial/PrintAst.expected
- library-tests/properties/PrintAst.expected
- library-tests/statements/PrintAst.expected
- library-tests/stringinterpolation/PrintAst.expected
- library-tests/types/PrintAst.expected
- library-tests/unsafe/PrintAst.expected