C#: Add AST printing (#4038)

This commit is contained in:
Tamás Vajk
2020-08-20 14:24:43 +02:00
committed by GitHub
parent ec7a65777b
commit 2a8ff8785a
95 changed files with 11501 additions and 18 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,211 @@
arguments.cs:
# 3| [Class] ArgumentsTest
# 5| 4: [InstanceConstructor] ArgumentsTest
#-----| 2: (Parameters)
# 5| 0: [Parameter] x
# 5| 1: [IntLiteral] 0
# 5| 1: [Parameter] y
# 5| 1: [IntLiteral] 0
# 6| 4: [BlockStmt] {...}
# 9| 5: [InstanceConstructor] ArgumentsTest
#-----| 2: (Parameters)
# 9| 0: [Parameter] x
# 9| 1: [Parameter] y
# 9| 2: [Parameter] z
# 10| 4: [BlockStmt] {...}
# 11| 0: [ExprStmt] ...;
# 11| 0: [AssignExpr] ... = ...
# 11| 0: [ParameterAccess] access to parameter x
# 11| 1: [ParameterAccess] access to parameter y
# 14| 6: [Method] f1
#-----| 2: (Parameters)
# 14| 0: [Parameter] x
# 14| 1: [IntLiteral] 1
# 14| 1: [Parameter] y
# 14| 1: [IntLiteral] 2
# 15| 4: [BlockStmt] {...}
# 18| 7: [Method] f2
#-----| 2: (Parameters)
# 18| 0: [Parameter] x
# 18| 1: [Parameter] y
# 18| 2: [Parameter] z
# 19| 4: [BlockStmt] {...}
# 20| 0: [ExprStmt] ...;
# 20| 0: [AssignExpr] ... = ...
# 20| 0: [ParameterAccess] access to parameter x
# 20| 1: [ParameterAccess] access to parameter y
# 23| 8: [Method] f
# 24| 4: [BlockStmt] {...}
# 25| 0: [LocalVariableDeclStmt] ... ...;
# 25| 0: [LocalVariableDeclAndInitExpr] Int32 x = ...
# 25| 0: [IntLiteral] 1
# 25| 1: [LocalVariableAccess] access to local variable x
# 27| 1: [ExprStmt] ...;
# 27| 0: [MethodCall] call to method f1
# 27| 0: [IntLiteral] 2
# 28| 2: [ExprStmt] ...;
# 28| 0: [MethodCall] call to method f2
# 28| 0: [LocalVariableAccess] access to local variable x
# 28| 1: [LocalVariableAccess] access to local variable x
# 28| 2: [LocalVariableAccess] access to local variable x
# 29| 3: [ExprStmt] ...;
# 29| 0: [ObjectCreation] object creation of type ArgumentsTest
# 29| 0: [LocalVariableAccess] access to local variable x
# 29| 1: [LocalVariableAccess] access to local variable x
# 29| 2: [LocalVariableAccess] access to local variable x
# 30| 4: [ExprStmt] ...;
# 30| 0: [ObjectCreation] object creation of type ArgumentsTest
# 30| 0: [IntLiteral] 10
# 30| 1: [IntLiteral] 5
# 33| 9: [Method] f3
#-----| 2: (Parameters)
# 33| 0: [Parameter] o
# 33| 1: [Parameter] args
# 34| 4: [BlockStmt] {...}
# 35| 0: [ExprStmt] ...;
# 35| 0: [MethodCall] call to method f3
# 35| 0: [IntLiteral] 0
# 35| 1: [IntLiteral] 1
# 35| 2: [IntLiteral] 2
# 36| 1: [ExprStmt] ...;
# 36| 0: [MethodCall] call to method f3
# 36| 0: [IntLiteral] 0
# 36| 1: [ArrayCreation] array creation of type Int32[]
# 36| -1: [ArrayInitializer] { ..., ... }
# 36| 0: [IntLiteral] 1
# 36| 1: [IntLiteral] 2
# 37| 2: [ExprStmt] ...;
# 37| 0: [MethodCall] call to method f3
# 37| 0: [IntLiteral] 1
# 37| 1: [IntLiteral] 0
# 38| 3: [ExprStmt] ...;
# 38| 0: [MethodCall] call to method f3
# 38| 0: [IntLiteral] 0
# 38| 1: [ParameterAccess] access to parameter args
# 39| 4: [ExprStmt] ...;
# 39| 0: [MethodCall] call to method f3
# 39| 0: [ParameterAccess] access to parameter args
# 39| 1: [IntLiteral] 0
# 40| 5: [ExprStmt] ...;
# 40| 0: [MethodCall] call to method f3
# 40| 0: [ArrayCreation] array creation of type Int32[]
# 40| -1: [ArrayInitializer] { ..., ... }
# 40| 0: [IntLiteral] 1
# 40| 1: [IntLiteral] 2
# 40| 1: [IntLiteral] 0
# 43| 10: [Method] f4
#-----| 2: (Parameters)
# 43| 0: [Parameter] args
# 44| 4: [BlockStmt] {...}
# 45| 0: [ExprStmt] ...;
# 45| 0: [MethodCall] call to method f4
# 45| 0: [ArrayCreation] array creation of type Object[]
# 45| -1: [ArrayInitializer] { ..., ... }
# 45| 0: [NullLiteral] null
# 45| 1: [NullLiteral] null
# 48| 11: [Property] Prop
# 48| 3: [Getter] get_Prop
# 48| 4: [Setter] set_Prop
#-----| 2: (Parameters)
# 48| 0: [Parameter] value
# 50| 12: [Indexer] Item
#-----| 1: (Parameters)
# 50| 0: [Parameter] a
# 50| 1: [Parameter] b
# 50| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 50| 0: [Parameter] a
# 50| 1: [Parameter] b
# 50| 4: [AddExpr] ... + ...
# 50| 0: [ParameterAccess] access to parameter a
# 50| 1: [ParameterAccess] access to parameter b
# 50| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 50| 0: [Parameter] a
# 50| 1: [Parameter] b
# 50| 2: [Parameter] value
# 50| 4: [BlockStmt] {...}
# 52| 13: [Method] f5
# 53| 4: [BlockStmt] {...}
# 54| 0: [ExprStmt] ...;
# 54| 0: [AssignExpr] ... = ...
# 54| 0: [IntLiteral] 0
# 54| 1: [PropertyCall] access to property Prop
# 55| 1: [ExprStmt] ...;
# 55| 0: [AssignExpr] ... = ...
# 55| 0: [IndexerCall] access to indexer
# 55| -1: [ThisAccess] this access
# 55| 0: [IntLiteral] 1
# 55| 1: [IntLiteral] 2
# 55| 1: [PropertyCall] access to property Prop
# 56| 2: [ExprStmt] ...;
# 56| 0: [AssignExpr] ... = ...
# 56| 0: [TupleExpr] (..., ...)
# 56| 0: [IntLiteral] 5
# 56| 1: [IntLiteral] 6
# 56| 1: [TupleExpr] (..., ...)
# 56| 0: [PropertyCall] access to property Prop
# 56| 1: [IndexerCall] access to indexer
# 56| -1: [ThisAccess] this access
# 56| 0: [IntLiteral] 3
# 56| 1: [IntLiteral] 4
# 57| 3: [ExprStmt] ...;
# 57| 0: [PostIncrExpr] ...++
# 57| 0: [PropertyCall] access to property Prop
# 58| 4: [ExprStmt] ...;
# 58| 0: [AssignAddExpr] ... += ...
# 58| 0: [IntLiteral] 7
# 58| 1: [PropertyCall] access to property Prop
# 59| 5: [ExprStmt] ...;
# 59| 0: [PostIncrExpr] ...++
# 59| 0: [IndexerCall] access to indexer
# 59| -1: [ThisAccess] this access
# 59| 0: [IntLiteral] 8
# 59| 1: [IntLiteral] 9
# 60| 6: [ExprStmt] ...;
# 60| 0: [AssignAddExpr] ... += ...
# 60| 0: [IntLiteral] 12
# 60| 1: [IndexerCall] access to indexer
# 60| -1: [ThisAccess] this access
# 60| 0: [IntLiteral] 10
# 60| 1: [IntLiteral] 11
# 61| 7: [LocalVariableDeclStmt] ... ...;
# 61| 0: [LocalVariableDeclAndInitExpr] (Int32,Int32) tuple = ...
# 61| 0: [TupleExpr] (..., ...)
# 61| 0: [IntLiteral] 13
# 61| 1: [IntLiteral] 14
# 61| 1: [LocalVariableAccess] access to local variable tuple
# 62| 8: [ExprStmt] ...;
# 62| 0: [AssignExpr] ... = ...
# 62| 0: [LocalVariableAccess] access to local variable tuple
# 62| 1: [TupleExpr] (..., ...)
# 62| 0: [PropertyCall] access to property Prop
# 62| 1: [IndexerCall] access to indexer
# 62| -1: [ThisAccess] this access
# 62| 0: [IntLiteral] 15
# 62| 1: [IntLiteral] 16
# 66| 14: [Method] f6
#-----| 0: (Attributes)
# 65| 1: [Attribute] [My(...)]
# 65| 0: [BoolLiteral] false
# 66| 4: [BlockStmt] {...}
# 69| 15: [Method] f7
#-----| 0: (Attributes)
# 68| 1: [Attribute] [My(...)]
# 68| 0: [BoolLiteral] true
# 68| 1: [StringLiteral] ""
# 68| 2: [IntLiteral] 0
# 69| 4: [BlockStmt] {...}
# 72| [Class] MyAttribute
#-----| 3: (Base types)
# 72| 0: [Class] Attribute
# 74| 4: [Field] x
# 75| 5: [IndexerProperty] y
# 75| 3: [Getter] get_y
# 75| 4: [Setter] set_y
#-----| 2: (Parameters)
# 75| 0: [Parameter] value
# 76| 6: [InstanceConstructor] MyAttribute
#-----| 2: (Parameters)
# 76| 0: [Parameter] b
# 76| 4: [BlockStmt] {...}

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,55 @@
Assignments.cs:
# 1| [Class] Assignments
# 3| 5: [Method] M
# 4| 4: [BlockStmt] {...}
# 5| 0: [LocalVariableDeclStmt] ... ...;
# 5| 0: [LocalVariableDeclAndInitExpr] Int32 x = ...
# 5| 0: [IntLiteral] 0
# 5| 1: [LocalVariableAccess] access to local variable x
# 6| 1: [ExprStmt] ...;
# 6| 0: [AssignAddExpr] ... += ...
# 6| 0: [IntLiteral] 1
# 6| 1: [LocalVariableAccess] access to local variable x
# 8| 2: [LocalVariableDeclStmt] ... ...;
# 8| 0: [LocalVariableDeclAndInitExpr] dynamic d = ...
# 8| 0: [CastExpr] (...) ...
# 8| 0: [IntLiteral] 0
# 8| 1: [LocalVariableAccess] access to local variable d
# 9| 3: [ExprStmt] ...;
# 9| 0: [AssignSubExpr] ... -= ...
# 9| 0: [IntLiteral] 2
# 9| 1: [LocalVariableAccess] access to local variable d
# 11| 4: [LocalVariableDeclStmt] ... ...;
# 11| 0: [LocalVariableDeclAndInitExpr] Assignments a = ...
# 11| 0: [ObjectCreation] object creation of type Assignments
# 11| 1: [LocalVariableAccess] access to local variable a
# 12| 5: [ExprStmt] ...;
# 12| 0: [AssignAddExpr] ... += ...
# 12| 0: [ThisAccess] this access
# 12| 1: [LocalVariableAccess] access to local variable a
# 14| 6: [ExprStmt] ...;
# 14| 0: [AddEventExpr] ... += ...
# 14| 0: [LambdaExpr] (...) => ...
#-----| 2: (Parameters)
# 14| 0: [Parameter] sender
# 14| 1: [Parameter] e
# 14| 4: [BlockStmt] {...}
# 14| 1: [EventAccess,EventCall] access to event Event
# 17| 6: [AddOperator] +
#-----| 2: (Parameters)
# 17| 0: [Parameter] x
# 17| 1: [Parameter] y
# 18| 4: [BlockStmt] {...}
# 19| 0: [ReturnStmt] return ...;
# 19| 0: [ParameterAccess] access to parameter x
# 22| 7: [DelegateType] EventHandler
#-----| 2: (Parameters)
# 22| 0: [Parameter] sender
# 22| 1: [Parameter] e
# 23| 8: [Event] Event
# 23| 3: [AddEventAccessor] add_Event
#-----| 2: (Parameters)
# 23| 0: [Parameter] value
# 23| 3: [RemoveEventAccessor] remove_Event
#-----| 2: (Parameters)
# 23| 0: [Parameter] value

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,73 @@
attributes.cs:
# 10| [Attribute] [AssemblyTitle(...)]
# 10| 0: [StringLiteral] "C# attributes test"
# 11| [Attribute] [AssemblyDescription(...)]
# 11| 0: [StringLiteral] "A test of C# attributes"
# 12| [Attribute] [AssemblyConfiguration(...)]
# 12| 0: [StringLiteral] ""
# 13| [Attribute] [AssemblyCompany(...)]
# 13| 0: [StringLiteral] "Semmle Plc"
# 14| [Attribute] [AssemblyProduct(...)]
# 14| 0: [StringLiteral] "Odasa"
# 15| [Attribute] [AssemblyCopyright(...)]
# 15| 0: [StringLiteral] "Copyright <20> Semmle 2018"
# 16| [Attribute] [AssemblyTrademark(...)]
# 16| 0: [StringLiteral] ""
# 17| [Attribute] [AssemblyCulture(...)]
# 17| 0: [StringLiteral] ""
# 22| [Attribute] [ComVisible(...)]
# 22| 0: [BoolLiteral] false
# 25| [Attribute] [Guid(...)]
# 25| 0: [StringLiteral] "2f70fdd6-14aa-4850-b053-d547adb1f476"
# 37| [Attribute] [AssemblyVersion(...)]
# 37| 0: [StringLiteral] "1.0.0.0"
# 38| [Attribute] [AssemblyFileVersion(...)]
# 38| 0: [StringLiteral] "1.0.0.0"
# 41| [Class] Foo
#-----| 0: (Attributes)
# 40| 1: [Attribute] [AttributeUsage(...)]
# 40| 0: [MemberConstantAccess] access to constant All
# 40| -1: [TypeAccess] access to type AttributeTargets
#-----| 3: (Base types)
# 41| 0: [Class] Attribute
# 44| 5: [Method] foo
#-----| 0: (Attributes)
# 43| 1: [Attribute] [Conditional(...)]
# 43| 0: [StringLiteral] "DEBUG2"
# 44| 4: [BlockStmt] {...}
# 47| [Class] Bar
# 49| 5: [Method] inc
#-----| 2: (Parameters)
# 49| 0: [Parameter] x
#-----| 0: (Attributes)
# 49| 1: [Attribute] [Foo(...)]
# 49| 4: [BlockStmt] {...}
# 49| 0: [ReturnStmt] return ...;
# 49| 0: [AddExpr] ... + ...
# 49| 0: [ParameterAccess] access to parameter x
# 49| 1: [IntLiteral] 1
# 52| 6: [Method] M1
#-----| 0: (Attributes)
# 51| 1: [Attribute] [My(...)]
# 51| 0: [BoolLiteral] false
# 52| 4: [BlockStmt] {...}
# 55| 7: [Method] M2
#-----| 0: (Attributes)
# 54| 1: [Attribute] [My(...)]
# 54| 0: [BoolLiteral] true
# 54| 1: [StringLiteral] ""
# 54| 2: [IntLiteral] 0
# 55| 4: [BlockStmt] {...}
# 58| [Class] MyAttribute
#-----| 3: (Base types)
# 58| 0: [Class] Attribute
# 60| 4: [Field] x
# 61| 5: [IndexerProperty] y
# 61| 3: [Getter] get_y
# 61| 4: [Setter] set_y
#-----| 2: (Parameters)
# 61| 0: [Parameter] value
# 62| 6: [InstanceConstructor] MyAttribute
#-----| 2: (Parameters)
# 62| 0: [Parameter] b
# 62| 4: [BlockStmt] {...}

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,17 @@
constructors.cs:
# 1| [NamespaceDeclaration] namespace ... { ... }
# 3| 1: [Class] Class
# 5| 4: [InstanceConstructor] Class
# 6| 4: [BlockStmt] {...}
# 8| 5: [InstanceConstructor] Class
#-----| 2: (Parameters)
# 8| 0: [Parameter] i
# 9| 4: [BlockStmt] {...}
# 11| 6: [StaticConstructor] Class
# 12| 4: [BlockStmt] {...}
# 14| 7: [Destructor] ~Class
# 15| 4: [BlockStmt] {...}
# 16| 0: [LocalVariableDeclStmt] ... ...;
# 16| 0: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 16| 0: [IntLiteral] 0
# 16| 1: [LocalVariableAccess] access to local variable i

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,17 @@
Operator.cs:
# 3| [Class] C
# 5| 5: [ImplicitConversionOperator] implicit conversion
#-----| 2: (Parameters)
# 5| 0: [Parameter] i
# 5| 4: [BlockStmt] {...}
# 5| 0: [ReturnStmt] return ...;
# 5| 0: [NullLiteral] null
# 7| 6: [Field] x1
# 8| 7: [Field] x2
# 11| 8: [Method] M
# 12| 4: [BlockStmt] {...}
# 13| 0: [ExprStmt] ...;
# 13| 0: [AssignExpr] ... = ...
# 13| 0: [OperatorCall] call to operator implicit conversion
# 13| 0: [FieldAccess] access to field x1
# 13| 1: [FieldAccess] access to field x2

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,236 @@
csharp6.cs:
# 10| [Class] TestCSharp6
# 12| 6: [Property] Value
# 15| 2: [AssignExpr] ... = ...
# 15| 0: [IntLiteral] 20
# 12| 1: [PropertyCall] access to property Value
# 14| 3: [Getter] get_Value
# 17| 7: [Method] Fn
#-----| 2: (Parameters)
# 17| 0: [Parameter] x
# 17| 4: [MethodCall] call to method WriteLine
# 17| 0: [ParameterAccess] access to parameter x
# 19| 8: [Method] Main
# 20| 4: [BlockStmt] {...}
# 21| 0: [TryStmt] try {...} ...
# 22| 0: [BlockStmt] {...}
# 23| 0: [LocalVariableDeclStmt] ... ...;
# 23| 0: [LocalVariableDeclAndInitExpr] String foo = ...
# 23| 0: [NameOfExpr] nameof(...)
# 23| 0: [TypeAccess] access to type TestCSharp6
# 23| 1: [LocalVariableAccess] access to local variable foo
# 23| 1: [LocalVariableDeclAndInitExpr] String bar = ...
# 23| 0: [NullLiteral] null
# 23| 1: [LocalVariableAccess] access to local variable bar
# 25| 1: [ExprStmt] ...;
# 25| 0: [MethodCall] call to method WriteLine
# 25| 0: [InterpolatedStringExpr] $"..."
# 25| 0: [NameOfExpr] nameof(...)
# 25| 0: [LocalVariableAccess] access to local variable foo
# 25| 1: [StringLiteral] " is "
# 25| 2: [LocalVariableAccess] access to local variable foo
# 25| 3: [StringLiteral] ", and "
# 25| 4: [NameOfExpr] nameof(...)
# 25| 0: [LocalVariableAccess] access to local variable bar
# 25| 5: [StringLiteral] " has length "
# 25| 6: [NullCoalescingExpr] ... ?? ...
# 25| 0: [PropertyCall] access to property Length
# 25| -1: [LocalVariableAccess] access to local variable bar
# 25| 1: [IntLiteral] 0
# 27| 2: [ExprStmt] ...;
# 27| 0: [MethodCall] call to method Fn
# 27| 0: [InterpolatedStringExpr] $"..."
# 27| 0: [NameOfExpr] nameof(...)
# 27| 0: [LocalVariableAccess] access to local variable foo
# 27| 1: [StringLiteral] " is "
# 27| 2: [LocalVariableAccess] access to local variable foo
# 27| 3: [StringLiteral] ", and "
# 27| 4: [NameOfExpr] nameof(...)
# 27| 0: [LocalVariableAccess] access to local variable bar
# 27| 5: [StringLiteral] " has length "
# 27| 6: [NullCoalescingExpr] ... ?? ...
# 27| 0: [PropertyCall] access to property Length
# 27| -1: [LocalVariableAccess] access to local variable bar
# 27| 1: [IntLiteral] 0
# 29| 3: [LocalVariableDeclStmt] ... ...;
# 29| 0: [LocalVariableDeclAndInitExpr] Nullable<Boolean> anythingInBar = ...
# 29| 0: [MethodCall] call to method Any
# 29| -1: [LocalVariableAccess] access to local variable bar
# 29| 1: [LocalVariableAccess] access to local variable anythingInBar
# 30| 4: [LocalVariableDeclStmt] ... ...;
# 30| 0: [LocalVariableDeclAndInitExpr] Nullable<Int32> countTInFoo = ...
# 30| 0: [MethodCall] call to method Count
# 30| -1: [MethodCall] call to method Select
# 30| -1: [MethodCall] call to method ToUpper
# 30| -1: [LocalVariableAccess] access to local variable foo
# 30| 0: [LambdaExpr] (...) => ...
#-----| 2: (Parameters)
# 30| 0: [Parameter] c
# 30| 4: [EQExpr] ... == ...
# 30| 0: [CastExpr] (...) ...
# 30| 0: [ParameterAccess] access to parameter c
# 30| 1: [CastExpr] (...) ...
# 30| 0: [CharLiteral] T
# 30| 1: [LocalVariableAccess] access to local variable countTInFoo
# 32| 5: [LocalVariableDeclStmt] ... ...;
# 32| 0: [LocalVariableDeclAndInitExpr] Nullable<Char> testElementBinding = ...
# 32| 0: [IndexerCall] access to indexer
# 32| -1: [IndexerCall] access to indexer
# 32| -1: [ObjectCreation] object creation of type Dictionary<Int32,String>
# 32| 0: [IntLiteral] 2
# 32| 0: [IntLiteral] 1
# 32| 1: [LocalVariableAccess] access to local variable testElementBinding
# 34| 1: [SpecificCatchClause] catch (...) {...}
# 35| 1: [BlockStmt] {...}
# 34| 2: [EQExpr] ... == ...
# 34| 0: [PropertyCall] access to property Value
# 34| 1: [IntLiteral] 20
# 37| 2: [GeneralCatchClause] catch {...}
# 38| 1: [BlockStmt] {...}
# 37| 2: [EQExpr] ... == ...
# 37| 0: [PropertyCall] access to property Value
# 37| 1: [IntLiteral] 30
# 40| 3: [GeneralCatchClause] catch {...}
# 41| 1: [BlockStmt] {...}
# 45| 9: [EQOperator] ==
#-----| 2: (Parameters)
# 45| 0: [Parameter] t1
# 45| 1: [Parameter] t2
# 45| 4: [BoolLiteral] true
# 46| 10: [NEOperator] !=
#-----| 2: (Parameters)
# 46| 0: [Parameter] t1
# 46| 1: [Parameter] t2
# 46| 4: [BoolLiteral] false
# 48| 11: [Property] ExprProperty
# 48| 3: [Getter] get_ExprProperty
# 48| 4: [IntLiteral] 3
# 50| 12: [Indexer] Item
#-----| 1: (Parameters)
# 50| 0: [Parameter] i
# 50| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 50| 0: [Parameter] i
# 50| 4: [ParameterAccess] access to parameter i
# 53| [Class] IndexInitializers
# 55| 5: [Class] Compound
# 57| 5: [Field] DictionaryField
# 58| 6: [IndexerProperty] DictionaryProperty
# 58| 3: [Getter] get_DictionaryProperty
# 58| 4: [Setter] set_DictionaryProperty
#-----| 2: (Parameters)
# 58| 0: [Parameter] value
# 59| 7: [Field] ArrayField
# 60| 8: [Property] ArrayProperty
# 60| 3: [Getter] get_ArrayProperty
# 60| 4: [Setter] set_ArrayProperty
#-----| 2: (Parameters)
# 60| 0: [Parameter] value
# 61| 9: [Field] ArrayField2
# 62| 10: [Property] ArrayProperty2
# 62| 3: [Getter] get_ArrayProperty2
# 62| 4: [Setter] set_ArrayProperty2
#-----| 2: (Parameters)
# 62| 0: [Parameter] value
# 65| 6: [Method] Test
# 66| 4: [BlockStmt] {...}
# 68| 0: [LocalVariableDeclStmt] ... ...;
# 68| 0: [LocalVariableDeclAndInitExpr] Dictionary<Int32,String> dict = ...
# 68| 0: [ObjectCreation] object creation of type Dictionary<Int32,String>
# 68| -1: [ObjectInitializer] { ..., ... }
# 68| 0: [MemberInitializer] ... = ...
# 68| 0: [StringLiteral] "Zero"
# 68| 1: [IndexerCall] access to indexer
# 68| 0: [IntLiteral] 0
# 68| 1: [MemberInitializer] ... = ...
# 68| 0: [StringLiteral] "One"
# 68| 1: [IndexerCall] access to indexer
# 68| 0: [IntLiteral] 1
# 68| 2: [MemberInitializer] ... = ...
# 68| 0: [StringLiteral] "Two"
# 68| 1: [IndexerCall] access to indexer
# 68| 0: [IntLiteral] 2
# 68| 1: [LocalVariableAccess] access to local variable dict
# 71| 1: [LocalVariableDeclStmt] ... ...;
# 71| 0: [LocalVariableDeclAndInitExpr] Compound compound = ...
# 71| 0: [ObjectCreation] object creation of type Compound
# 72| -1: [ObjectInitializer] { ..., ... }
# 73| 0: [MemberInitializer] ... = ...
# 73| 0: [ObjectInitializer] { ..., ... }
# 73| 0: [MemberInitializer] ... = ...
# 73| 0: [StringLiteral] "Zero"
# 73| 1: [IndexerCall] access to indexer
# 73| 0: [IntLiteral] 0
# 73| 1: [MemberInitializer] ... = ...
# 73| 0: [StringLiteral] "One"
# 73| 1: [IndexerCall] access to indexer
# 73| 0: [IntLiteral] 1
# 73| 2: [MemberInitializer] ... = ...
# 73| 0: [StringLiteral] "Two"
# 73| 1: [IndexerCall] access to indexer
# 73| 0: [IntLiteral] 2
# 73| 1: [FieldAccess] access to field DictionaryField
# 74| 1: [MemberInitializer] ... = ...
# 74| 0: [ObjectInitializer] { ..., ... }
# 74| 0: [MemberInitializer] ... = ...
# 74| 0: [StringLiteral] "Three"
# 74| 1: [IndexerCall] access to indexer
# 74| 0: [IntLiteral] 3
# 74| 1: [MemberInitializer] ... = ...
# 74| 0: [StringLiteral] "Two"
# 74| 1: [IndexerCall] access to indexer
# 74| 0: [IntLiteral] 2
# 74| 2: [MemberInitializer] ... = ...
# 74| 0: [StringLiteral] "One"
# 74| 1: [IndexerCall] access to indexer
# 74| 0: [IntLiteral] 1
# 74| 1: [PropertyCall] access to property DictionaryProperty
# 75| 2: [MemberInitializer] ... = ...
# 75| 0: [ObjectInitializer] { ..., ... }
# 75| 0: [MemberInitializer] ... = ...
# 75| 0: [StringLiteral] "Zero"
# 75| 1: [ArrayAccess] access to array element
# 75| 0: [IntLiteral] 0
# 75| 1: [MemberInitializer] ... = ...
# 75| 0: [StringLiteral] "One"
# 75| 1: [ArrayAccess] access to array element
# 75| 0: [IntLiteral] 1
# 75| 1: [FieldAccess] access to field ArrayField
# 76| 3: [MemberInitializer] ... = ...
# 76| 0: [ObjectInitializer] { ..., ... }
# 76| 0: [MemberInitializer] ... = ...
# 76| 0: [StringLiteral] "i"
# 76| 1: [ArrayAccess] access to array element
# 76| 0: [IntLiteral] 0
# 76| 1: [IntLiteral] 1
# 76| 1: [MemberInitializer] ... = ...
# 76| 0: [StringLiteral] "1"
# 76| 1: [ArrayAccess] access to array element
# 76| 0: [IntLiteral] 1
# 76| 1: [IntLiteral] 0
# 76| 1: [FieldAccess] access to field ArrayField2
# 77| 4: [MemberInitializer] ... = ...
# 77| 0: [ObjectInitializer] { ..., ... }
# 77| 0: [MemberInitializer] ... = ...
# 77| 0: [StringLiteral] "One"
# 77| 1: [ArrayAccess] access to array element
# 77| 0: [IntLiteral] 1
# 77| 1: [MemberInitializer] ... = ...
# 77| 0: [StringLiteral] "Two"
# 77| 1: [ArrayAccess] access to array element
# 77| 0: [IntLiteral] 2
# 77| 1: [PropertyCall] access to property ArrayProperty
# 78| 5: [MemberInitializer] ... = ...
# 78| 0: [ObjectInitializer] { ..., ... }
# 78| 0: [MemberInitializer] ... = ...
# 78| 0: [StringLiteral] "i"
# 78| 1: [ArrayAccess] access to array element
# 78| 0: [IntLiteral] 0
# 78| 1: [IntLiteral] 1
# 78| 1: [MemberInitializer] ... = ...
# 78| 0: [StringLiteral] "1"
# 78| 1: [ArrayAccess] access to array element
# 78| 0: [IntLiteral] 1
# 78| 1: [IntLiteral] 0
# 78| 1: [PropertyCall] access to property ArrayProperty2
# 71| 1: [LocalVariableAccess] access to local variable compound

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,67 @@
csharp71.cs:
# 3| [Class] DefaultLiterals
# 5| 5: [Method] f
# 6| 4: [BlockStmt] {...}
# 7| 0: [LocalVariableDeclStmt] ... ...;
# 7| 0: [LocalVariableDeclAndInitExpr] Int32 x = ...
# 7| 0: [CastExpr] (...) ...
# 7| 0: [DefaultValueExpr] default
# 7| 1: [LocalVariableAccess] access to local variable x
# 7| 1: [LocalVariableDeclAndInitExpr] Int32 y = ...
# 7| 0: [DefaultValueExpr] default(...)
# 7| 0: [TypeAccess] access to type Int32
# 7| 1: [LocalVariableAccess] access to local variable y
# 8| 1: [IfStmt] if (...) ...
# 8| 0: [EQExpr] ... == ...
# 8| 0: [LocalVariableAccess] access to local variable x
# 8| 1: [CastExpr] (...) ...
# 8| 0: [DefaultValueExpr] default
# 9| 1: [EmptyStmt] ;
# 10| 2: [SwitchStmt] switch (...) {...}
# 10| 0: [LocalVariableAccess] access to local variable x
# 12| 0: [CaseStmt] case ...:
# 12| 0: [DiscardPatternExpr] _
# 12| 1: [BreakStmt] break;
# 14| 3: [ExprStmt] ...;
# 14| 0: [AssignExpr] ... = ...
# 14| 0: [CastExpr] (...) ...
# 14| 0: [DefaultValueExpr] default
# 14| 1: [LocalVariableAccess] access to local variable x
# 15| 4: [LocalVariableDeclStmt] ... ...;
# 15| 0: [LocalVariableDeclAndInitExpr] String s = ...
# 15| 0: [CastExpr] (...) ...
# 15| 0: [DefaultValueExpr] default
# 15| 1: [LocalVariableAccess] access to local variable s
# 16| 5: [LocalVariableDeclStmt] ... ...;
# 16| 0: [LocalVariableDeclAndInitExpr] Boolean b = ...
# 16| 0: [CastExpr] (...) ...
# 16| 0: [DefaultValueExpr] default
# 16| 1: [LocalVariableAccess] access to local variable b
# 17| 6: [LocalVariableDeclStmt] ... ...;
# 17| 0: [LocalVariableDeclAndInitExpr] Double d = ...
# 17| 0: [CastExpr] (...) ...
# 17| 0: [DefaultValueExpr] default
# 17| 1: [LocalVariableAccess] access to local variable d
# 21| [Class] IsConstants
# 23| 5: [Method] f
# 24| 4: [BlockStmt] {...}
# 25| 0: [LocalVariableDeclStmt] ... ...;
# 25| 0: [LocalVariableDeclExpr] Boolean b
# 26| 1: [ExprStmt] ...;
# 26| 0: [AssignExpr] ... = ...
# 26| 0: [IsExpr] ... is ...
# 26| 0: [ObjectCreation] object creation of type Object
# 26| 1: [ConstantPatternExpr,StringLiteral] "abc"
# 26| 1: [LocalVariableAccess] access to local variable b
# 27| 2: [ExprStmt] ...;
# 27| 0: [AssignExpr] ... = ...
# 27| 0: [IsExpr] ... is ...
# 27| 0: [StringLiteral] ""
# 27| 1: [ConstantPatternExpr,NullLiteral] null
# 27| 1: [LocalVariableAccess] access to local variable b
# 28| 3: [ExprStmt] ...;
# 28| 0: [AssignExpr] ... = ...
# 28| 0: [IsExpr] ... is ...
# 28| 0: [LocalVariableAccess] access to local variable b
# 28| 1: [BoolLiteral,ConstantPatternExpr] true
# 28| 1: [LocalVariableAccess] access to local variable b

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,39 @@
csharp72.cs:
# 5| [Class] InModifiers
# 7| 5: [Struct] S
# 11| 6: [Method] F
#-----| 2: (Parameters)
# 11| 0: [Parameter] s
# 12| 4: [BlockStmt] {...}
# 15| 7: [Method] CallF
# 16| 4: [BlockStmt] {...}
# 17| 0: [LocalVariableDeclStmt] ... ...;
# 17| 0: [LocalVariableDeclAndInitExpr] S s = ...
# 17| 0: [ObjectCreation] object creation of type S
# 17| 1: [LocalVariableAccess] access to local variable s
# 18| 1: [ExprStmt] ...;
# 18| 0: [MethodCall] call to method F
# 18| 0: [LocalVariableAccess] access to local variable s
# 22| [Class] RefReadonlyReturns
# 24| 5: [Field] s
# 26| 6: [Method] F
# 27| 4: [BlockStmt] {...}
# 28| 0: [ReturnStmt] return ...;
# 28| 0: [RefExpr] ref ...
# 28| 0: [FieldAccess] access to field s
# 31| 7: [DelegateType] Del
# 46| [Class] NumericLiterals
# 48| 5: [Field] binaryValue
# 48| 1: [AssignExpr] ... = ...
# 48| 0: [IntLiteral] 85
# 48| 1: [FieldAccess] access to field binaryValue
# 51| [Class] PrivateProtected
# 53| 5: [Field] X
# 53| 1: [AssignExpr] ... = ...
# 53| 0: [IntLiteral] 1
# 53| 1: [FieldAccess] access to field X
# 55| 6: [Method] F
# 55| 4: [BlockStmt] {...}
# 34| [Struct] ReadonlyStruct
# 38| [Struct] RefStruct
# 42| [Struct] ReadonlyRefStruct

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,80 @@
csharp73.cs:
# 5| [Class] StackAllocs
# 7| 5: [Method] Fn
# 8| 4: [BlockStmt] {...}
# 9| 0: [LocalVariableDeclStmt] ... ...;
# 9| 0: [LocalVariableDeclAndInitExpr] Char* arr1 = ...
# 9| 0: [Stackalloc] array creation of type Char*
# 9| -1: [ArrayInitializer] { ..., ... }
# 9| 0: [CharLiteral] x
# 9| 1: [CharLiteral] y
# 9| 1: [LocalVariableAccess] access to local variable arr1
# 10| 1: [LocalVariableDeclStmt] ... ...;
# 10| 0: [LocalVariableDeclAndInitExpr] Char* arr2 = ...
# 10| 0: [Stackalloc] array creation of type Char*
# 10| -1: [ArrayInitializer] { ..., ... }
# 10| 0: [CharLiteral] x
# 10| 0: [IntLiteral] 1
# 10| 1: [LocalVariableAccess] access to local variable arr2
# 11| 2: [LocalVariableDeclStmt] ... ...;
# 11| 0: [LocalVariableDeclAndInitExpr] Char[] arr3 = ...
# 11| 0: [ArrayCreation] array creation of type Char[]
# 11| -1: [ArrayInitializer] { ..., ... }
# 11| 0: [CharLiteral] x
# 11| 1: [LocalVariableAccess] access to local variable arr3
# 12| 3: [LocalVariableDeclStmt] ... ...;
# 12| 0: [LocalVariableDeclAndInitExpr] Char* arr4 = ...
# 12| 0: [Stackalloc] array creation of type Char*
# 12| 0: [IntLiteral] 10
# 12| 1: [LocalVariableAccess] access to local variable arr4
# 13| 4: [LocalVariableDeclStmt] ... ...;
# 13| 0: [LocalVariableDeclAndInitExpr] Char[] arr5 = ...
# 13| 0: [ArrayCreation] array creation of type Char[]
# 13| 0: [IntLiteral] 10
# 13| 1: [LocalVariableAccess] access to local variable arr5
# 14| 5: [LocalVariableDeclStmt] ... ...;
# 14| 0: [LocalVariableDeclAndInitExpr] Int32* arr6 = ...
# 14| 0: [Stackalloc] array creation of type Int32*
# 14| -1: [ArrayInitializer] { ..., ... }
# 14| 0: [IntLiteral] 1
# 14| 1: [IntLiteral] 2
# 14| 2: [IntLiteral] 3
# 14| 1: [LocalVariableAccess] access to local variable arr6
# 18| [Class] PinnedReference
# 20| 5: [Method] F
# 21| 4: [BlockStmt] {...}
# 22| 0: [LocalVariableDeclStmt] ... ...;
# 22| 0: [LocalVariableDeclAndInitExpr] Span<Int32> t = ...
# 22| 0: [OperatorCall] call to operator implicit conversion
# 22| 0: [ArrayCreation] array creation of type Int32[]
# 22| 0: [IntLiteral] 10
# 22| 1: [LocalVariableAccess] access to local variable t
# 25| 1: [BlockStmt] {...}
# 42| [Class] ExpressionVariables
# 44| 4: [InstanceConstructor] ExpressionVariables
#-----| 2: (Parameters)
# 44| 0: [Parameter] x
# 45| 4: [BlockStmt] {...}
# 46| 0: [ExprStmt] ...;
# 46| 0: [AssignExpr] ... = ...
# 46| 0: [IntLiteral] 5
# 46| 1: [ParameterAccess] access to parameter x
# 49| 5: [InstanceConstructor] ExpressionVariables
# 49| 3: [ConstructorInitializer] call to constructor ExpressionVariables
# 49| 0: [LocalVariableDeclExpr] Int32 x
# 50| 4: [BlockStmt] {...}
# 51| 0: [ExprStmt] ...;
# 51| 0: [MethodCall] call to method WriteLine
# 51| -1: [TypeAccess] access to type Console
# 51| 0: [InterpolatedStringExpr] $"..."
# 51| 0: [StringLiteral] "x is "
# 51| 1: [LocalVariableAccess] access to local variable x
# 30| [Class] UnmanagedConstraint<>
#-----| 1: (Type parameters)
# 30| 0: [TypeParameter] T
# 34| [Class] EnumConstraint<>
#-----| 1: (Type parameters)
# 34| 0: [TypeParameter] T
# 38| [Class] DelegateConstraint<>
#-----| 1: (Type parameters)
# 38| 0: [TypeParameter] T

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,793 @@
CSharp7.cs:
# 7| [Class] Literals
# 9| 5: [Field] x
# 9| 1: [AssignExpr] ... = ...
# 9| 0: [IntLiteral] 11
# 9| 1: [FieldAccess] access to field x
# 10| 6: [Field] y
# 10| 1: [AssignExpr] ... = ...
# 10| 0: [IntLiteral] 123456
# 10| 1: [FieldAccess] access to field y
# 11| 7: [Field] z
# 11| 1: [AssignExpr] ... = ...
# 11| 0: [IntLiteral] 128
# 11| 1: [FieldAccess] access to field z
# 14| [Class] ExpressionBodiedMembers
# 16| 4: [Field] field
# 16| 1: [AssignExpr] ... = ...
# 16| 0: [IntLiteral] 0
# 16| 1: [FieldAccess] access to field field
# 17| 5: [Method] Foo
# 17| 4: [FieldAccess] access to field field
# 18| 6: [Property] P
# 18| 3: [Getter] get_P
# 18| 4: [IntLiteral] 5
# 19| 7: [Property] Q
# 21| 3: [Getter] get_Q
# 21| 4: [MethodCall] call to method Foo
# 22| 4: [Setter] set_Q
#-----| 2: (Parameters)
# 22| 0: [Parameter] value
# 22| 4: [AssignExpr] ... = ...
# 22| 0: [ParameterAccess] access to parameter value
# 22| 1: [FieldAccess] access to field field
# 24| 8: [InstanceConstructor] ExpressionBodiedMembers
# 24| 3: [ConstructorInitializer] call to constructor ExpressionBodiedMembers
# 24| 0: [IntLiteral] 1
# 24| 4: [BlockStmt] {...}
# 25| 9: [InstanceConstructor] ExpressionBodiedMembers
#-----| 2: (Parameters)
# 25| 0: [Parameter] x
# 25| 4: [MethodCall] call to method Foo
# 26| 10: [Destructor] ~ExpressionBodiedMembers
# 26| 4: [MethodCall] call to method Foo
# 29| [Class] ThrowExpr
# 31| 5: [Method] Throw
#-----| 2: (Parameters)
# 31| 0: [Parameter] i
# 32| 4: [BlockStmt] {...}
# 33| 0: [ReturnStmt] return ...;
# 33| 0: [ConditionalExpr] ... ? ... : ...
# 33| 0: [GTExpr] ... > ...
# 33| 0: [ParameterAccess] access to parameter i
# 33| 1: [IntLiteral] 0
# 33| 1: [ParameterAccess] access to parameter i
# 33| 2: [ThrowExpr] throw ...
# 33| 0: [ObjectCreation] object creation of type ArgumentException
# 33| 0: [StringLiteral] "i"
# 37| [Class] OutVariables
# 39| 5: [Method] F
#-----| 2: (Parameters)
# 39| 0: [Parameter] x
# 40| 4: [BlockStmt] {...}
# 41| 0: [ExprStmt] ...;
# 41| 0: [AssignExpr] ... = ...
# 41| 0: [StringLiteral] "tainted"
# 41| 1: [ParameterAccess] access to parameter x
# 44| 6: [Method] G
#-----| 2: (Parameters)
# 44| 0: [Parameter] x
# 44| 1: [Parameter] y
# 45| 4: [BlockStmt] {...}
# 46| 0: [ExprStmt] ...;
# 46| 0: [AssignExpr] ... = ...
# 46| 0: [ParameterAccess] access to parameter x
# 46| 1: [ParameterAccess] access to parameter y
# 49| 7: [Method] G
# 50| 4: [BlockStmt] {...}
# 51| 0: [ExprStmt] ...;
# 51| 0: [MethodCall] call to method F
# 51| 0: [LocalVariableAccess,LocalVariableDeclExpr] String t1
# 52| 1: [ExprStmt] ...;
# 52| 0: [MethodCall] call to method F
# 52| 0: [LocalVariableAccess,LocalVariableDeclExpr] String t2
# 53| 2: [LocalVariableDeclStmt] ... ...;
# 53| 0: [LocalVariableDeclAndInitExpr] String t3 = ...
# 53| 0: [LocalVariableAccess] access to local variable t1
# 53| 1: [LocalVariableAccess] access to local variable t3
# 54| 3: [ExprStmt] ...;
# 54| 0: [MethodCall] call to method F
# 54| 0: [LocalVariableAccess] access to local variable t1
# 55| 4: [ExprStmt] ...;
# 55| 0: [AssignExpr] ... = ...
# 55| 0: [LocalVariableAccess] access to local variable t1
# 55| 1: [LocalVariableAccess] access to local variable t3
# 56| 5: [ExprStmt] ...;
# 56| 0: [AssignExpr] ... = ...
# 56| 0: [LocalVariableAccess] access to local variable t2
# 56| 1: [LocalVariableAccess] access to local variable t3
# 57| 6: [ExprStmt] ...;
# 57| 0: [MethodCall] call to method G
# 57| 0: [StringLiteral] "tainted"
# 57| 1: [LocalVariableAccess,LocalVariableDeclExpr] String t4
# 58| 7: [LocalVariableDeclStmt] ... ...;
# 58| 0: [LocalVariableDeclAndInitExpr] String t5 = ...
# 58| 0: [LocalVariableAccess] access to local variable t4
# 58| 1: [LocalVariableAccess] access to local variable t5
# 62| [Class] Tuples
# 64| 5: [Method] F
# 65| 4: [BlockStmt] {...}
# 66| 0: [ReturnStmt] return ...;
# 66| 0: [TupleExpr] (..., ...)
# 66| 0: [IntLiteral] 1
# 66| 1: [IntLiteral] 2
# 69| 6: [Method] Expressions
# 70| 4: [BlockStmt] {...}
# 71| 0: [ExprStmt] ...;
# 71| 0: [AssignExpr] ... = ...
# 71| 0: [MethodCall] call to method F
# 71| 1: [TupleExpr] (..., ...)
# 71| 0: [LocalVariableDeclExpr] Int32 x
# 71| 1: [LocalVariableDeclExpr] Int32 y
# 72| 1: [LocalVariableDeclStmt] ... ...;
# 72| 0: [LocalVariableDeclAndInitExpr] (Int32,Int32) z = ...
# 72| 0: [MethodCall] call to method F
# 72| 1: [LocalVariableAccess] access to local variable z
# 73| 2: [ExprStmt] ...;
# 73| 0: [AssignExpr] ... = ...
# 73| 0: [MethodCall] call to method F
# 73| 1: [TupleExpr] (..., ...)
# 73| 0: [LocalVariableAccess] access to local variable x
# 73| 1: [LocalVariableAccess] access to local variable y
# 74| 3: [ExprStmt] ...;
# 74| 0: [AssignExpr] ... = ...
# 74| 0: [FieldAccess] access to field Item1
# 74| -1: [MethodCall] call to method F
# 74| 1: [LocalVariableAccess] access to local variable x
# 75| 4: [ExprStmt] ...;
# 75| 0: [AssignExpr] ... = ...
# 75| 0: [TupleExpr] (..., ...)
# 75| 0: [IntLiteral] 1
# 75| 1: [IntLiteral] 2
# 75| 2: [IntLiteral] 3
# 75| 1: [TupleExpr] (..., ...)
# 75| 0: [LocalVariableAccess] access to local variable x
# 75| 1: [LocalVariableAccess] access to local variable y
# 75| 2: [FieldAccess] access to field Item1
# 75| -1: [LocalVariableAccess] access to local variable z
# 76| 5: [ExprStmt] ...;
# 76| 0: [AssignExpr] ... = ...
# 76| 0: [AssignExpr] ... = ...
# 76| 0: [TupleExpr] (..., ...)
# 76| 0: [IntLiteral] 1
# 76| 1: [IntLiteral] 2
# 76| 1: [TupleExpr] (..., ...)
# 76| 0: [LocalVariableAccess] access to local variable x
# 76| 1: [LocalVariableAccess] access to local variable y
# 76| 1: [TupleExpr] (..., ...)
# 76| 0: [LocalVariableAccess] access to local variable x
# 76| 1: [LocalVariableAccess] access to local variable y
# 77| 6: [ExprStmt] ...;
# 77| 0: [AssignExpr] ... = ...
# 77| 0: [TupleExpr] (..., ...)
# 77| 0: [IntLiteral] 1
# 77| 1: [LocalVariableAccess] access to local variable z
# 77| 1: [TupleExpr] (..., ...)
# 77| 0: [LocalVariableDeclExpr] Int32 a
# 77| 1: [TupleExpr] (..., ...)
# 77| 0: [LocalVariableDeclExpr] Int32 b
# 77| 1: [LocalVariableDeclExpr] Int32 c
# 78| 7: [ExprStmt] ...;
# 78| 0: [AssignExpr] ... = ...
# 78| 0: [TupleExpr] (..., ...)
# 78| 0: [LocalVariableAccess] access to local variable b
# 78| 1: [TupleExpr] (..., ...)
# 78| 0: [LocalVariableAccess] access to local variable c
# 78| 1: [LocalVariableAccess] access to local variable a
# 78| 1: [TupleExpr] (..., ...)
# 78| 0: [LocalVariableAccess] access to local variable a
# 78| 1: [TupleExpr] (..., ...)
# 78| 0: [LocalVariableAccess] access to local variable b
# 78| 1: [LocalVariableAccess] access to local variable c
# 79| 8: [ExprStmt] ...;
# 79| 0: [AssignExpr] ... = ...
# 79| 0: [TupleExpr] (..., ...)
# 79| 0: [StringLiteral] ""
# 79| 1: [LocalVariableAccess] access to local variable x
# 79| 1: [TupleExpr] (..., ...)
# 79| 0: [LocalVariableDeclExpr] String i
# 79| 1: [LocalVariableDeclExpr] Int32 j
# 82| 7: [Method] I
#-----| 2: (Parameters)
# 82| 0: [Parameter] x
# 83| 4: [BlockStmt] {...}
# 84| 0: [ReturnStmt] return ...;
# 84| 0: [FieldAccess] access to field a
# 84| -1: [TupleExpr] (..., ...)
# 84| 0: [ParameterAccess] access to parameter x
# 84| 1: [IntLiteral] 2
# 87| 8: [Method] TaintFlow
# 88| 4: [BlockStmt] {...}
# 89| 0: [LocalVariableDeclStmt] ... ...;
# 89| 0: [LocalVariableDeclAndInitExpr] (String,String) t1 = ...
# 89| 0: [TupleExpr] (..., ...)
# 89| 0: [StringLiteral] "tainted"
# 89| 1: [StringLiteral] "X2"
# 89| 1: [LocalVariableAccess] access to local variable t1
# 90| 1: [ExprStmt] ...;
# 90| 0: [AssignExpr] ... = ...
# 90| 0: [LocalVariableAccess] access to local variable t1
# 90| 1: [TupleExpr] (..., ...)
# 90| 0: [LocalVariableDeclExpr] String t2
# 90| 1: [LocalVariableDeclExpr] String t3
# 91| 2: [LocalVariableDeclStmt] ... ...;
# 91| 0: [LocalVariableDeclAndInitExpr] String t4 = ...
# 91| 0: [LocalVariableAccess] access to local variable t3
# 91| 1: [LocalVariableAccess] access to local variable t4
# 92| 3: [LocalVariableDeclStmt] ... ...;
# 92| 0: [LocalVariableDeclAndInitExpr] String t5 = ...
# 92| 0: [MethodCall] call to method I
# 92| 0: [FieldAccess] access to field Item1
# 92| -1: [LocalVariableAccess] access to local variable t1
# 92| 1: [LocalVariableAccess] access to local variable t5
# 95| 9: [Method] TupleExprNode
# 96| 4: [BlockStmt] {...}
# 97| 0: [LocalVariableDeclStmt] ... ...;
# 97| 0: [LocalVariableDeclAndInitExpr] (Int32,String) m1 = ...
# 97| 0: [TupleExpr] (..., ...)
# 97| 0: [IntLiteral] 1
# 97| 1: [StringLiteral] "TupleExprNode1"
# 97| 1: [LocalVariableAccess] access to local variable m1
# 98| 1: [LocalVariableDeclStmt] ... ...;
# 98| 0: [LocalVariableDeclAndInitExpr] (Int32,(String,Int32)) m2 = ...
# 98| 0: [TupleExpr] (..., ...)
# 98| 0: [IntLiteral] 1
# 98| 1: [TupleExpr] (..., ...)
# 98| 0: [StringLiteral] "TupleExprNode2"
# 98| 1: [IntLiteral] 2
# 98| 1: [LocalVariableAccess] access to local variable m2
# 101| 10: [Method] TupleMemberAccess
# 102| 4: [BlockStmt] {...}
# 103| 0: [LocalVariableDeclStmt] ... ...;
# 103| 0: [LocalVariableDeclAndInitExpr] String m1 = ...
# 103| 0: [FieldAccess] access to field Item1
# 103| -1: [TupleExpr] (..., ...)
# 103| 0: [StringLiteral] "TupleMemberAccess1"
# 103| 1: [IntLiteral] 0
# 103| 1: [LocalVariableAccess] access to local variable m1
# 104| 1: [LocalVariableDeclStmt] ... ...;
# 104| 0: [LocalVariableDeclAndInitExpr] (String,Int32) m2 = ...
# 104| 0: [FieldAccess] access to field Item2
# 104| -1: [TupleExpr] (..., ...)
# 104| 0: [IntLiteral] 0
# 104| 1: [TupleExpr] (..., ...)
# 104| 0: [StringLiteral] "TupleMemberAccess2"
# 104| 1: [IntLiteral] 1
# 104| 1: [LocalVariableAccess] access to local variable m2
# 107| 11: [Method] DefUse
# 108| 4: [BlockStmt] {...}
# 109| 0: [ExprStmt] ...;
# 109| 0: [AssignExpr] ... = ...
# 109| 0: [TupleExpr] (..., ...)
# 109| 0: [StringLiteral] "DefUse1"
# 109| 1: [TupleExpr] (..., ...)
# 109| 0: [IntLiteral] 0
# 109| 1: [IntLiteral] 1
# 109| 1: [TupleExpr] (..., ...)
# 109| 0: [LocalVariableDeclExpr] String m1
# 109| 1: [LocalVariableDeclExpr] (Int32,Int32) m2
# 110| 1: [LocalVariableDeclStmt] ... ...;
# 110| 0: [LocalVariableDeclExpr] String m3
# 111| 2: [LocalVariableDeclStmt] ... ...;
# 111| 0: [LocalVariableDeclExpr] Int32 m4
# 111| 1: [LocalVariableDeclExpr] Int32 m5
# 112| 3: [ExprStmt] ...;
# 112| 0: [AssignExpr] ... = ...
# 112| 0: [TupleExpr] (..., ...)
# 112| 0: [LocalVariableAccess] access to local variable m1
# 112| 1: [LocalVariableAccess] access to local variable m2
# 112| 1: [TupleExpr] (..., ...)
# 112| 0: [LocalVariableAccess] access to local variable m3
# 112| 1: [TupleExpr] (..., ...)
# 112| 0: [LocalVariableAccess] access to local variable m4
# 112| 1: [LocalVariableAccess] access to local variable m5
# 113| 4: [LocalVariableDeclStmt] ... ...;
# 113| 0: [LocalVariableDeclAndInitExpr] Int32 m6 = ...
# 113| 0: [LocalVariableAccess] access to local variable m4
# 113| 1: [LocalVariableAccess] access to local variable m6
# 114| 5: [ExprStmt] ...;
# 114| 0: [AssignExpr] ... = ...
# 114| 0: [AssignExpr] ... = ...
# 114| 0: [TupleExpr] (..., ...)
# 114| 0: [StringLiteral] "DefUse2"
# 114| 1: [TupleExpr] (..., ...)
# 114| 0: [IntLiteral] 0
# 114| 1: [IntLiteral] 1
# 114| 1: [TupleExpr] (..., ...)
# 114| 0: [LocalVariableAccess] access to local variable m1
# 114| 1: [LocalVariableAccess] access to local variable m2
# 114| 1: [TupleExpr] (..., ...)
# 114| 0: [LocalVariableDeclExpr] String m7
# 114| 1: [TupleExpr] (..., ...)
# 114| 0: [LocalVariableDeclExpr] Int32 m8
# 114| 1: [LocalVariableDeclExpr] Int32 m9
# 115| 6: [LocalVariableDeclStmt] ... ...;
# 115| 0: [LocalVariableDeclAndInitExpr] Int32 m10 = ...
# 115| 0: [LocalVariableAccess] access to local variable m9
# 115| 1: [LocalVariableAccess] access to local variable m10
# 118| 7: [ExprStmt] ...;
# 118| 0: [AssignExpr] ... = ...
# 118| 0: [IntLiteral] 0
# 118| 1: [FieldAccess] access to field Item2
# 118| -1: [LocalVariableAccess] access to local variable m2
# 119| 8: [LocalVariableDeclStmt] ... ...;
# 119| 0: [LocalVariableDeclAndInitExpr] Int32 m11 = ...
# 119| 0: [FieldAccess] access to field Item1
# 119| -1: [LocalVariableAccess] access to local variable m2
# 119| 1: [LocalVariableAccess] access to local variable m11
# 122| 9: [LocalVariableDeclStmt] ... ...;
# 122| 0: [LocalVariableDeclExpr] String m12
# 123| 10: [LocalVariableDeclStmt] ... ...;
# 123| 0: [LocalVariableDeclAndInitExpr] String m13 = ...
# 123| 0: [AssignExpr] ... = ...
# 123| 0: [StringLiteral] "DefUse3"
# 123| 1: [LocalVariableAccess] access to local variable m12
# 123| 1: [LocalVariableAccess] access to local variable m13
# 127| [Class] LocalFunctions
# 129| 5: [Method] Main
# 130| 4: [BlockStmt] {...}
# 131| 0: [LocalFunctionStmt] f1(...)
# 131| 0: [LocalFunction] f1
#-----| 2: (Parameters)
# 131| 0: [Parameter] x
# 131| 4: [BlockStmt] {...}
# 131| 0: [ReturnStmt] return ...;
# 131| 0: [AddExpr] ... + ...
# 131| 0: [ParameterAccess] access to parameter x
# 131| 1: [IntLiteral] 1
# 133| 1: [LocalFunctionStmt] f2(...)
# 133| 0: [LocalFunction] f2
#-----| 1: (Type parameters)
# 133| 0: [TypeParameter] T
# 133| 1: [TypeParameter] U
#-----| 2: (Parameters)
# 133| 0: [Parameter] t
# 133| 1: [Parameter] u
# 133| 4: [BlockStmt] {...}
# 133| 0: [ReturnStmt] return ...;
# 133| 0: [ParameterAccess] access to parameter t
# 135| 2: [LocalVariableDeclStmt] ... ...;
# 135| 0: [LocalVariableDeclAndInitExpr] Func<Int32> f4 = ...
# 135| 0: [ImplicitDelegateCreation] delegate creation of type Func<Int32>
# 135| 0: [LocalFunctionAccess] access to local function f3
# 135| 1: [LocalVariableAccess] access to local variable f4
# 137| 3: [LocalFunctionStmt] f3(...)
# 137| 0: [LocalFunction] f3
# 137| 4: [IntLiteral] 2
# 139| 4: [LocalVariableDeclStmt] ... ...;
# 139| 0: [LocalVariableDeclAndInitExpr] Func<Int32,Int32> f5 = ...
# 139| 0: [LambdaExpr] (...) => ...
#-----| 2: (Parameters)
# 139| 0: [Parameter] x
# 139| 4: [AddExpr] ... + ...
# 139| 0: [ParameterAccess] access to parameter x
# 139| 1: [IntLiteral] 1
# 139| 1: [LocalVariableAccess] access to local variable f5
# 141| 5: [LocalFunctionStmt] f6(...)
# 141| 0: [LocalFunction] f6
#-----| 2: (Parameters)
# 141| 0: [Parameter] x
# 141| 4: [ConditionalExpr] ... ? ... : ...
# 141| 0: [GTExpr] ... > ...
# 141| 0: [ParameterAccess] access to parameter x
# 141| 1: [IntLiteral] 0
# 141| 1: [AddExpr] ... + ...
# 141| 0: [IntLiteral] 1
# 141| 1: [LocalFunctionCall] call to local function f7
# 141| -1: [LocalFunctionAccess] access to local function f7
# 141| 0: [SubExpr] ... - ...
# 141| 0: [ParameterAccess] access to parameter x
# 141| 1: [IntLiteral] 1
# 141| 2: [IntLiteral] 0
# 143| 6: [LocalFunctionStmt] f7(...)
# 143| 0: [LocalFunction] f7
#-----| 2: (Parameters)
# 143| 0: [Parameter] x
# 143| 4: [LocalFunctionCall] call to local function f6
# 143| -1: [LocalFunctionAccess] access to local function f6
# 143| 0: [ParameterAccess] access to parameter x
# 145| 7: [LocalFunctionStmt] f8(...)
# 145| 0: [LocalFunction] f8
# 146| 4: [BlockStmt] {...}
# 147| 0: [LocalFunctionStmt] f9(...)
# 147| 0: [LocalFunction] f9
#-----| 2: (Parameters)
# 147| 0: [Parameter] x
# 147| 4: [LocalFunctionCall] call to local function f7
# 147| -1: [LocalFunctionAccess] access to local function f7
# 147| 0: [ParameterAccess] access to parameter x
# 148| 1: [ReturnStmt] return ...;
# 148| 0: [LocalFunctionCall] call to local function f9
# 148| -1: [LocalFunctionAccess] access to local function f9
# 148| 0: [IntLiteral] 1
# 151| 8: [LocalVariableDeclStmt] ... ...;
# 151| 0: [LocalVariableDeclAndInitExpr] Action a = ...
# 151| 0: [LambdaExpr] (...) => ...
# 151| 4: [BlockStmt] {...}
# 152| 0: [LocalFunctionStmt] f9(...)
# 152| 0: [LocalFunction] f9
# 152| 4: [IntLiteral] 0
# 151| 1: [LocalVariableAccess] access to local variable a
# 155| 9: [ReturnStmt] return ...;
# 155| 0: [LocalFunctionCall] call to local function f1
# 155| -1: [LocalFunctionAccess] access to local function f1
# 155| 0: [IntLiteral] 2
# 158| 6: [Method] Generics
# 159| 4: [BlockStmt] {...}
# 160| 0: [LocalFunctionStmt] f(...)
# 160| 0: [LocalFunction] f
#-----| 1: (Type parameters)
# 160| 0: [TypeParameter] T
# 160| 4: [IntLiteral] 1
# 161| 1: [LocalFunctionStmt] g(...)
# 161| 0: [LocalFunction] g
#-----| 1: (Type parameters)
# 161| 0: [TypeParameter] T
#-----| 2: (Parameters)
# 161| 0: [Parameter] t
# 161| 4: [ParameterAccess] access to parameter t
# 163| 2: [LocalFunctionStmt] h(...)
# 163| 0: [LocalFunction] h
#-----| 1: (Type parameters)
# 163| 0: [TypeParameter] T
# 163| 1: [TypeParameter] U
#-----| 2: (Parameters)
# 163| 0: [Parameter] t
# 163| 1: [Parameter] u
# 164| 4: [BlockStmt] {...}
# 165| 0: [LocalFunctionStmt] f2(...)
# 165| 0: [LocalFunction] f2
#-----| 1: (Type parameters)
# 165| 0: [TypeParameter] S
#-----| 2: (Parameters)
# 165| 0: [Parameter] s
# 165| 1: [Parameter] _t
# 165| 4: [LocalFunctionCall] call to local function f
# 165| -1: [LocalFunctionAccess] access to local function f
# 166| 1: [ExprStmt] ...;
# 166| 0: [LocalFunctionCall] call to local function f
# 166| -1: [LocalFunctionAccess] access to local function f
# 167| 2: [ReturnStmt] return ...;
# 167| 0: [LocalFunctionCall] call to local function g
# 167| -1: [LocalFunctionAccess] access to local function g
# 167| 0: [ParameterAccess] access to parameter u
# 170| 3: [ExprStmt] ...;
# 170| 0: [LocalFunctionCall] call to local function h
# 170| -1: [LocalFunctionAccess] access to local function h
# 170| 0: [IntLiteral] 0
# 170| 1: [IntLiteral] 0
# 171| 4: [ExprStmt] ...;
# 171| 0: [LocalFunctionCall] call to local function h
# 171| -1: [LocalFunctionAccess] access to local function h
# 171| 0: [StringLiteral] ""
# 171| 1: [BoolLiteral] true
# 174| 7: [Method] GlobalFlow
# 175| 4: [BlockStmt] {...}
# 176| 0: [LocalVariableDeclStmt] ... ...;
# 176| 0: [LocalVariableDeclAndInitExpr] String src = ...
# 176| 0: [StringLiteral] "tainted"
# 176| 1: [LocalVariableAccess] access to local variable src
# 177| 1: [LocalFunctionStmt] f(...)
# 177| 0: [LocalFunction] f
#-----| 2: (Parameters)
# 177| 0: [Parameter] s
# 177| 4: [AddExpr] ... + ...
# 177| 0: [LocalFunctionCall] call to local function g
# 177| -1: [LocalFunctionAccess] access to local function g
# 177| 0: [ParameterAccess] access to parameter s
# 177| 1: [StringLiteral] ""
# 178| 2: [LocalFunctionStmt] g(...)
# 178| 0: [LocalFunction] g
#-----| 2: (Parameters)
# 178| 0: [Parameter] s
# 178| 4: [ParameterAccess] access to parameter s
# 179| 3: [LocalFunctionStmt] h(...)
# 179| 0: [LocalFunction] h
#-----| 2: (Parameters)
# 179| 0: [Parameter] s
# 179| 4: [BlockStmt] {...}
# 179| 0: [ReturnStmt] return ...;
# 179| 0: [ParameterAccess] access to parameter s
# 181| 4: [LocalVariableDeclStmt] ... ...;
# 181| 0: [LocalVariableDeclAndInitExpr] String sink1 = ...
# 181| 0: [LocalFunctionCall] call to local function f
# 181| -1: [LocalFunctionAccess] access to local function f
# 181| 0: [LocalVariableAccess] access to local variable src
# 181| 1: [LocalVariableAccess] access to local variable sink1
# 182| 5: [LocalVariableDeclStmt] ... ...;
# 182| 0: [LocalVariableDeclAndInitExpr] String sink2 = ...
# 182| 0: [LocalFunctionCall] call to local function g
# 182| -1: [LocalFunctionAccess] access to local function g
# 182| 0: [LocalVariableAccess] access to local variable src
# 182| 1: [LocalVariableAccess] access to local variable sink2
# 183| 6: [LocalVariableDeclStmt] ... ...;
# 183| 0: [LocalVariableDeclAndInitExpr] String sink3 = ...
# 183| 0: [LocalFunctionCall] call to local function h
# 183| -1: [LocalFunctionAccess] access to local function h
# 183| 0: [LocalVariableAccess] access to local variable src
# 183| 1: [LocalVariableAccess] access to local variable sink3
# 187| [Class] Refs
# 189| 5: [Method] F1
# 190| 4: [BlockStmt] {...}
# 191| 0: [LocalVariableDeclStmt] ... ...;
# 191| 0: [LocalVariableDeclAndInitExpr] Int32 v1 = ...
# 191| 0: [IntLiteral] 2
# 191| 1: [LocalVariableAccess] access to local variable v1
# 192| 1: [LocalVariableDeclStmt] ... ...;
# 192| 0: [LocalVariableDeclAndInitExpr] Int32 r1 = ...
# 192| 0: [RefExpr] ref ...
# 192| 0: [LocalVariableAccess] access to local variable v1
# 192| 1: [LocalVariableAccess] access to local variable r1
# 193| 2: [LocalVariableDeclStmt] ... ...;
# 193| 0: [LocalVariableDeclAndInitExpr] Int32[] array = ...
# 193| 0: [ArrayCreation] array creation of type Int32[]
# 193| 0: [IntLiteral] 10
# 193| 1: [LocalVariableAccess] access to local variable array
# 194| 3: [ExprStmt] ...;
# 194| 0: [AssignExpr] ... = ...
# 194| 0: [IntLiteral] 3
# 194| 1: [LocalVariableAccess] access to local variable r1
# 195| 4: [ExprStmt] ...;
# 195| 0: [AssignExpr] ... = ...
# 195| 0: [ArrayAccess] access to array element
# 195| -1: [LocalVariableAccess] access to local variable array
# 195| 0: [IntLiteral] 1
# 195| 1: [LocalVariableAccess] access to local variable r1
# 196| 5: [LocalVariableDeclStmt] ... ...;
# 196| 0: [LocalVariableDeclAndInitExpr] Int32 r2 = ...
# 196| 0: [RefExpr] ref ...
# 196| 0: [ArrayAccess] access to array element
# 196| -1: [LocalVariableAccess] access to local variable array
# 196| 0: [IntLiteral] 3
# 196| 1: [LocalVariableAccess] access to local variable r2
# 197| 6: [LocalVariableDeclStmt] ... ...;
# 197| 0: [LocalVariableDeclAndInitExpr] Int32 r3 = ...
# 197| 0: [RefExpr] ref ...
# 197| 0: [LocalVariableAccess] access to local variable r1
# 197| 1: [LocalVariableAccess] access to local variable r3
# 198| 7: [ExprStmt] ...;
# 198| 0: [AssignExpr] ... = ...
# 198| 0: [MethodCall] call to method F2
# 198| 0: [LocalVariableAccess] access to local variable v1
# 198| 1: [LocalVariableAccess] access to local variable v1
# 199| 8: [LocalVariableDeclStmt] ... ...;
# 199| 0: [LocalVariableDeclAndInitExpr] Int32 r4 = ...
# 199| 0: [RefExpr] ref ...
# 199| 0: [MethodCall] call to method F2
# 199| 0: [LocalVariableAccess] access to local variable r1
# 199| 1: [LocalVariableAccess] access to local variable r4
# 200| 9: [ExprStmt] ...;
# 200| 0: [AssignExpr] ... = ...
# 200| 0: [IntLiteral] 3
# 200| 1: [MethodCall] call to method F2
# 200| 0: [LocalVariableAccess] access to local variable r1
# 203| 6: [Method] F2
#-----| 2: (Parameters)
# 203| 0: [Parameter] p
# 204| 4: [BlockStmt] {...}
# 205| 0: [LocalFunctionStmt] F3(...)
# 205| 0: [LocalFunction] F3
#-----| 2: (Parameters)
# 205| 0: [Parameter] q
# 205| 4: [BlockStmt] {...}
# 205| 0: [ReturnStmt] return ...;
# 205| 0: [RefExpr] ref ...
# 205| 0: [ParameterAccess] access to parameter q
# 206| 1: [ReturnStmt] return ...;
# 206| 0: [RefExpr] ref ...
# 206| 0: [ParameterAccess] access to parameter p
# 209| 7: [DelegateType] RefFn
#-----| 2: (Parameters)
# 209| 0: [Parameter] p
# 212| [Class] Discards
# 214| 5: [Method] f
#-----| 2: (Parameters)
# 214| 0: [Parameter] x
# 215| 4: [BlockStmt] {...}
# 216| 0: [ExprStmt] ...;
# 216| 0: [AssignExpr] ... = ...
# 216| 0: [BoolLiteral] false
# 216| 1: [ParameterAccess] access to parameter x
# 217| 1: [ReturnStmt] return ...;
# 217| 0: [TupleExpr] (..., ...)
# 217| 0: [IntLiteral] 0
# 217| 1: [DoubleLiteral] 0
# 220| 6: [Method] Test
# 221| 4: [BlockStmt] {...}
# 222| 0: [ExprStmt] ...;
# 222| 0: [AssignExpr] ... = ...
# 222| 0: [MethodCall] call to method f
# 222| 0: [DiscardExpr] _
# 222| 1: [DiscardExpr] _
# 223| 1: [ExprStmt] ...;
# 223| 0: [AssignExpr] ... = ...
# 223| 0: [MethodCall] call to method f
# 223| 0: [DiscardExpr] _
# 223| 1: [TupleExpr] (..., ...)
# 223| 0: [DiscardExpr] _
# 223| 1: [DiscardExpr] _
# 224| 2: [ExprStmt] ...;
# 224| 0: [AssignExpr] ... = ...
# 224| 0: [MethodCall] call to method f
# 224| 0: [DiscardExpr] _
# 224| 1: [TupleExpr] (..., ...)
# 224| 0: [LocalVariableDeclExpr] Int32 x
# 224| 1: [DiscardExpr] _
# 225| 3: [ExprStmt] ...;
# 225| 0: [AssignExpr] ... = ...
# 225| 0: [MethodCall] call to method f
# 225| 0: [LocalVariableAccess,LocalVariableDeclExpr] Boolean z
# 225| 1: [TupleExpr] (..., ...)
# 225| 0: [DiscardExpr] _
# 225| 1: [LocalVariableDeclExpr] Double y
# 229| [Class] Patterns
# 231| 5: [Method] Test
# 232| 4: [BlockStmt] {...}
# 233| 0: [LocalVariableDeclStmt] ... ...;
# 233| 0: [LocalVariableDeclAndInitExpr] Object o = ...
# 233| 0: [NullLiteral] null
# 233| 1: [LocalVariableAccess] access to local variable o
# 234| 1: [IfStmt] if (...) ...
# 234| 0: [LogicalAndExpr] ... && ...
# 234| 0: [IsExpr] ... is ...
# 234| 0: [LocalVariableAccess] access to local variable o
# 234| 1: [VariablePatternExpr] Int32 i1
# 234| 1: [GTExpr] ... > ...
# 234| 0: [LocalVariableAccess] access to local variable i1
# 234| 1: [IntLiteral] 0
# 235| 1: [BlockStmt] {...}
# 236| 0: [ExprStmt] ...;
# 236| 0: [MethodCall] call to method WriteLine
# 236| -1: [TypeAccess] access to type Console
# 236| 0: [InterpolatedStringExpr] $"..."
# 236| 0: [StringLiteral] "int "
# 236| 1: [LocalVariableAccess] access to local variable i1
# 238| 2: [IfStmt] if (...) ...
# 238| 0: [IsExpr] ... is ...
# 238| 0: [LocalVariableAccess] access to local variable o
# 238| 1: [VariablePatternExpr] String s1
# 239| 1: [BlockStmt] {...}
# 240| 0: [ExprStmt] ...;
# 240| 0: [MethodCall] call to method WriteLine
# 240| -1: [TypeAccess] access to type Console
# 240| 0: [InterpolatedStringExpr] $"..."
# 240| 0: [StringLiteral] "string "
# 240| 1: [LocalVariableAccess] access to local variable s1
# 242| 2: [IfStmt] if (...) ...
# 242| 0: [IsExpr] ... is ...
# 242| 0: [LocalVariableAccess] access to local variable o
# 242| 1: [TypeAccessPatternExpr] access to type Double
# 243| 1: [BlockStmt] {...}
# 245| 2: [IfStmt] if (...) ...
# 245| 0: [IsExpr] ... is ...
# 245| 0: [LocalVariableAccess] access to local variable o
# 245| 1: [VariablePatternExpr] Object v1
# 246| 1: [BlockStmt] {...}
# 249| 2: [SwitchStmt] switch (...) {...}
# 249| 0: [LocalVariableAccess] access to local variable o
# 251| 0: [ConstCase] case ...:
# 251| 0: [ConstantPatternExpr,StringLiteral] "xyz"
# 252| 1: [BreakStmt] break;
# 253| 2: [ConstCase] case ...:
# 253| 0: [ConstantPatternExpr,StringLiteral] ""
# 253| 1: [LTExpr] ... < ...
# 253| 0: [IntLiteral] 1
# 253| 1: [IntLiteral] 2
# 254| 3: [BreakStmt] break;
# 255| 4: [ConstCase] case ...:
# 255| 0: [ConstantPatternExpr,StringLiteral] "x"
# 255| 1: [IsExpr] ... is ...
# 255| 0: [LocalVariableAccess] access to local variable o
# 255| 1: [VariablePatternExpr] String s4
# 256| 5: [ExprStmt] ...;
# 256| 0: [MethodCall] call to method WriteLine
# 256| -1: [TypeAccess] access to type Console
# 256| 0: [InterpolatedStringExpr] $"..."
# 256| 0: [StringLiteral] "x "
# 256| 1: [LocalVariableAccess] access to local variable s4
# 257| 6: [BreakStmt] break;
# 258| 7: [CaseStmt] case ...:
# 258| 0: [VariablePatternExpr] Int32 i2
# 258| 1: [GTExpr] ... > ...
# 258| 0: [LocalVariableAccess] access to local variable i2
# 258| 1: [IntLiteral] 0
# 259| 8: [ExprStmt] ...;
# 259| 0: [MethodCall] call to method WriteLine
# 259| -1: [TypeAccess] access to type Console
# 259| 0: [InterpolatedStringExpr] $"..."
# 259| 0: [StringLiteral] "positive "
# 259| 1: [LocalVariableAccess] access to local variable i2
# 260| 9: [BreakStmt] break;
# 261| 10: [CaseStmt] case ...:
# 261| 0: [VariablePatternExpr] Int32 i3
# 262| 11: [ExprStmt] ...;
# 262| 0: [MethodCall] call to method WriteLine
# 262| -1: [TypeAccess] access to type Console
# 262| 0: [InterpolatedStringExpr] $"..."
# 262| 0: [StringLiteral] "int "
# 262| 1: [LocalVariableAccess] access to local variable i3
# 263| 12: [BreakStmt] break;
# 264| 13: [CaseStmt] case ...:
# 264| 0: [VariablePatternExpr] String s2
# 265| 14: [ExprStmt] ...;
# 265| 0: [MethodCall] call to method WriteLine
# 265| -1: [TypeAccess] access to type Console
# 265| 0: [InterpolatedStringExpr] $"..."
# 265| 0: [StringLiteral] "string "
# 265| 1: [LocalVariableAccess] access to local variable s2
# 266| 15: [BreakStmt] break;
# 267| 16: [CaseStmt] case ...:
# 267| 0: [TypeAccessPatternExpr] access to type Double
# 268| 17: [ExprStmt] ...;
# 268| 0: [MethodCall] call to method WriteLine
# 268| -1: [TypeAccess] access to type Console
# 268| 0: [StringLiteral] "Double"
# 269| 18: [BreakStmt] break;
# 270| 19: [CaseStmt] case ...:
# 270| 0: [VariablePatternExpr] Object v2
# 271| 20: [BreakStmt] break;
# 272| 21: [DefaultCase] default:
# 273| 22: [ExprStmt] ...;
# 273| 0: [MethodCall] call to method WriteLine
# 273| -1: [TypeAccess] access to type Console
# 273| 0: [StringLiteral] "Something else"
# 274| 23: [BreakStmt] break;
# 279| [Class] ForeachStatements
# 281| 5: [Method] Test
# 282| 4: [BlockStmt] {...}
# 283| 0: [LocalVariableDeclStmt] ... ...;
# 283| 0: [LocalVariableDeclAndInitExpr] Dictionary<Int32,String> dict = ...
# 283| 0: [ObjectCreation] object creation of type Dictionary<Int32,String>
# 283| 1: [LocalVariableAccess] access to local variable dict
# 284| 1: [LocalVariableDeclStmt] ... ...;
# 284| 0: [LocalVariableDeclAndInitExpr] IEnumerable<(Int32,String)> list = ...
# 284| 0: [MethodCall] call to method Select
# 284| -1: [LocalVariableAccess] access to local variable dict
# 284| 0: [LambdaExpr] (...) => ...
#-----| 2: (Parameters)
# 284| 0: [Parameter] item
# 284| 4: [TupleExpr] (..., ...)
# 284| 0: [PropertyCall] access to property Key
# 284| -1: [ParameterAccess] access to parameter item
# 284| 1: [PropertyCall] access to property Value
# 284| -1: [ParameterAccess] access to parameter item
# 284| 1: [LocalVariableAccess] access to local variable list
# 286| 2: [ForeachStmt] foreach (... ... in ...) ...
# 286| 0: [TupleExpr] (..., ...)
# 286| 0: [LocalVariableDeclExpr] Int32 a
# 286| 1: [LocalVariableDeclExpr] String b
# 286| 1: [LocalVariableAccess] access to local variable list
# 286| 2: [BlockStmt] {...}
# 288| 3: [ForeachStmt] foreach (... ... in ...) ...
# 288| 0: [TupleExpr] (..., ...)
# 288| 0: [LocalVariableDeclExpr] Int32 a
# 288| 1: [LocalVariableDeclExpr] String b
# 288| 1: [LocalVariableAccess] access to local variable list
# 288| 2: [BlockStmt] {...}
# 290| 4: [ForeachStmt] foreach (... ... in ...) ...
# 290| 0: [TupleExpr] (..., ...)
# 290| 0: [LocalVariableDeclExpr] Int32 a
# 290| 1: [LocalVariableDeclExpr] String b
# 290| 1: [LocalVariableAccess] access to local variable list
# 290| 2: [BlockStmt] {...}
# 294| [Class] ForLoops
# 296| 5: [Method] Test
# 297| 4: [BlockStmt] {...}
# 298| 0: [ForStmt] for (...;...;...) ...
# 298| -1: [LocalVariableDeclAndInitExpr] Int32 x = ...
# 298| 0: [IntLiteral] 0
# 298| 1: [LocalVariableAccess] access to local variable x
# 298| 0: [LogicalAndExpr] ... && ...
# 298| 0: [LTExpr] ... < ...
# 298| 0: [LocalVariableAccess] access to local variable x
# 298| 1: [IntLiteral] 10
# 298| 1: [IsExpr] ... is ...
# 298| 0: [LocalVariableAccess] access to local variable x
# 298| 1: [VariablePatternExpr] Int32 y
# 298| 1: [PreIncrExpr] ++...
# 298| 0: [LocalVariableAccess] access to local variable x
# 299| 2: [BlockStmt] {...}
# 300| 0: [ExprStmt] ...;
# 300| 0: [MethodCall] call to method WriteLine
# 300| -1: [TypeAccess] access to type Console
# 300| 0: [LocalVariableAccess] access to local variable y

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,403 @@
definitions.cs:
# 4| [NamespaceDeclaration] namespace ... { ... }
# 6| 1: [Class] StaticClass
# 8| 4: [ExtensionMethod] ExtensionMethod
#-----| 2: (Parameters)
# 8| 0: [Parameter] c1
# 8| 1: [Parameter] args
# 9| 4: [BlockStmt] {...}
# 13| 2: [Enum] Enumeration
# 15| 5: [Field] e1
# 15| 1: [MemberConstantAccess] access to constant e1
# 15| 6: [Field] e2
# 15| 1: [MemberConstantAccess] access to constant e2
# 15| 7: [Field] e3
# 18| 3: [Class] C1
# 20| 4: [InstanceConstructor] C1
#-----| 2: (Parameters)
# 20| 0: [Parameter] args
# 20| 4: [BlockStmt] {...}
# 22| 5: [Field] field1
# 24| 6: [Property] property1
# 26| 3: [Getter] get_property1
# 26| 4: [BlockStmt] {...}
# 26| 0: [ReturnStmt] return ...;
# 26| 0: [FieldAccess] access to field field1
# 27| 4: [Setter] set_property1
#-----| 2: (Parameters)
# 27| 0: [Parameter] value
# 27| 4: [BlockStmt] {...}
# 27| 0: [ExprStmt] ...;
# 27| 0: [AssignExpr] ... = ...
# 27| 0: [ParameterAccess] access to parameter value
# 27| 1: [FieldAccess] access to field field1
# 30| 7: [Method] f1
#-----| 2: (Parameters)
# 30| 0: [Parameter] args
# 31| 4: [BlockStmt] {...}
# 32| 0: [LocalVariableDeclStmt] ... ...;
# 32| 0: [LocalVariableDeclAndInitExpr] C1 qualifier = ...
# 32| 0: [ThisAccess] this access
# 32| 1: [LocalVariableAccess] access to local variable qualifier
# 35| 1: [ExprStmt] ...;
# 35| 0: [MethodCall] call to method f1
# 36| 2: [ExprStmt] ...;
# 36| 0: [MethodCall] call to method f1
# 36| 0: [IntLiteral] 1
# 37| 3: [ExprStmt] ...;
# 37| 0: [MethodCall] call to method f1
# 37| 0: [IntLiteral] 1
# 37| 1: [IntLiteral] 2
# 39| 4: [ExprStmt] ...;
# 39| 0: [MethodCall] call to method f1
# 39| -1: [ThisAccess] this access
# 40| 5: [ExprStmt] ...;
# 40| 0: [MethodCall] call to method f1
# 40| -1: [ThisAccess] this access
# 40| 0: [IntLiteral] 1
# 41| 6: [ExprStmt] ...;
# 41| 0: [MethodCall] call to method f1
# 41| -1: [ThisAccess] this access
# 41| 0: [IntLiteral] 1
# 41| 1: [IntLiteral] 2
# 43| 7: [ExprStmt] ...;
# 43| 0: [MethodCall] call to method ExtensionMethod
# 43| -1: [ThisAccess] this access
# 44| 8: [ExprStmt] ...;
# 44| 0: [MethodCall] call to method ExtensionMethod
# 44| -1: [ThisAccess] this access
# 44| 0: [CastExpr] (...) ...
# 44| 0: [IntLiteral] 1
# 45| 9: [ExprStmt] ...;
# 45| 0: [MethodCall] call to method ExtensionMethod
# 45| -1: [ThisAccess] this access
# 45| 0: [CastExpr] (...) ...
# 45| 0: [IntLiteral] 1
# 45| 1: [CastExpr] (...) ...
# 45| 0: [IntLiteral] 2
# 47| 10: [ExprStmt] ...;
# 47| 0: [MethodCall] call to method GenericFn
# 47| 0: [IntLiteral] 1
# 48| 11: [ExprStmt] ...;
# 48| 0: [MethodCall] call to method GenericFn
# 48| -1: [ThisAccess] this access
# 48| 0: [IntLiteral] 2
# 51| 12: [ExprStmt] ...;
# 51| 0: [ObjectCreation] object creation of type C1
# 52| 13: [ExprStmt] ...;
# 52| 0: [ObjectCreation] object creation of type C1
# 52| 0: [IntLiteral] 1
# 53| 14: [ExprStmt] ...;
# 53| 0: [ObjectCreation] object creation of type C1
# 53| 0: [IntLiteral] 1
# 53| 1: [IntLiteral] 2
# 56| 15: [LocalVariableDeclStmt] ... ...;
# 56| 0: [LocalVariableDeclAndInitExpr] Int32 x = ...
# 56| 0: [IntLiteral] 2
# 56| 1: [LocalVariableAccess] access to local variable x
# 56| 1: [LocalVariableDeclAndInitExpr] Int32 y = ...
# 56| 0: [LocalVariableAccess] access to local variable x
# 56| 1: [LocalVariableAccess] access to local variable y
# 56| 2: [LocalVariableDeclAndInitExpr] Int32 z = ...
# 56| 0: [FieldAccess] access to field field1
# 56| 1: [LocalVariableAccess] access to local variable z
# 56| 3: [LocalVariableDeclAndInitExpr] Int32 w = ...
# 56| 0: [ArrayAccess] access to array element
# 56| -1: [ParameterAccess] access to parameter args
# 56| 0: [IntLiteral] 0
# 56| 1: [LocalVariableAccess] access to local variable w
# 57| 16: [LocalVariableDeclStmt] ... ...;
# 57| 0: [LocalVariableDeclAndInitExpr] Enumeration e = ...
# 57| 0: [MemberConstantAccess] access to constant e1
# 57| -1: [TypeAccess] access to type Enumeration
# 57| 1: [LocalVariableAccess] access to local variable e
# 60| 17: [ExprStmt] ...;
# 60| 0: [AssignExpr] ... = ...
# 60| 0: [AddExpr] ... + ...
# 60| 0: [PropertyCall] access to property property1
# 60| 1: [IntLiteral] 1
# 60| 1: [PropertyCall] access to property property1
# 63| 18: [LocalVariableDeclStmt] ... ...;
# 63| 0: [LocalVariableDeclAndInitExpr] C1[] array = ...
# 63| 0: [NullLiteral] null
# 63| 1: [LocalVariableAccess] access to local variable array
# 64| 19: [LocalVariableDeclStmt] ... ...;
# 64| 0: [LocalVariableDeclAndInitExpr] Nullable<S1> nullable = ...
# 64| 0: [NullLiteral] null
# 64| 1: [LocalVariableAccess] access to local variable nullable
# 67| 20: [LocalVariableDeclStmt] ... ...;
# 67| 0: [LocalVariableDeclAndInitExpr] Action<Int32> m1 = ...
# 67| 0: [ImplicitDelegateCreation] delegate creation of type Action<Int32>
# 67| 0: [MethodAccess] access to method GenericFn
# 67| 1: [LocalVariableAccess] access to local variable m1
# 70| 8: [Method] VariableTypeUse
#-----| 2: (Parameters)
# 70| 0: [Parameter] c1
# 71| 4: [BlockStmt] {...}
# 72| 0: [LocalVariableDeclStmt] ... ...;
# 72| 0: [LocalVariableDeclAndInitExpr] C1 c2 = ...
# 72| 0: [NullLiteral] null
# 72| 1: [LocalVariableAccess] access to local variable c2
# 75| 9: [Method] GenericFn
#-----| 1: (Type parameters)
# 75| 0: [TypeParameter] T
#-----| 2: (Parameters)
# 75| 0: [Parameter] t
# 75| 4: [BlockStmt] {...}
# 78| 4: [Struct] S1
# 80| 5: [Method] M
#-----| 2: (Parameters)
# 80| 0: [Parameter] ss
# 81| 4: [BlockStmt] {...}
# 82| 0: [TryStmt] try {...} ...
# 83| 0: [BlockStmt] {...}
# 84| 0: [LocalVariableDeclStmt] ... ...;
# 84| 0: [LocalVariableDeclAndInitExpr] String timestamp = ...
# 84| 0: [MethodCall] call to method ToString
# 84| -1: [PropertyCall] access to property Now
# 84| -1: [TypeAccess] access to type DateTime
# 84| 0: [StringLiteral] "HH:mm:ss"
# 84| 1: [LocalVariableAccess] access to local variable timestamp
# 86| 1: [SpecificCatchClause] catch (...) {...}
# 86| 0: [LocalVariableDeclExpr] Exception e
# 87| 1: [BlockStmt] {...}
# 88| 0: [ForeachStmt] foreach (... ... in ...) ...
# 88| 0: [LocalVariableDeclExpr] S1 s
# 88| 1: [ParameterAccess] access to parameter ss
# 89| 2: [BlockStmt] {...}
# 92| 1: [LocalVariableDeclStmt] ... ...;
# 92| 0: [LocalVariableDeclAndInitExpr] Type temp = ...
# 92| 0: [TypeofExpr] typeof(...)
# 92| 0: [TypeAccess] access to type S1[]
# 92| 1: [LocalVariableAccess] access to local variable temp
# 93| 2: [ReturnStmt] return ...;
# 93| 0: [ObjectCreation] object creation of type S1
# 97| 5: [Class] A
# 99| 5: [DelegateType] EventHandler
# 101| 6: [Event] Click
# 101| 3: [RemoveEventAccessor] remove_Click
#-----| 2: (Parameters)
# 101| 0: [Parameter] value
# 101| 3: [AddEventAccessor] add_Click
#-----| 2: (Parameters)
# 101| 0: [Parameter] value
# 103| 7: [Method] M
# 104| 4: [BlockStmt] {...}
# 105| 0: [ExprStmt] ...;
# 105| 0: [AddEventExpr] ... += ...
# 105| 0: [ImplicitDelegateCreation] delegate creation of type EventHandler
# 105| 0: [MethodAccess] access to method M
# 105| 1: [EventAccess,EventCall] access to event Click
# 106| 1: [LocalFunctionStmt] LocalFunction(...)
# 106| 0: [LocalFunction] LocalFunction
# 106| 4: [BlockStmt] {...}
# 106| 2: [EmptyStmt] ;
# 107| 3: [ExprStmt] ...;
# 107| 0: [AddEventExpr] ... += ...
# 107| 0: [ImplicitDelegateCreation] delegate creation of type EventHandler
# 107| 0: [LocalFunctionAccess] access to local function LocalFunction
# 107| 1: [EventAccess,EventCall] access to event Click
# 108| 4: [ExprStmt] ...;
# 108| 0: [DelegateCall] delegate call
# 108| -1: [EventAccess,EventCall] access to event Click
# 112| 6: [Interface] I1
# 114| 4: [Method] M2
#-----| 1: (Type parameters)
# 114| 0: [TypeParameter] T
# 117| 7: [Interface] I2<>
#-----| 1: (Type parameters)
# 117| 0: [TypeParameter] T
# 119| 8: [Interface] I3
#-----| 3: (Base types)
# 119| 1: [Interface] I2<Object>
# 121| 9: [Class] B<>
#-----| 1: (Type parameters)
# 121| 0: [TypeParameter] T
#-----| 3: (Base types)
# 121| 0: [Class] A
# 121| 1: [Interface] I1
# 121| 2: [Interface] I2<A>
# 123| 5: [Method] M
# 124| 4: [BlockStmt] {...}
# 125| 0: [ExprStmt] ...;
# 125| 0: [MethodCall] call to method M
# 125| -1: [BaseAccess] base access
# 128| 6: [Method] M2
#-----| 1: (Type parameters)
# 128| 0: [TypeParameter] T
# 128| 4: [BlockStmt] {...}
# 130| 7: [Struct] S<>
#-----| 1: (Type parameters)
# 130| 0: [TypeParameter] T2
#-----| 3: (Base types)
# 130| 1: [Interface] I3
# 132| 8: [Method] Tuple
# 132| 4: [ThrowExpr] throw ...
# 132| 0: [ObjectCreation] object creation of type Exception
# 134| 9: [Indexer] Item
#-----| 1: (Parameters)
# 134| 0: [Parameter] a
# 134| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 134| 0: [Parameter] a
# 134| 4: [BlockStmt] {...}
# 134| 0: [ReturnStmt] return ...;
# 134| 0: [DefaultValueExpr] default(...)
# 134| 0: [TypeAccess] access to type B<A>
# 137| 10: [Class] C
# 139| 5: [Enum] E
# 140| 6: [Method] Pointer
# 140| 4: [ThrowExpr] throw ...
# 140| 0: [ObjectCreation] object creation of type Exception
# 140| 0: [MethodCall] call to method ToString
# 140| -1: [SizeofExpr] sizeof(..)
# 140| 0: [TypeAccess] access to type E*
# 143| 11: [Interface] I4
# 145| 4: [Event] EH
# 145| 3: [RemoveEventAccessor] remove_EH
#-----| 2: (Parameters)
# 145| 0: [Parameter] value
# 145| 3: [AddEventAccessor] add_EH
#-----| 2: (Parameters)
# 145| 0: [Parameter] value
# 146| 5: [Method] M
# 147| 6: [Property] P
# 147| 3: [Getter] get_P
# 148| 7: [Indexer] Item
#-----| 1: (Parameters)
# 148| 0: [Parameter] eh
# 148| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 148| 0: [Parameter] eh
# 151| 12: [Class] C4
#-----| 3: (Base types)
# 151| 1: [Interface] I4
# 153| 5: [Event] EH
# 153| 3: [AddEventAccessor] add_EH
#-----| 2: (Parameters)
# 153| 0: [Parameter] value
# 153| 4: [BlockStmt] {...}
# 153| 4: [RemoveEventAccessor] remove_EH
#-----| 2: (Parameters)
# 153| 0: [Parameter] value
# 153| 4: [BlockStmt] {...}
# 154| 6: [Method] M
# 154| 4: [ThrowExpr] throw ...
# 154| 0: [ObjectCreation] object creation of type Exception
# 155| 7: [Property] P
# 155| 3: [Getter] get_P
# 155| 4: [ThrowExpr] throw ...
# 155| 0: [ObjectCreation] object creation of type Exception
# 156| 8: [Indexer] Item
#-----| 1: (Parameters)
# 156| 0: [Parameter] eh
# 156| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 156| 0: [Parameter] eh
# 156| 4: [BlockStmt] {...}
# 156| 0: [ReturnStmt] return ...;
# 156| 0: [CastExpr] (...) ...
# 156| 0: [ObjectCreation] object creation of type S1
# 156| 1: [TypeAccess] access to type S1
# 158| 9: [Class] Nested<>
#-----| 1: (Type parameters)
# 158| 0: [TypeParameter] T
# 160| 5: [Method] Create
# 160| 4: [BlockStmt] {...}
# 160| 0: [ReturnStmt] return ...;
# 160| 0: [ObjectCreation] object creation of type Nested<>
# 164| 13: [Class] C5
# 166| 5: [Field] f
# 166| 1: [AssignExpr] ... = ...
# 166| 0: [MethodCall] call to method Create
# 166| -1: [TypeAccess] access to type Nested<I4>
# 166| -1: [TypeAccess] access to type C4
# 166| 1: [FieldAccess] access to field f
# 167| 6: [Field] c1
# 169| 7: [Method] M
# 170| 4: [BlockStmt] {...}
# 171| 0: [LocalVariableDeclStmt] ... ...;
# 171| 0: [LocalVariableDeclAndInitExpr] C1 c = ...
# 171| 0: [ObjectCreation] object creation of type C1
# 171| 1: [LocalVariableAccess] access to local variable c
# 172| 1: [ExprStmt] ...;
# 172| 0: [AssignExpr] ... = ...
# 172| 0: [PropertyCall] access to property property1
# 172| -1: [LocalVariableAccess] access to local variable c
# 172| 1: [PropertyCall] access to property property1
# 172| -1: [LocalVariableAccess] access to local variable c
# 173| 2: [LocalVariableDeclStmt] ... ...;
# 173| 0: [LocalVariableDeclAndInitExpr] C5 c5 = ...
# 173| 0: [AsExpr] ... as ...
# 173| 0: [ObjectCreation] object creation of type C5
# 173| 1: [TypeAccess] access to type C5
# 173| 1: [LocalVariableAccess] access to local variable c5
# 174| 3: [ExprStmt] ...;
# 174| 0: [AssignExpr] ... = ...
# 174| 0: [IntLiteral] 0
# 174| 1: [PropertyCall] access to property property1
# 174| -1: [FieldAccess] access to field c1
# 174| -1: [LocalVariableAccess] access to local variable c5
# 175| 4: [LocalVariableDeclStmt] ... ...;
# 175| 0: [LocalVariableDeclAndInitExpr] Boolean temp = ...
# 175| 0: [IsExpr] ... is ...
# 175| 0: [LocalVariableAccess] access to local variable c5
# 175| 1: [TypeAccessPatternExpr] access to type Nested<I4>
# 175| 1: [LocalVariableAccess] access to local variable temp
# 179| 14: [Class] C6
# 181| 5: [ExplicitConversionOperator] explicit conversion
#-----| 2: (Parameters)
# 181| 0: [Parameter] c
#-----| 0: (Attributes)
# 181| 1: [Attribute] [My(...)]
# 182| 4: [BlockStmt] {...}
# 183| 0: [ReturnStmt] return ...;
# 183| 0: [NullLiteral] null
# 186| 6: [Method] M
# 187| 4: [BlockStmt] {...}
# 188| 0: [ReturnStmt] return ...;
# 188| 0: [OperatorCall] call to operator explicit conversion
# 188| 0: [ThisAccess] this access
# 191| 7: [AddOperator] +
#-----| 2: (Parameters)
# 191| 0: [Parameter] x
# 191| 1: [Parameter] y
# 191| 4: [ParameterAccess] access to parameter x
# 194| 15: [Class] MyAttribute
#-----| 3: (Base types)
# 194| 0: [Class] Attribute
# 196| 16: [Class] C7
# 198| 5: [Method] M
# 198| 4: [BlockStmt] {...}
# 200| 6: [Method] M2
# 201| 4: [BlockStmt] {...}
# 202| 0: [ExprStmt] ...;
# 202| 0: [MethodCall] call to method M
# 202| -1: [TypeAccess] access to type C7
# 206| 17: [Class] C8
# 208| 5: [Method] F
# 209| 4: [BlockStmt] {...}
# 210| 0: [LocalVariableDeclStmt] ... ...;
# 210| 0: [LocalVariableDeclAndInitExpr] C8 c8a = ...
# 210| 0: [NullLiteral] null
# 210| 1: [LocalVariableAccess] access to local variable c8a
# 211| 1: [IfStmt] if (...) ...
# 211| 0: [IsExpr] ... is ...
# 211| 0: [LocalVariableAccess] access to local variable c8a
# 211| 1: [VariablePatternExpr] C8 c8b
# 212| 1: [ExprStmt] ...;
# 212| 0: [AssignExpr] ... = ...
# 212| 0: [LocalVariableAccess] access to local variable c8b
# 212| 1: [LocalVariableAccess] access to local variable c8a
# 213| 2: [SwitchStmt] switch (...) {...}
# 213| 0: [LocalVariableAccess] access to local variable c8a
# 215| 0: [CaseStmt] case ...:
# 215| 0: [VariablePatternExpr] C8 c8c
# 215| 1: [NEExpr] ... != ...
# 215| 0: [LocalVariableAccess] access to local variable c8c
# 215| 1: [NullLiteral] null
# 216| 1: [ExprStmt] ...;
# 216| 0: [AssignExpr] ... = ...
# 216| 0: [LocalVariableAccess] access to local variable c8c
# 216| 1: [LocalVariableAccess] access to local variable c8a
# 217| 2: [BreakStmt] break;

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,190 @@
delegates.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 7| 1: [DelegateType] FooDelegate
#-----| 2: (Parameters)
# 7| 0: [Parameter] param
# 7| 1: [Parameter] condition
# 7| 2: [Parameter] args
# 9| 2: [DelegateType] D1
#-----| 2: (Parameters)
# 9| 0: [Parameter] i
# 9| 1: [Parameter] d
# 11| 3: [Class] A
# 14| 5: [Method] M1
#-----| 2: (Parameters)
# 14| 0: [Parameter] a
# 14| 1: [Parameter] b
# 14| 4: [BlockStmt] {...}
# 14| 0: [ReturnStmt] return ...;
# 14| 0: [CastExpr] (...) ...
# 14| 0: [AddExpr] ... + ...
# 14| 0: [CastExpr] (...) ...
# 14| 0: [ParameterAccess] access to parameter a
# 14| 1: [ParameterAccess] access to parameter b
# 14| 1: [TypeAccess] access to type Int32
# 18| 4: [Class] B
# 21| 5: [DelegateType] D2
#-----| 2: (Parameters)
# 21| 0: [Parameter] c
# 21| 1: [Parameter] d
# 23| 6: [Method] M1
#-----| 2: (Parameters)
# 23| 0: [Parameter] f
# 23| 1: [Parameter] g
# 23| 4: [BlockStmt] {...}
# 23| 0: [ReturnStmt] return ...;
# 23| 0: [SubExpr] ... - ...
# 23| 0: [ParameterAccess] access to parameter f
# 23| 1: [CastExpr] (...) ...
# 23| 0: [ParameterAccess] access to parameter g
# 23| 1: [TypeAccess] access to type Int32
# 25| 7: [Method] M2
#-----| 2: (Parameters)
# 25| 0: [Parameter] k
# 25| 1: [Parameter] l
# 25| 4: [BlockStmt] {...}
# 27| 8: [Method] M3
#-----| 2: (Parameters)
# 27| 0: [Parameter] g
# 27| 4: [BlockStmt] {...}
# 27| 0: [ReturnStmt] return ...;
# 27| 0: [AddExpr] ... + ...
# 27| 0: [UnaryMinusExpr] -...
# 27| 0: [ParameterAccess] access to parameter g
# 27| 1: [UnaryPlusExpr] +...
# 27| 0: [ParameterAccess] access to parameter g
# 29| 9: [Method] M4
#-----| 2: (Parameters)
# 29| 0: [Parameter] g
# 29| 4: [BlockStmt] {...}
# 33| 5: [DelegateType] Predicate<>
#-----| 1: (Type parameters)
# 33| 0: [TypeParameter] T
#-----| 2: (Parameters)
# 33| 0: [Parameter] value
# 35| 6: [Class] X
# 38| 5: [Method] F
#-----| 2: (Parameters)
# 38| 0: [Parameter] i
# 38| 4: [BlockStmt] {...}
# 38| 0: [ReturnStmt] return ...;
# 38| 0: [LTExpr] ... < ...
# 38| 0: [ParameterAccess] access to parameter i
# 38| 1: [IntLiteral] 2
# 40| 6: [Method] G
#-----| 2: (Parameters)
# 40| 0: [Parameter] s
# 40| 4: [BlockStmt] {...}
# 40| 0: [ReturnStmt] return ...;
# 40| 0: [BoolLiteral] false
# 44| 7: [DelegateType] D
#-----| 2: (Parameters)
# 44| 0: [Parameter] x
# 46| 8: [Class] C
# 49| 5: [Method] M1
#-----| 2: (Parameters)
# 49| 0: [Parameter] i
# 49| 4: [BlockStmt] {...}
# 50| 6: [Method] M2
#-----| 2: (Parameters)
# 50| 0: [Parameter] i
# 50| 4: [BlockStmt] {...}
# 51| 7: [Method] M3
#-----| 2: (Parameters)
# 51| 0: [Parameter] i
# 51| 4: [BlockStmt] {...}
# 55| 9: [Class] Test
# 58| 5: [Method] Main
# 59| 4: [BlockStmt] {...}
# 60| 0: [LocalVariableDeclStmt] ... ...;
# 60| 0: [LocalVariableDeclAndInitExpr] D cd1 = ...
# 60| 0: [ExplicitDelegateCreation] delegate creation of type D
# 60| 0: [MethodAccess] access to method M1
# 60| -1: [TypeAccess] access to type C
# 60| 1: [LocalVariableAccess] access to local variable cd1
# 61| 1: [LocalVariableDeclStmt] ... ...;
# 61| 0: [LocalVariableDeclAndInitExpr] D cd2 = ...
# 61| 0: [ImplicitDelegateCreation] delegate creation of type D
# 61| 0: [MethodAccess] access to method M2
# 61| -1: [TypeAccess] access to type C
# 61| 1: [LocalVariableAccess] access to local variable cd2
# 62| 2: [LocalVariableDeclStmt] ... ...;
# 62| 0: [LocalVariableDeclAndInitExpr] D cd3 = ...
# 62| 0: [OperatorCall] call to operator +
# 62| 0: [LocalVariableAccess] access to local variable cd1
# 62| 1: [LocalVariableAccess] access to local variable cd2
# 62| 1: [LocalVariableAccess] access to local variable cd3
# 63| 3: [LocalVariableDeclStmt] ... ...;
# 63| 0: [LocalVariableDeclAndInitExpr] D cd4 = ...
# 63| 0: [OperatorCall] call to operator +
# 63| 0: [LocalVariableAccess] access to local variable cd3
# 63| 1: [LocalVariableAccess] access to local variable cd1
# 63| 1: [LocalVariableAccess] access to local variable cd4
# 64| 4: [LocalVariableDeclStmt] ... ...;
# 64| 0: [LocalVariableDeclAndInitExpr] D cd5 = ...
# 64| 0: [OperatorCall] call to operator -
# 64| 0: [LocalVariableAccess] access to local variable cd4
# 64| 1: [LocalVariableAccess] access to local variable cd3
# 64| 1: [LocalVariableAccess] access to local variable cd5
# 65| 5: [ExprStmt] ...;
# 65| 0: [AssignAddExpr] ... += ...
# 65| 0: [LocalVariableAccess] access to local variable cd5
# 65| 1: [LocalVariableAccess] access to local variable cd4
# 66| 6: [ExprStmt] ...;
# 66| 0: [AssignSubExpr] ... -= ...
# 66| 0: [LocalVariableAccess] access to local variable cd1
# 66| 1: [LocalVariableAccess] access to local variable cd4
# 68| 7: [LocalVariableDeclStmt] ... ...;
# 68| 0: [LocalVariableDeclAndInitExpr] C c = ...
# 68| 0: [ObjectCreation] object creation of type C
# 68| 1: [LocalVariableAccess] access to local variable c
# 69| 8: [LocalVariableDeclStmt] ... ...;
# 69| 0: [LocalVariableDeclAndInitExpr] D cd6 = ...
# 69| 0: [ExplicitDelegateCreation] delegate creation of type D
# 69| 0: [MethodAccess] access to method M3
# 69| -1: [LocalVariableAccess] access to local variable c
# 69| 1: [LocalVariableAccess] access to local variable cd6
# 70| 9: [LocalVariableDeclStmt] ... ...;
# 70| 0: [LocalVariableDeclAndInitExpr] D cd7 = ...
# 70| 0: [ExplicitDelegateCreation] delegate creation of type D
# 70| 0: [LocalVariableAccess] access to local variable cd6
# 70| 1: [LocalVariableAccess] access to local variable cd7
# 72| 10: [ExprStmt] ...;
# 72| 0: [DelegateCall] delegate call
# 72| -1: [LocalVariableAccess] access to local variable cd1
# 72| 0: [UnaryMinusExpr] -...
# 72| 0: [IntLiteral] 40
# 73| 11: [LocalVariableDeclStmt] ... ...;
# 73| 0: [LocalVariableDeclAndInitExpr] Int32 x = ...
# 73| 0: [IntLiteral] 0
# 73| 1: [LocalVariableAccess] access to local variable x
# 74| 12: [ExprStmt] ...;
# 74| 0: [DelegateCall] delegate call
# 74| -1: [LocalVariableAccess] access to local variable cd7
# 74| 0: [AddExpr] ... + ...
# 74| 0: [IntLiteral] 34
# 74| 1: [LocalVariableAccess] access to local variable x
# 76| 13: [LocalVariableDeclStmt] ... ...;
# 76| 0: [LocalVariableDeclAndInitExpr] Predicate<Int32> pi = ...
# 76| 0: [ExplicitDelegateCreation] delegate creation of type Predicate<Int32>
# 76| 0: [MethodAccess] access to method F
# 76| -1: [TypeAccess] access to type X
# 76| 1: [LocalVariableAccess] access to local variable pi
# 77| 14: [LocalVariableDeclStmt] ... ...;
# 77| 0: [LocalVariableDeclAndInitExpr] Predicate<String> ps = ...
# 77| 0: [ImplicitDelegateCreation] delegate creation of type Predicate<String>
# 77| 0: [MethodAccess] access to method G
# 77| -1: [TypeAccess] access to type X
# 77| 1: [LocalVariableAccess] access to local variable ps
# 79| 15: [LocalVariableDeclStmt] ... ...;
# 79| 0: [LocalVariableDeclAndInitExpr] Boolean b = ...
# 79| 0: [BitwiseAndExpr] ... & ...
# 79| 0: [DelegateCall] delegate call
# 79| -1: [LocalVariableAccess] access to local variable pi
# 79| 0: [IntLiteral] 3
# 79| 1: [DelegateCall] delegate call
# 79| -1: [LocalVariableAccess] access to local variable ps
# 79| 0: [StringLiteral] ""
# 79| 1: [LocalVariableAccess] access to local variable b
# 81| 16: [LocalVariableDeclStmt] ... ...;
# 81| 0: [LocalVariableDeclExpr] ContextCallback d

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,252 @@
dynamic.cs:
# 4| [Class] DynamicTest
# 6| 4: [InstanceConstructor] DynamicTest
#-----| 2: (Parameters)
# 6| 0: [Parameter] x
# 6| 4: [BlockStmt] {...}
# 8| 5: [Method] Main
#-----| 2: (Parameters)
# 8| 0: [Parameter] args
# 9| 4: [BlockStmt] {...}
# 10| 0: [LocalVariableDeclStmt] ... ...;
# 10| 0: [LocalVariableDeclAndInitExpr] DynamicTest dt = ...
# 10| 0: [ObjectCreation] object creation of type DynamicTest
# 10| 0: [IntLiteral] 0
# 10| 1: [LocalVariableAccess] access to local variable dt
# 11| 1: [LocalVariableDeclStmt] ... ...;
# 11| 0: [LocalVariableDeclAndInitExpr] Int32[] array = ...
# 11| 0: [ArrayCreation] array creation of type Int32[]
# 11| -1: [ArrayInitializer] { ..., ... }
# 11| 0: [IntLiteral] 42
# 11| 1: [LocalVariableAccess] access to local variable array
# 12| 2: [LocalVariableDeclStmt] ... ...;
# 12| 0: [LocalVariableDeclAndInitExpr] Action<Int32> action = ...
# 12| 0: [LambdaExpr] (...) => ...
#-----| 2: (Parameters)
# 12| 0: [Parameter] x
# 12| 4: [BlockStmt] {...}
# 12| 1: [LocalVariableAccess] access to local variable action
# 13| 3: [LocalVariableDeclStmt] ... ...;
# 13| 0: [LocalVariableDeclAndInitExpr] dynamic d = ...
# 13| 0: [CastExpr] (...) ...
# 13| 0: [IntLiteral] 0
# 13| 1: [LocalVariableAccess] access to local variable d
# 16| 4: [ExprStmt] ...;
# 16| 0: [DynamicObjectCreation] dynamic object creation of type DynamicTest
# 16| 0: [LocalVariableAccess] access to local variable d
# 17| 5: [ExprStmt] ...;
# 17| 0: [DynamicObjectCreation] dynamic object creation of type DynamicTest
# 17| -1: [ObjectInitializer] { ..., ... }
# 17| 0: [MemberInitializer] ... = ...
# 17| 0: [CastExpr] (...) ...
# 17| 0: [LocalVariableAccess] access to local variable d
# 17| 1: [FieldAccess] access to field Field
# 17| 0: [LocalVariableAccess] access to local variable d
# 18| 6: [ExprStmt] ...;
# 18| 0: [DynamicObjectCreation] dynamic object creation of type KeyValuePair<String,dynamic>
# 18| 0: [StringLiteral] ""
# 18| 1: [LocalVariableAccess] access to local variable d
# 19| 7: [ExprStmt] ...;
# 19| 0: [DynamicObjectCreation] dynamic object creation of type KeyValuePair<String,dynamic>
# 19| 0: [StringLiteral] ""
# 19| 1: [LocalVariableAccess] access to local variable d
# 22| 8: [ExprStmt] ...;
# 22| 0: [ObjectCreation] object creation of type DynamicTest
# 22| 0: [IntLiteral] 0
# 23| 9: [ExprStmt] ...;
# 23| 0: [ObjectCreation] object creation of type DynamicTest
# 23| -1: [ObjectInitializer] { ..., ... }
# 23| 0: [MemberInitializer] ... = ...
# 23| 0: [CastExpr] (...) ...
# 23| 0: [LocalVariableAccess] access to local variable d
# 23| 1: [FieldAccess] access to field Field
# 23| 0: [IntLiteral] 0
# 26| 10: [ExprStmt] ...;
# 26| 0: [DynamicMethodCall] dynamic call to method Bar
# 26| -1: [LocalVariableAccess] access to local variable d
# 26| 0: [StringLiteral] ""
# 27| 11: [ExprStmt] ...;
# 27| 0: [DynamicMethodCall] dynamic call to method Foo
# 27| 0: [LocalVariableAccess] access to local variable d
# 30| 12: [ExprStmt] ...;
# 30| 0: [MethodCall] call to method Bar
# 30| -1: [LocalVariableAccess] access to local variable dt
# 30| 0: [StringLiteral] ""
# 31| 13: [ExprStmt] ...;
# 31| 0: [MethodCall] call to method Foo
# 31| 0: [IntLiteral] 0
# 34| 14: [ExprStmt] ...;
# 34| 0: [AssignExpr] ... = ...
# 34| 0: [CastExpr] (...) ...
# 34| 0: [IntLiteral] 0
# 34| 1: [LocalVariableAccess] access to local variable d
# 35| 15: [ExprStmt] ...;
# 35| 0: [AssignExpr] ... = ...
# 35| 0: [DynamicOperatorCall] dynamic call to operator -
# 35| 0: [LocalVariableAccess] access to local variable d
# 35| 1: [LocalVariableAccess] access to local variable d
# 36| 16: [ExprStmt] ...;
# 36| 0: [AssignExpr] ... = ...
# 36| 0: [DynamicOperatorCall] dynamic call to operator +
# 36| 0: [LocalVariableAccess] access to local variable d
# 36| 1: [LocalVariableAccess] access to local variable d
# 36| 1: [LocalVariableAccess] access to local variable d
# 37| 17: [ExprStmt] ...;
# 37| 0: [AssignAddExpr] ... += ...
# 37| 0: [LocalVariableAccess] access to local variable d
# 37| 1: [LocalVariableAccess] access to local variable d
# 40| 18: [LocalVariableDeclStmt] ... ...;
# 40| 0: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 40| 0: [IntLiteral] 0
# 40| 1: [LocalVariableAccess] access to local variable i
# 41| 19: [ExprStmt] ...;
# 41| 0: [AssignExpr] ... = ...
# 41| 0: [UnaryMinusExpr] -...
# 41| 0: [LocalVariableAccess] access to local variable i
# 41| 1: [LocalVariableAccess] access to local variable i
# 42| 20: [ExprStmt] ...;
# 42| 0: [AssignExpr] ... = ...
# 42| 0: [AddExpr] ... + ...
# 42| 0: [LocalVariableAccess] access to local variable i
# 42| 1: [LocalVariableAccess] access to local variable i
# 42| 1: [LocalVariableAccess] access to local variable i
# 43| 21: [ExprStmt] ...;
# 43| 0: [AssignAddExpr] ... += ...
# 43| 0: [LocalVariableAccess] access to local variable i
# 43| 1: [LocalVariableAccess] access to local variable i
# 44| 22: [ExprStmt] ...;
# 44| 0: [PostIncrExpr] ...++
# 44| 0: [LocalVariableAccess] access to local variable i
# 47| 23: [ExprStmt] ...;
# 47| 0: [DynamicOperatorCall] dynamic call to operator ++
# 47| 0: [LocalVariableAccess] access to local variable d
# 50| 24: [ExprStmt] ...;
# 50| 0: [PostIncrExpr] ...++
# 50| 0: [LocalVariableAccess] access to local variable i
# 53| 25: [ExprStmt] ...;
# 53| 0: [AssignExpr] ... = ...
# 53| 0: [IntLiteral] 0
# 53| 1: [DynamicMemberAccess] dynamic access to member Field
# 53| -1: [LocalVariableAccess] access to local variable d
# 54| 26: [ExprStmt] ...;
# 54| 0: [AssignExpr] ... = ...
# 54| 0: [DynamicMemberAccess] dynamic access to member Prop
# 54| -1: [LocalVariableAccess] access to local variable d
# 54| 1: [DynamicMemberAccess] dynamic access to member Prop
# 54| -1: [LocalVariableAccess] access to local variable d
# 57| 27: [ExprStmt] ...;
# 57| 0: [AssignExpr] ... = ...
# 57| 0: [IntLiteral] 0
# 57| 1: [FieldAccess] access to field Field
# 57| -1: [LocalVariableAccess] access to local variable dt
# 58| 28: [ExprStmt] ...;
# 58| 0: [AssignExpr] ... = ...
# 58| 0: [PropertyCall] access to property Prop
# 58| -1: [LocalVariableAccess] access to local variable dt
# 58| 1: [PropertyCall] access to property Prop
# 58| -1: [LocalVariableAccess] access to local variable dt
# 61| 29: [ExprStmt] ...;
# 61| 0: [AssignExpr] ... = ...
# 61| 0: [LocalVariableAccess] access to local variable array
# 61| 1: [LocalVariableAccess] access to local variable d
# 62| 30: [ExprStmt] ...;
# 62| 0: [AssignExpr] ... = ...
# 62| 0: [DynamicElementAccess] dynamic access to element
# 62| -1: [LocalVariableAccess] access to local variable d
# 62| 0: [IntLiteral] 0
# 62| 1: [DynamicElementAccess] dynamic access to element
# 62| -1: [LocalVariableAccess] access to local variable d
# 62| 0: [IntLiteral] 0
# 63| 31: [ExprStmt] ...;
# 63| 0: [AssignExpr] ... = ...
# 63| 0: [DynamicElementAccess] dynamic access to element
# 63| -1: [LocalVariableAccess] access to local variable d
# 63| 0: [IntLiteral] 0
# 63| 1: [LocalVariableAccess] access to local variable d
# 66| 32: [ExprStmt] ...;
# 66| 0: [AssignExpr] ... = ...
# 66| 0: [CastExpr] (...) ...
# 66| 0: [IntLiteral] 0
# 66| 1: [LocalVariableAccess] access to local variable d
# 67| 33: [ExprStmt] ...;
# 67| 0: [AssignExpr] ... = ...
# 67| 0: [CastExpr] (...) ...
# 67| 0: [IndexerCall] access to indexer
# 67| -1: [LocalVariableAccess] access to local variable dt
# 67| 0: [LocalVariableAccess] access to local variable d
# 67| 1: [IndexerCall] access to indexer
# 67| -1: [LocalVariableAccess] access to local variable dt
# 67| 0: [IntLiteral] 0
# 68| 34: [ExprStmt] ...;
# 68| 0: [AssignExpr] ... = ...
# 68| 0: [CastExpr] (...) ...
# 68| 0: [IndexerCall] access to indexer
# 68| -1: [LocalVariableAccess] access to local variable dt
# 68| 0: [IntLiteral] 0
# 68| 1: [LocalVariableAccess] access to local variable d
# 69| 35: [ExprStmt] ...;
# 69| 0: [AssignExpr] ... = ...
# 69| 0: [ArrayAccess] access to array element
# 69| -1: [LocalVariableAccess] access to local variable array
# 69| 0: [CastExpr] (...) ...
# 69| 0: [LocalVariableAccess] access to local variable d
# 69| 1: [ArrayAccess] access to array element
# 69| -1: [LocalVariableAccess] access to local variable array
# 69| 0: [IntLiteral] 0
# 70| 36: [ExprStmt] ...;
# 70| 0: [AssignExpr] ... = ...
# 70| 0: [CastExpr] (...) ...
# 70| 0: [ArrayAccess] access to array element
# 70| -1: [LocalVariableAccess] access to local variable array
# 70| 0: [IntLiteral] 0
# 70| 1: [LocalVariableAccess] access to local variable d
# 73| 37: [ExprStmt] ...;
# 73| 0: [DelegateCall] delegate call
# 73| -1: [LocalVariableAccess] access to local variable action
# 73| 0: [IntLiteral] 3
# 74| 38: [ExprStmt] ...;
# 74| 0: [AssignExpr] ... = ...
# 74| 0: [LocalVariableAccess] access to local variable action
# 74| 1: [LocalVariableAccess] access to local variable d
# 75| 39: [ExprStmt] ...;
# 75| 0: [DelegateCall] delegate call
# 75| -1: [LocalVariableAccess] access to local variable d
# 75| 0: [IntLiteral] 42
# 78| 6: [Method] Foo
#-----| 2: (Parameters)
# 78| 0: [Parameter] x
# 78| 4: [BlockStmt] {...}
# 79| 7: [Method] Foo
#-----| 2: (Parameters)
# 79| 0: [Parameter] x
# 79| 4: [BlockStmt] {...}
# 81| 8: [Method] Bar
#-----| 2: (Parameters)
# 81| 0: [Parameter] x
# 81| 4: [BlockStmt] {...}
# 83| 9: [IncrementOperator] ++
#-----| 2: (Parameters)
# 83| 0: [Parameter] dt
# 84| 4: [BlockStmt] {...}
# 85| 0: [ReturnStmt] return ...;
# 85| 0: [ParameterAccess] access to parameter dt
# 88| 10: [Field] Field
# 90| 11: [Property] Prop
# 90| 3: [Getter] get_Prop
# 90| 4: [Setter] set_Prop
#-----| 2: (Parameters)
# 90| 0: [Parameter] value
# 92| 12: [Indexer] Item
#-----| 1: (Parameters)
# 92| 0: [Parameter] x
# 92| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 92| 0: [Parameter] x
# 92| 4: [BlockStmt] {...}
# 92| 0: [ReturnStmt] return ...;
# 92| 0: [ParameterAccess] access to parameter x
# 92| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 92| 0: [Parameter] x
# 92| 1: [Parameter] value
# 92| 4: [BlockStmt] {...}

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,88 @@
enums.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 7| 1: [Enum] Color
# 10| 5: [Field] Red
# 10| 6: [Field] Green
# 10| 7: [Field] Blue
# 14| 2: [Enum] LongColor
# 17| 5: [Field] Red
# 18| 6: [Field] Green
# 19| 7: [Field] Blue
# 23| 3: [Enum] E
# 25| 4: [Enum] ValueColor
# 28| 5: [Field] OneRed
# 28| 1: [MemberConstantAccess] access to constant OneRed
# 29| 6: [Field] TwoGreen
# 29| 1: [MemberConstantAccess] access to constant TwoGreen
# 30| 7: [Field] FourBlue
# 30| 1: [MemberConstantAccess] access to constant FourBlue
# 34| 5: [Enum] SparseColor
# 37| 5: [Field] Red
# 38| 6: [Field] Green
# 38| 1: [MemberConstantAccess] access to constant Green
# 39| 7: [Field] Blue
# 40| 8: [Field] AnotherBlue
# 40| 1: [MemberConstantAccess] access to constant AnotherBlue
# 44| 6: [Class] Test
# 47| 5: [Method] Main
# 48| 4: [BlockStmt] {...}
# 49| 0: [ExprStmt] ...;
# 49| 0: [MethodCall] call to method WriteLine
# 49| -1: [TypeAccess] access to type Console
# 49| 0: [MethodCall] call to method StringFromColor
# 49| 0: [MemberConstantAccess] access to constant Red
# 49| -1: [TypeAccess] access to type SparseColor
# 50| 1: [ExprStmt] ...;
# 50| 0: [MethodCall] call to method WriteLine
# 50| -1: [TypeAccess] access to type Console
# 50| 0: [MethodCall] call to method StringFromColor
# 50| 0: [MemberConstantAccess] access to constant Green
# 50| -1: [TypeAccess] access to type SparseColor
# 51| 2: [ExprStmt] ...;
# 51| 0: [MethodCall] call to method WriteLine
# 51| -1: [TypeAccess] access to type Console
# 51| 0: [MethodCall] call to method StringFromColor
# 51| 0: [MemberConstantAccess] access to constant Blue
# 51| -1: [TypeAccess] access to type SparseColor
# 54| 6: [Method] StringFromColor
#-----| 2: (Parameters)
# 54| 0: [Parameter] c
# 55| 4: [BlockStmt] {...}
# 56| 0: [SwitchStmt] switch (...) {...}
# 56| 0: [ParameterAccess] access to parameter c
# 58| 0: [ConstCase] case ...:
# 58| 0: [ConstantPatternExpr,MemberConstantAccess] access to constant Red
# 58| -1: [TypeAccess] access to type SparseColor
# 58| 1: [ReturnStmt] return ...;
# 58| 0: [MethodCall] call to method Format
# 58| -1: [TypeAccess] access to type String
# 58| 0: [StringLiteral] "Red = {0}"
# 58| 1: [CastExpr] (...) ...
# 58| 0: [CastExpr] (...) ...
# 58| 0: [ParameterAccess] access to parameter c
# 58| 1: [TypeAccess] access to type Int32
# 59| 2: [ConstCase] case ...:
# 59| 0: [ConstantPatternExpr,MemberConstantAccess] access to constant Green
# 59| -1: [TypeAccess] access to type SparseColor
# 59| 3: [ReturnStmt] return ...;
# 59| 0: [MethodCall] call to method Format
# 59| -1: [TypeAccess] access to type String
# 59| 0: [StringLiteral] "Green = {0}"
# 59| 1: [CastExpr] (...) ...
# 59| 0: [CastExpr] (...) ...
# 59| 0: [ParameterAccess] access to parameter c
# 59| 1: [TypeAccess] access to type Int32
# 60| 4: [ConstCase] case ...:
# 60| 0: [ConstantPatternExpr,MemberConstantAccess] access to constant Blue
# 60| -1: [TypeAccess] access to type SparseColor
# 60| 5: [ReturnStmt] return ...;
# 60| 0: [MethodCall] call to method Format
# 60| -1: [TypeAccess] access to type String
# 60| 0: [StringLiteral] "Blue = {0}"
# 60| 1: [CastExpr] (...) ...
# 60| 0: [CastExpr] (...) ...
# 60| 0: [ParameterAccess] access to parameter c
# 60| 1: [TypeAccess] access to type Int32
# 61| 6: [DefaultCase] default:
# 61| 7: [ReturnStmt] return ...;
# 61| 0: [StringLiteral] "Invalid color"

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,149 @@
events.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 7| 1: [DelegateType] EventHandler
#-----| 2: (Parameters)
# 7| 0: [Parameter] sender
# 7| 1: [Parameter] e
# 10| 2: [Class] Button
# 13| 5: [Event] Click
# 13| 3: [RemoveEventAccessor] remove_Click
#-----| 2: (Parameters)
# 13| 0: [Parameter] value
# 13| 3: [AddEventAccessor] add_Click
#-----| 2: (Parameters)
# 13| 0: [Parameter] value
# 15| 6: [Method] OnClick
#-----| 2: (Parameters)
# 15| 0: [Parameter] e
# 16| 4: [BlockStmt] {...}
# 17| 0: [IfStmt] if (...) ...
# 17| 0: [OperatorCall] call to operator !=
# 17| 0: [EventAccess,EventCall] access to event Click
# 17| 1: [NullLiteral] null
# 18| 1: [ExprStmt] ...;
# 18| 0: [DelegateCall] delegate call
# 18| -1: [EventAccess,EventCall] access to event Click
# 18| 0: [ThisAccess] this access
# 18| 1: [ParameterAccess] access to parameter e
# 21| 7: [Method] Reset
# 22| 4: [BlockStmt] {...}
# 23| 0: [ExprStmt] ...;
# 23| 0: [AssignExpr] ... = ...
# 23| 0: [NullLiteral] null
# 23| 1: [EventAccess,EventCall] access to event Click
# 27| 3: [Class] LoginDialog
# 30| 4: [Field] OkButton
# 31| 5: [Field] CancelButton
# 33| 6: [InstanceConstructor] LoginDialog
# 34| 4: [BlockStmt] {...}
# 35| 0: [ExprStmt] ...;
# 35| 0: [AssignExpr] ... = ...
# 35| 0: [ObjectCreation] object creation of type Button
# 35| 1: [FieldAccess] access to field OkButton
# 36| 1: [ExprStmt] ...;
# 36| 0: [AddEventExpr] ... += ...
# 36| 0: [ExplicitDelegateCreation] delegate creation of type EventHandler
# 36| 0: [MethodAccess] access to method OkButtonClick
# 36| 1: [EventAccess,EventCall] access to event Click
# 36| -1: [FieldAccess] access to field OkButton
# 37| 2: [ExprStmt] ...;
# 37| 0: [AssignExpr] ... = ...
# 37| 0: [ObjectCreation] object creation of type Button
# 37| 1: [FieldAccess] access to field CancelButton
# 38| 3: [ExprStmt] ...;
# 38| 0: [RemoveEventExpr] ... -= ...
# 38| 0: [ExplicitDelegateCreation] delegate creation of type EventHandler
# 38| 0: [MethodAccess] access to method CancelButtonClick
# 38| 1: [EventAccess,EventCall] access to event Click
# 38| -1: [FieldAccess] access to field CancelButton
# 41| 7: [Method] OkButtonClick
#-----| 2: (Parameters)
# 41| 0: [Parameter] sender
# 41| 1: [Parameter] e
# 42| 4: [BlockStmt] {...}
# 45| 8: [Method] CancelButtonClick
#-----| 2: (Parameters)
# 45| 0: [Parameter] sender
# 45| 1: [Parameter] e
# 46| 4: [BlockStmt] {...}
# 51| 4: [Class] Control
# 54| 6: [Field] mouseDownEventKey
# 54| 1: [AssignExpr] ... = ...
# 54| 0: [ObjectCreation] object creation of type Object
# 54| 1: [FieldAccess] access to field mouseDownEventKey
# 55| 7: [Field] mouseUpEventKey
# 55| 1: [AssignExpr] ... = ...
# 55| 0: [ObjectCreation] object creation of type Object
# 55| 1: [FieldAccess] access to field mouseUpEventKey
# 58| 8: [Method] GetEventHandler
#-----| 2: (Parameters)
# 58| 0: [Parameter] key
# 58| 4: [BlockStmt] {...}
# 58| 0: [ReturnStmt] return ...;
# 58| 0: [NullLiteral] null
# 61| 9: [Method] AddEventHandler
#-----| 2: (Parameters)
# 61| 0: [Parameter] key
# 61| 1: [Parameter] handler
# 61| 4: [BlockStmt] {...}
# 64| 10: [Method] RemoveEventHandler
#-----| 2: (Parameters)
# 64| 0: [Parameter] key
# 64| 1: [Parameter] handler
# 64| 4: [BlockStmt] {...}
# 67| 11: [Event] MouseDown
# 69| 3: [AddEventAccessor] add_MouseDown
#-----| 2: (Parameters)
# 69| 0: [Parameter] value
# 69| 4: [BlockStmt] {...}
# 69| 0: [ExprStmt] ...;
# 69| 0: [MethodCall] call to method AddEventHandler
# 69| 0: [FieldAccess] access to field mouseDownEventKey
# 69| 1: [ParameterAccess] access to parameter value
# 70| 4: [RemoveEventAccessor] remove_MouseDown
#-----| 2: (Parameters)
# 70| 0: [Parameter] value
# 70| 4: [BlockStmt] {...}
# 70| 0: [ExprStmt] ...;
# 70| 0: [MethodCall] call to method RemoveEventHandler
# 70| 0: [FieldAccess] access to field mouseDownEventKey
# 70| 1: [ParameterAccess] access to parameter value
# 74| 12: [Event] MouseUp
# 76| 3: [AddEventAccessor] add_MouseUp
#-----| 2: (Parameters)
# 76| 0: [Parameter] value
# 76| 4: [BlockStmt] {...}
# 76| 0: [ExprStmt] ...;
# 76| 0: [MethodCall] call to method AddEventHandler
# 76| 0: [FieldAccess] access to field mouseUpEventKey
# 76| 1: [ParameterAccess] access to parameter value
# 77| 4: [RemoveEventAccessor] remove_MouseUp
#-----| 2: (Parameters)
# 77| 0: [Parameter] value
# 77| 4: [BlockStmt] {...}
# 77| 0: [ExprStmt] ...;
# 77| 0: [MethodCall] call to method RemoveEventHandler
# 77| 0: [FieldAccess] access to field mouseUpEventKey
# 77| 1: [ParameterAccess] access to parameter value
# 81| 13: [Method] OnMouseUp
#-----| 2: (Parameters)
# 81| 0: [Parameter] args
# 82| 4: [BlockStmt] {...}
# 83| 0: [LocalVariableDeclStmt] ... ...;
# 83| 0: [LocalVariableDeclExpr] EventHandler handler
# 84| 1: [ExprStmt] ...;
# 84| 0: [AssignExpr] ... = ...
# 84| 0: [CastExpr] (...) ...
# 84| 0: [MethodCall] call to method GetEventHandler
# 84| 0: [FieldAccess] access to field mouseUpEventKey
# 84| 1: [TypeAccess] access to type EventHandler
# 84| 1: [LocalVariableAccess] access to local variable handler
# 85| 2: [IfStmt] if (...) ...
# 85| 0: [OperatorCall] call to operator !=
# 85| 0: [LocalVariableAccess] access to local variable handler
# 85| 1: [NullLiteral] null
# 86| 1: [ExprStmt] ...;
# 86| 0: [DelegateCall] delegate call
# 86| -1: [LocalVariableAccess] access to local variable handler
# 86| 0: [ThisAccess] this access
# 86| 1: [ParameterAccess] access to parameter args

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,503 @@
exceptions.cs:
# 3| [Class] Class1
# 5| 5: [Method] G
# 6| 4: [BlockStmt] {...}
# 9| 6: [Field] p
# 11| 7: [Method] TestNoThrow
# 12| 4: [BlockStmt] {...}
# 13| 0: [TryStmt] try {...} ...
# 38| -1: [BlockStmt] {...}
# 39| 0: [EmptyStmt] ;
# 14| 0: [BlockStmt] {...}
# 15| 0: [EmptyStmt] ;
# 17| 1: [SpecificCatchClause] catch (...) {...}
# 17| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 18| 1: [BlockStmt] {...}
# 19| 0: [EmptyStmt] ;
# 21| 2: [SpecificCatchClause] catch (...) {...}
# 21| 0: [LocalVariableDeclExpr] OverflowException ex
# 22| 1: [BlockStmt] {...}
# 23| 0: [EmptyStmt] ;
# 25| 3: [SpecificCatchClause] catch (...) {...}
# 25| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 26| 1: [BlockStmt] {...}
# 27| 0: [EmptyStmt] ;
# 29| 4: [SpecificCatchClause] catch (...) {...}
# 29| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 30| 1: [BlockStmt] {...}
# 31| 0: [EmptyStmt] ;
# 33| 5: [SpecificCatchClause] catch (...) {...}
# 33| 0: [LocalVariableDeclExpr] Exception ex
# 34| 1: [BlockStmt] {...}
# 35| 0: [EmptyStmt] ;
# 43| 8: [Method] TestCall
# 44| 4: [BlockStmt] {...}
# 45| 0: [TryStmt] try {...} ...
# 46| 0: [BlockStmt] {...}
# 47| 0: [EmptyStmt] ;
# 48| 1: [ExprStmt] ...;
# 48| 0: [MethodCall] call to method G
# 50| 1: [SpecificCatchClause] catch (...) {...}
# 50| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 51| 1: [BlockStmt] {...}
# 52| 0: [EmptyStmt] ;
# 54| 2: [SpecificCatchClause] catch (...) {...}
# 54| 0: [LocalVariableDeclExpr] OverflowException ex
# 55| 1: [BlockStmt] {...}
# 56| 0: [EmptyStmt] ;
# 58| 3: [SpecificCatchClause] catch (...) {...}
# 58| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 59| 1: [BlockStmt] {...}
# 60| 0: [EmptyStmt] ;
# 62| 4: [SpecificCatchClause] catch (...) {...}
# 62| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 63| 1: [BlockStmt] {...}
# 64| 0: [EmptyStmt] ;
# 66| 5: [GeneralCatchClause] catch {...}
# 67| 1: [BlockStmt] {...}
# 68| 0: [EmptyStmt] ;
# 72| 9: [Method] TestCreation
# 73| 4: [BlockStmt] {...}
# 74| 0: [TryStmt] try {...} ...
# 75| 0: [BlockStmt] {...}
# 76| 0: [EmptyStmt] ;
# 77| 1: [LocalVariableDeclStmt] ... ...;
# 77| 0: [LocalVariableDeclAndInitExpr] Class1 v = ...
# 77| 0: [ObjectCreation] object creation of type Class1
# 77| 1: [LocalVariableAccess] access to local variable v
# 79| 1: [SpecificCatchClause] catch (...) {...}
# 79| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 80| 1: [BlockStmt] {...}
# 81| 0: [EmptyStmt] ;
# 83| 2: [SpecificCatchClause] catch (...) {...}
# 83| 0: [LocalVariableDeclExpr] OverflowException ex
# 84| 1: [BlockStmt] {...}
# 85| 0: [EmptyStmt] ;
# 87| 3: [SpecificCatchClause] catch (...) {...}
# 87| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 88| 1: [BlockStmt] {...}
# 89| 0: [EmptyStmt] ;
# 91| 4: [SpecificCatchClause] catch (...) {...}
# 91| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 92| 1: [BlockStmt] {...}
# 93| 0: [EmptyStmt] ;
# 95| 5: [SpecificCatchClause] catch (...) {...}
# 95| 0: [LocalVariableDeclExpr] Exception ex
# 96| 1: [BlockStmt] {...}
# 97| 0: [EmptyStmt] ;
# 101| 10: [Method] TestIntAdd
# 102| 4: [BlockStmt] {...}
# 103| 0: [TryStmt] try {...} ...
# 104| 0: [BlockStmt] {...}
# 105| 0: [EmptyStmt] ;
# 106| 1: [LocalVariableDeclStmt] ... ...;
# 106| 0: [LocalVariableDeclAndInitExpr] Int32 v = ...
# 106| 0: [AddExpr] ... + ...
# 106| 0: [IntLiteral] 1
# 106| 1: [IntLiteral] 2
# 106| 1: [LocalVariableAccess] access to local variable v
# 108| 1: [SpecificCatchClause] catch (...) {...}
# 108| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 109| 1: [BlockStmt] {...}
# 110| 0: [EmptyStmt] ;
# 112| 2: [SpecificCatchClause] catch (...) {...}
# 112| 0: [LocalVariableDeclExpr] OverflowException ex
# 113| 1: [BlockStmt] {...}
# 114| 0: [EmptyStmt] ;
# 116| 3: [SpecificCatchClause] catch (...) {...}
# 116| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 117| 1: [BlockStmt] {...}
# 118| 0: [EmptyStmt] ;
# 120| 4: [SpecificCatchClause] catch (...) {...}
# 120| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 121| 1: [BlockStmt] {...}
# 122| 0: [EmptyStmt] ;
# 124| 5: [SpecificCatchClause] catch (...) {...}
# 124| 0: [LocalVariableDeclExpr] Exception ex
# 125| 1: [BlockStmt] {...}
# 126| 0: [EmptyStmt] ;
# 130| 11: [Method] TestIntSub
# 131| 4: [BlockStmt] {...}
# 132| 0: [TryStmt] try {...} ...
# 133| 0: [BlockStmt] {...}
# 134| 0: [EmptyStmt] ;
# 135| 1: [LocalVariableDeclStmt] ... ...;
# 135| 0: [LocalVariableDeclAndInitExpr] Int32 v = ...
# 135| 0: [SubExpr] ... - ...
# 135| 0: [IntLiteral] 1
# 135| 1: [IntLiteral] 2
# 135| 1: [LocalVariableAccess] access to local variable v
# 137| 1: [SpecificCatchClause] catch (...) {...}
# 137| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 138| 1: [BlockStmt] {...}
# 139| 0: [EmptyStmt] ;
# 141| 2: [SpecificCatchClause] catch (...) {...}
# 141| 0: [LocalVariableDeclExpr] OverflowException ex
# 142| 1: [BlockStmt] {...}
# 143| 0: [EmptyStmt] ;
# 145| 3: [SpecificCatchClause] catch (...) {...}
# 145| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 146| 1: [BlockStmt] {...}
# 147| 0: [EmptyStmt] ;
# 149| 4: [SpecificCatchClause] catch (...) {...}
# 149| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 150| 1: [BlockStmt] {...}
# 151| 0: [EmptyStmt] ;
# 153| 5: [SpecificCatchClause] catch (...) {...}
# 153| 0: [LocalVariableDeclExpr] Exception ex
# 154| 1: [BlockStmt] {...}
# 155| 0: [EmptyStmt] ;
# 159| 12: [Method] TestIntMul
# 160| 4: [BlockStmt] {...}
# 161| 0: [TryStmt] try {...} ...
# 162| 0: [BlockStmt] {...}
# 163| 0: [EmptyStmt] ;
# 164| 1: [LocalVariableDeclStmt] ... ...;
# 164| 0: [LocalVariableDeclAndInitExpr] Int32 v = ...
# 164| 0: [MulExpr] ... * ...
# 164| 0: [IntLiteral] 1
# 164| 1: [IntLiteral] 2
# 164| 1: [LocalVariableAccess] access to local variable v
# 166| 1: [SpecificCatchClause] catch (...) {...}
# 166| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 167| 1: [BlockStmt] {...}
# 168| 0: [EmptyStmt] ;
# 170| 2: [SpecificCatchClause] catch (...) {...}
# 170| 0: [LocalVariableDeclExpr] OverflowException ex
# 171| 1: [BlockStmt] {...}
# 172| 0: [EmptyStmt] ;
# 174| 3: [SpecificCatchClause] catch (...) {...}
# 174| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 175| 1: [BlockStmt] {...}
# 176| 0: [EmptyStmt] ;
# 178| 4: [SpecificCatchClause] catch (...) {...}
# 178| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 179| 1: [BlockStmt] {...}
# 180| 0: [EmptyStmt] ;
# 182| 5: [SpecificCatchClause] catch (...) {...}
# 182| 0: [LocalVariableDeclExpr] Exception ex
# 183| 1: [BlockStmt] {...}
# 184| 0: [EmptyStmt] ;
# 188| 13: [Method] TestStringLiteral
# 189| 4: [BlockStmt] {...}
# 190| 0: [TryStmt] try {...} ...
# 191| 0: [BlockStmt] {...}
# 192| 0: [EmptyStmt] ;
# 193| 1: [LocalVariableDeclStmt] ... ...;
# 193| 0: [LocalVariableDeclAndInitExpr] String v = ...
# 193| 0: [StringLiteral] ""
# 193| 1: [LocalVariableAccess] access to local variable v
# 195| 1: [SpecificCatchClause] catch (...) {...}
# 195| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 196| 1: [BlockStmt] {...}
# 197| 0: [EmptyStmt] ;
# 199| 2: [SpecificCatchClause] catch (...) {...}
# 199| 0: [LocalVariableDeclExpr] OverflowException ex
# 200| 1: [BlockStmt] {...}
# 201| 0: [EmptyStmt] ;
# 203| 3: [SpecificCatchClause] catch (...) {...}
# 203| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 204| 1: [BlockStmt] {...}
# 205| 0: [EmptyStmt] ;
# 207| 4: [SpecificCatchClause] catch (...) {...}
# 207| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 208| 1: [BlockStmt] {...}
# 209| 0: [EmptyStmt] ;
# 211| 5: [SpecificCatchClause] catch (...) {...}
# 211| 0: [LocalVariableDeclExpr] Exception ex
# 212| 1: [BlockStmt] {...}
# 213| 0: [EmptyStmt] ;
# 217| 14: [Method] TestStringAdd
# 218| 4: [BlockStmt] {...}
# 219| 0: [TryStmt] try {...} ...
# 220| 0: [BlockStmt] {...}
# 221| 0: [LocalVariableDeclStmt] ... ...;
# 221| 0: [LocalVariableDeclAndInitExpr] String s = ...
# 221| 0: [StringLiteral] ""
# 221| 1: [LocalVariableAccess] access to local variable s
# 222| 1: [EmptyStmt] ;
# 223| 2: [LocalVariableDeclStmt] ... ...;
# 223| 0: [LocalVariableDeclAndInitExpr] String v = ...
# 223| 0: [AddExpr] ... + ...
# 223| 0: [LocalVariableAccess] access to local variable s
# 223| 1: [LocalVariableAccess] access to local variable s
# 223| 1: [LocalVariableAccess] access to local variable v
# 225| 1: [SpecificCatchClause] catch (...) {...}
# 225| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 226| 1: [BlockStmt] {...}
# 227| 0: [EmptyStmt] ;
# 229| 2: [SpecificCatchClause] catch (...) {...}
# 229| 0: [LocalVariableDeclExpr] OverflowException ex
# 230| 1: [BlockStmt] {...}
# 231| 0: [EmptyStmt] ;
# 233| 3: [SpecificCatchClause] catch (...) {...}
# 233| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 234| 1: [BlockStmt] {...}
# 235| 0: [EmptyStmt] ;
# 237| 4: [SpecificCatchClause] catch (...) {...}
# 237| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 238| 1: [BlockStmt] {...}
# 239| 0: [EmptyStmt] ;
# 241| 5: [SpecificCatchClause] catch (...) {...}
# 241| 0: [LocalVariableDeclExpr] Exception ex
# 242| 1: [BlockStmt] {...}
# 243| 0: [EmptyStmt] ;
# 247| 15: [Method] TestDivide
# 248| 4: [BlockStmt] {...}
# 249| 0: [TryStmt] try {...} ...
# 250| 0: [BlockStmt] {...}
# 251| 0: [EmptyStmt] ;
# 252| 1: [LocalVariableDeclStmt] ... ...;
# 252| 0: [LocalVariableDeclAndInitExpr] Int32 v = ...
# 252| 0: [DivExpr] ... / ...
# 252| 0: [IntLiteral] 1
# 252| 1: [IntLiteral] 2
# 252| 1: [LocalVariableAccess] access to local variable v
# 254| 1: [SpecificCatchClause] catch (...) {...}
# 254| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 255| 1: [BlockStmt] {...}
# 256| 0: [EmptyStmt] ;
# 258| 2: [SpecificCatchClause] catch (...) {...}
# 258| 0: [LocalVariableDeclExpr] OverflowException ex
# 259| 1: [BlockStmt] {...}
# 260| 0: [EmptyStmt] ;
# 262| 3: [SpecificCatchClause] catch (...) {...}
# 262| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 263| 1: [BlockStmt] {...}
# 264| 0: [EmptyStmt] ;
# 266| 4: [SpecificCatchClause] catch (...) {...}
# 266| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 267| 1: [BlockStmt] {...}
# 268| 0: [EmptyStmt] ;
# 270| 5: [SpecificCatchClause] catch (...) {...}
# 270| 0: [LocalVariableDeclExpr] Exception ex
# 271| 1: [BlockStmt] {...}
# 272| 0: [EmptyStmt] ;
# 276| 16: [Method] TestRemainder
# 277| 4: [BlockStmt] {...}
# 278| 0: [TryStmt] try {...} ...
# 279| 0: [BlockStmt] {...}
# 280| 0: [EmptyStmt] ;
# 281| 1: [LocalVariableDeclStmt] ... ...;
# 281| 0: [LocalVariableDeclAndInitExpr] Int32 v = ...
# 281| 0: [RemExpr] ... % ...
# 281| 0: [IntLiteral] 1
# 281| 1: [IntLiteral] 2
# 281| 1: [LocalVariableAccess] access to local variable v
# 283| 1: [SpecificCatchClause] catch (...) {...}
# 283| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 284| 1: [BlockStmt] {...}
# 285| 0: [EmptyStmt] ;
# 287| 2: [SpecificCatchClause] catch (...) {...}
# 287| 0: [LocalVariableDeclExpr] OverflowException ex
# 288| 1: [BlockStmt] {...}
# 289| 0: [EmptyStmt] ;
# 291| 3: [SpecificCatchClause] catch (...) {...}
# 291| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 292| 1: [BlockStmt] {...}
# 293| 0: [EmptyStmt] ;
# 295| 4: [SpecificCatchClause] catch (...) {...}
# 295| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 296| 1: [BlockStmt] {...}
# 297| 0: [EmptyStmt] ;
# 299| 5: [SpecificCatchClause] catch (...) {...}
# 299| 0: [LocalVariableDeclExpr] Exception ex
# 300| 1: [BlockStmt] {...}
# 301| 0: [EmptyStmt] ;
# 305| 17: [Method] TestMemberAccess
# 306| 4: [BlockStmt] {...}
# 307| 0: [TryStmt] try {...} ...
# 308| 0: [BlockStmt] {...}
# 309| 0: [EmptyStmt] ;
# 310| 1: [LocalVariableDeclStmt] ... ...;
# 310| 0: [LocalVariableDeclAndInitExpr] Int32 v = ...
# 310| 0: [FieldAccess] access to field p
# 310| -1: [ThisAccess] this access
# 310| 1: [LocalVariableAccess] access to local variable v
# 312| 1: [SpecificCatchClause] catch (...) {...}
# 312| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 313| 1: [BlockStmt] {...}
# 314| 0: [EmptyStmt] ;
# 316| 2: [SpecificCatchClause] catch (...) {...}
# 316| 0: [LocalVariableDeclExpr] OverflowException ex
# 317| 1: [BlockStmt] {...}
# 318| 0: [EmptyStmt] ;
# 320| 3: [SpecificCatchClause] catch (...) {...}
# 320| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 321| 1: [BlockStmt] {...}
# 322| 0: [EmptyStmt] ;
# 324| 4: [SpecificCatchClause] catch (...) {...}
# 324| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 325| 1: [BlockStmt] {...}
# 326| 0: [EmptyStmt] ;
# 328| 5: [SpecificCatchClause] catch (...) {...}
# 328| 0: [LocalVariableDeclExpr] Exception ex
# 329| 1: [BlockStmt] {...}
# 330| 0: [EmptyStmt] ;
# 334| 18: [Method] TestCast
# 335| 4: [BlockStmt] {...}
# 336| 0: [TryStmt] try {...} ...
# 337| 0: [BlockStmt] {...}
# 338| 0: [EmptyStmt] ;
# 339| 1: [LocalVariableDeclStmt] ... ...;
# 339| 0: [LocalVariableDeclAndInitExpr] Int16 v = ...
# 339| 0: [CastExpr] (...) ...
# 339| 0: [IntLiteral] 1
# 339| 1: [TypeAccess] access to type Int16
# 339| 1: [LocalVariableAccess] access to local variable v
# 341| 1: [SpecificCatchClause] catch (...) {...}
# 341| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 342| 1: [BlockStmt] {...}
# 343| 0: [EmptyStmt] ;
# 345| 2: [SpecificCatchClause] catch (...) {...}
# 345| 0: [LocalVariableDeclExpr] OverflowException ex
# 346| 1: [BlockStmt] {...}
# 347| 0: [EmptyStmt] ;
# 349| 3: [SpecificCatchClause] catch (...) {...}
# 349| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 350| 1: [BlockStmt] {...}
# 351| 0: [EmptyStmt] ;
# 353| 4: [SpecificCatchClause] catch (...) {...}
# 353| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 354| 1: [BlockStmt] {...}
# 355| 0: [EmptyStmt] ;
# 357| 5: [SpecificCatchClause] catch (...) {...}
# 357| 0: [LocalVariableDeclExpr] Exception ex
# 358| 1: [BlockStmt] {...}
# 359| 0: [EmptyStmt] ;
# 363| 19: [Method] TestThrow
# 364| 4: [BlockStmt] {...}
# 365| 0: [TryStmt] try {...} ...
# 366| 0: [BlockStmt] {...}
# 367| 0: [LocalVariableDeclStmt] ... ...;
# 367| 0: [LocalVariableDeclAndInitExpr] DivideByZeroException e = ...
# 367| 0: [ObjectCreation] object creation of type DivideByZeroException
# 367| 1: [LocalVariableAccess] access to local variable e
# 368| 1: [EmptyStmt] ;
# 369| 2: [ThrowStmt] throw ...;
# 369| 0: [LocalVariableAccess] access to local variable e
# 371| 1: [SpecificCatchClause] catch (...) {...}
# 371| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 372| 1: [BlockStmt] {...}
# 373| 0: [EmptyStmt] ;
# 375| 2: [SpecificCatchClause] catch (...) {...}
# 375| 0: [LocalVariableDeclExpr] OverflowException ex
# 376| 1: [BlockStmt] {...}
# 377| 0: [EmptyStmt] ;
# 379| 3: [SpecificCatchClause] catch (...) {...}
# 379| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 380| 1: [BlockStmt] {...}
# 381| 0: [EmptyStmt] ;
# 383| 4: [SpecificCatchClause] catch (...) {...}
# 383| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 384| 1: [BlockStmt] {...}
# 385| 0: [EmptyStmt] ;
# 387| 5: [SpecificCatchClause] catch (...) {...}
# 387| 0: [LocalVariableDeclExpr] Exception ex
# 388| 1: [BlockStmt] {...}
# 389| 0: [EmptyStmt] ;
# 393| 20: [Method] TestUnaryOperation
# 394| 4: [BlockStmt] {...}
# 395| 0: [TryStmt] try {...} ...
# 396| 0: [BlockStmt] {...}
# 397| 0: [LocalVariableDeclStmt] ... ...;
# 397| 0: [LocalVariableDeclAndInitExpr] Int32 a = ...
# 397| 0: [IntLiteral] 1
# 397| 1: [LocalVariableAccess] access to local variable a
# 398| 1: [EmptyStmt] ;
# 399| 2: [ExprStmt] ...;
# 399| 0: [PreIncrExpr] ++...
# 399| 0: [LocalVariableAccess] access to local variable a
# 401| 1: [SpecificCatchClause] catch (...) {...}
# 401| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 402| 1: [BlockStmt] {...}
# 403| 0: [EmptyStmt] ;
# 405| 2: [SpecificCatchClause] catch (...) {...}
# 405| 0: [LocalVariableDeclExpr] OverflowException ex
# 406| 1: [BlockStmt] {...}
# 407| 0: [EmptyStmt] ;
# 409| 3: [SpecificCatchClause] catch (...) {...}
# 409| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 410| 1: [BlockStmt] {...}
# 411| 0: [EmptyStmt] ;
# 413| 4: [SpecificCatchClause] catch (...) {...}
# 413| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 414| 1: [BlockStmt] {...}
# 415| 0: [EmptyStmt] ;
# 417| 5: [SpecificCatchClause] catch (...) {...}
# 417| 0: [LocalVariableDeclExpr] Exception ex
# 418| 1: [BlockStmt] {...}
# 419| 0: [EmptyStmt] ;
# 423| 21: [Method] TestRethrow
# 424| 4: [BlockStmt] {...}
# 425| 0: [TryStmt] try {...} ...
# 426| 0: [BlockStmt] {...}
# 427| 0: [TryStmt] try {...} ...
# 428| 0: [BlockStmt] {...}
# 430| 1: [GeneralCatchClause] catch {...}
# 431| 1: [BlockStmt] {...}
# 432| 0: [EmptyStmt] ;
# 433| 1: [ThrowStmt] throw ...;
# 436| 1: [SpecificCatchClause] catch (...) {...}
# 436| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 437| 1: [BlockStmt] {...}
# 438| 0: [EmptyStmt] ;
# 440| 2: [GeneralCatchClause] catch {...}
# 441| 1: [BlockStmt] {...}
# 442| 0: [EmptyStmt] ;
# 446| 22: [Method] TestSubtypeCast
# 447| 4: [BlockStmt] {...}
# 448| 0: [TryStmt] try {...} ...
# 449| 0: [BlockStmt] {...}
# 450| 0: [LocalVariableDeclStmt] ... ...;
# 450| 0: [LocalVariableDeclAndInitExpr] Object o = ...
# 450| 0: [NullLiteral] null
# 450| 1: [LocalVariableAccess] access to local variable o
# 451| 1: [EmptyStmt] ;
# 452| 2: [LocalVariableDeclStmt] ... ...;
# 452| 0: [LocalVariableDeclAndInitExpr] Class1 p = ...
# 452| 0: [CastExpr] (...) ...
# 452| 0: [LocalVariableAccess] access to local variable o
# 452| 1: [TypeAccess] access to type Class1
# 452| 1: [LocalVariableAccess] access to local variable p
# 454| 1: [SpecificCatchClause] catch (...) {...}
# 454| 0: [LocalVariableDeclExpr] InvalidCastException ex
# 455| 1: [BlockStmt] {...}
# 456| 0: [EmptyStmt] ;
# 458| 2: [SpecificCatchClause] catch (...) {...}
# 458| 0: [LocalVariableDeclExpr] Exception ex
# 459| 1: [BlockStmt] {...}
# 460| 0: [EmptyStmt] ;
# 464| 23: [Method] TestDivideMaybeZero
#-----| 2: (Parameters)
# 464| 0: [Parameter] i
# 465| 4: [BlockStmt] {...}
# 466| 0: [TryStmt] try {...} ...
# 467| 0: [BlockStmt] {...}
# 468| 0: [EmptyStmt] ;
# 469| 1: [LocalVariableDeclStmt] ... ...;
# 469| 0: [LocalVariableDeclAndInitExpr] Int32 v = ...
# 469| 0: [DivExpr] ... / ...
# 469| 0: [IntLiteral] 1
# 469| 1: [ParameterAccess] access to parameter i
# 469| 1: [LocalVariableAccess] access to local variable v
# 471| 1: [SpecificCatchClause] catch (...) {...}
# 471| 0: [LocalVariableDeclExpr] NullReferenceException ex
# 472| 1: [BlockStmt] {...}
# 473| 0: [EmptyStmt] ;
# 475| 2: [SpecificCatchClause] catch (...) {...}
# 475| 0: [LocalVariableDeclExpr] OverflowException ex
# 476| 1: [BlockStmt] {...}
# 477| 0: [EmptyStmt] ;
# 479| 3: [SpecificCatchClause] catch (...) {...}
# 479| 0: [LocalVariableDeclExpr] OutOfMemoryException ex
# 480| 1: [BlockStmt] {...}
# 481| 0: [EmptyStmt] ;
# 483| 4: [SpecificCatchClause] catch (...) {...}
# 483| 0: [LocalVariableDeclExpr] DivideByZeroException ex
# 484| 1: [BlockStmt] {...}
# 485| 0: [EmptyStmt] ;
# 487| 5: [SpecificCatchClause] catch (...) {...}
# 487| 0: [LocalVariableDeclExpr] Exception ex
# 488| 1: [BlockStmt] {...}
# 489| 0: [EmptyStmt] ;

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,185 @@
fields.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 7| 1: [Class] A
# 10| 6: [Field] X
# 10| 1: [AssignExpr] ... = ...
# 10| 0: [IntLiteral] 1
# 10| 1: [FieldAccess] access to field X
# 10| 7: [Field] Y
# 10| 8: [Field] Z
# 10| 1: [AssignExpr] ... = ...
# 10| 0: [IntLiteral] 100
# 10| 1: [FieldAccess] access to field Z
# 13| 2: [Class] B
# 15| 6: [Field] X
# 15| 1: [AssignExpr] ... = ...
# 15| 0: [IntLiteral] 1
# 15| 1: [FieldAccess] access to field X
# 16| 7: [Field] Y
# 17| 8: [Field] Z
# 17| 1: [AssignExpr] ... = ...
# 17| 0: [IntLiteral] 100
# 17| 1: [FieldAccess] access to field Z
# 20| 3: [Class] C<>
#-----| 1: (Type parameters)
# 20| 0: [TypeParameter] V
# 23| 5: [Field] count
# 23| 1: [AssignExpr] ... = ...
# 23| 0: [IntLiteral] 0
# 23| 1: [FieldAccess] access to field count
# 25| 6: [InstanceConstructor] C
# 25| 4: [BlockStmt] {...}
# 25| 0: [ExprStmt] ...;
# 25| 0: [PostIncrExpr] ...++
# 25| 0: [FieldAccess] access to field count
# 27| 7: [Property] Count
# 27| 3: [Getter] get_Count
# 27| 4: [BlockStmt] {...}
# 27| 0: [ReturnStmt] return ...;
# 27| 0: [FieldAccess] access to field count
# 31| 4: [Class] Application
# 34| 6: [Field] finished
# 35| 7: [Field] x
# 35| 1: [AssignExpr] ... = ...
# 35| 0: [MethodCall] call to method Sqrt
# 35| -1: [TypeAccess] access to type Math
# 35| 0: [DoubleLiteral] 2
# 35| 1: [FieldAccess] access to field x
# 36| 8: [Field] i
# 36| 1: [AssignExpr] ... = ...
# 36| 0: [IntLiteral] 100
# 36| 1: [FieldAccess] access to field i
# 37| 9: [Field] s
# 37| 1: [AssignExpr] ... = ...
# 37| 0: [StringLiteral] "Hello"
# 37| 1: [FieldAccess] access to field s
# 39| 10: [Method] Main
# 40| 4: [BlockStmt] {...}
# 41| 0: [LocalVariableDeclStmt] ... ...;
# 41| 0: [LocalVariableDeclAndInitExpr] Decimal d = ...
# 41| 0: [MemberConstantAccess] access to constant MaxValue
# 41| -1: [TypeAccess] access to type Decimal
# 41| 1: [LocalVariableAccess] access to local variable d
# 42| 1: [LocalVariableDeclStmt] ... ...;
# 42| 0: [LocalVariableDeclAndInitExpr] C<Int32> x1 = ...
# 42| 0: [ObjectCreation] object creation of type C<Int32>
# 42| 1: [LocalVariableAccess] access to local variable x1
# 43| 2: [ExprStmt] ...;
# 43| 0: [MethodCall] call to method WriteLine
# 43| -1: [TypeAccess] access to type Console
# 43| 0: [PropertyCall] access to property Count
# 43| -1: [TypeAccess] access to type C<Int32>
# 44| 3: [LocalVariableDeclStmt] ... ...;
# 44| 0: [LocalVariableDeclAndInitExpr] C<Double> x2 = ...
# 44| 0: [ObjectCreation] object creation of type C<Double>
# 44| 1: [LocalVariableAccess] access to local variable x2
# 45| 4: [ExprStmt] ...;
# 45| 0: [MethodCall] call to method WriteLine
# 45| -1: [TypeAccess] access to type Console
# 45| 0: [PropertyCall] access to property Count
# 45| -1: [TypeAccess] access to type C<Int32>
# 50| 5: [Class] Color
# 53| 5: [Field] Black
# 53| 1: [AssignExpr] ... = ...
# 53| 0: [ObjectCreation] object creation of type Color
# 53| 0: [CastExpr] (...) ...
# 53| 0: [IntLiteral] 0
# 53| 1: [CastExpr] (...) ...
# 53| 0: [IntLiteral] 0
# 53| 2: [CastExpr] (...) ...
# 53| 0: [IntLiteral] 0
# 53| 1: [FieldAccess] access to field Black
# 54| 6: [Field] White
# 54| 1: [AssignExpr] ... = ...
# 54| 0: [ObjectCreation] object creation of type Color
# 54| 0: [CastExpr] (...) ...
# 54| 0: [IntLiteral] 255
# 54| 1: [CastExpr] (...) ...
# 54| 0: [IntLiteral] 255
# 54| 2: [CastExpr] (...) ...
# 54| 0: [IntLiteral] 255
# 54| 1: [FieldAccess] access to field White
# 56| 7: [InstanceConstructor] Color
#-----| 2: (Parameters)
# 56| 0: [Parameter] r
# 56| 1: [Parameter] g
# 56| 2: [Parameter] b
# 56| 4: [BlockStmt] {...}
# 60| 6: [Class] TestBindings
# 63| 6: [Field] a
# 63| 1: [AssignExpr] ... = ...
# 63| 0: [AddExpr] ... + ...
# 63| 0: [FieldAccess] access to field b
# 63| 1: [IntLiteral] 1
# 63| 1: [FieldAccess] access to field a
# 64| 7: [Field] b
# 64| 1: [AssignExpr] ... = ...
# 64| 0: [AddExpr] ... + ...
# 64| 0: [FieldAccess] access to field a
# 64| 1: [IntLiteral] 1
# 64| 1: [FieldAccess] access to field b
# 70| [NamespaceDeclaration] namespace ... { ... }
# 72| 1: [Class] A
# 74| 5: [Field] X
# 74| 1: [AssignExpr] ... = ...
# 74| 0: [AddExpr] ... + ...
# 74| 0: [MemberConstantAccess] access to constant Z
# 74| -1: [TypeAccess] access to type B
# 74| 1: [IntLiteral] 1
# 74| 1: [MemberConstantAccess] access to constant X
# 75| 6: [Field] Y
# 75| 1: [AssignExpr] ... = ...
# 75| 0: [IntLiteral] 10
# 75| 1: [MemberConstantAccess] access to constant Y
# 78| 2: [Class] B
# 80| 5: [Field] Z
# 80| 1: [AssignExpr] ... = ...
# 80| 0: [AddExpr] ... + ...
# 80| 0: [MemberConstantAccess] access to constant Y
# 80| -1: [TypeAccess] access to type A
# 80| 1: [IntLiteral] 1
# 80| 1: [MemberConstantAccess] access to constant Z
# 83| 3: [Class] C
# 85| 4: [Field] Foo
# 85| 1: [AssignExpr] ... = ...
# 85| 0: [IntLiteral] 1
# 85| 1: [MemberConstantAccess] access to constant Foo
# 86| 5: [Field] x
# 87| 6: [InstanceConstructor] C
# 88| 4: [BlockStmt] {...}
# 89| 0: [ExprStmt] ...;
# 89| 0: [AssignExpr] ... = ...
# 89| 0: [CastExpr] (...) ...
# 89| 0: [MemberConstantAccess] access to constant Foo
# 89| 1: [FieldAccess] access to field x
# 90| 1: [LocalVariableDeclStmt] ... ...;
# 90| 0: [LocalVariableDeclAndInitExpr] dynamic dyn = ...
# 90| 0: [CastExpr] (...) ...
# 90| 0: [MemberConstantAccess] access to constant Foo
# 90| 1: [LocalVariableAccess] access to local variable dyn
# 91| 2: [LocalVariableDeclStmt] ... ...;
# 91| 0: [LocalVariableDeclAndInitExpr] D d = ...
# 91| 0: [OperatorCall] call to operator implicit conversion
# 91| 0: [MemberConstantAccess] access to constant Foo
# 91| 1: [LocalVariableAccess] access to local variable d
# 92| 3: [LocalVariableDeclStmt] ... ...;
# 92| 0: [LocalVariableDeclAndInitExpr] C c = ...
# 92| 0: [ObjectCreation] object creation of type C
# 92| -1: [ObjectInitializer] { ..., ... }
# 92| 0: [MemberInitializer] ... = ...
# 92| 0: [CastExpr] (...) ...
# 92| 0: [MemberConstantAccess] access to constant Foo
# 92| 1: [FieldAccess] access to field x
# 92| 1: [LocalVariableAccess] access to local variable c
# 96| 4: [Class] D
# 98| 4: [InstanceConstructor] D
#-----| 2: (Parameters)
# 98| 0: [Parameter] d
# 99| 4: [BlockStmt] {...}
# 101| 5: [ImplicitConversionOperator] implicit conversion
#-----| 2: (Parameters)
# 101| 0: [Parameter] d
# 101| 4: [BlockStmt] {...}
# 101| 0: [ReturnStmt] return ...;
# 101| 0: [ObjectCreation] object creation of type D
# 101| 0: [ParameterAccess] access to parameter d

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,547 @@
Nesting.cs:
# 1| [Class] A<>
#-----| 1: (Type parameters)
# 1| 0: [TypeParameter] T1
# 3| 5: [Method] MA1
#-----| 2: (Parameters)
# 3| 0: [Parameter] x
# 3| 4: [BlockStmt] {...}
# 4| 6: [Method] MA2
#-----| 1: (Type parameters)
# 4| 0: [TypeParameter] T2
#-----| 2: (Parameters)
# 4| 0: [Parameter] x
# 4| 1: [Parameter] y
# 4| 4: [BlockStmt] {...}
# 6| 7: [Class] B<>
#-----| 1: (Type parameters)
# 6| 0: [TypeParameter] T3
# 8| 5: [Method] MB1
#-----| 2: (Parameters)
# 8| 0: [Parameter] x
# 8| 1: [Parameter] y
# 8| 4: [BlockStmt] {...}
# 9| 6: [Method] MB2
#-----| 1: (Type parameters)
# 9| 0: [TypeParameter] T4
#-----| 2: (Parameters)
# 9| 0: [Parameter] x
# 9| 1: [Parameter] y
# 9| 2: [Parameter] z
# 9| 4: [BlockStmt] {...}
# 12| 8: [Class] C
# 14| 5: [Method] MC1
#-----| 2: (Parameters)
# 14| 0: [Parameter] x
# 14| 4: [BlockStmt] {...}
# 15| 6: [Method] MC2
#-----| 1: (Type parameters)
# 15| 0: [TypeParameter] T5
#-----| 2: (Parameters)
# 15| 0: [Parameter] x
# 15| 1: [Parameter] y
# 15| 4: [BlockStmt] {...}
# 17| 7: [Class] D<>
#-----| 1: (Type parameters)
# 17| 0: [TypeParameter] T6
# 19| 5: [Method] MD1
#-----| 2: (Parameters)
# 19| 0: [Parameter] x
# 19| 1: [Parameter] y
# 19| 4: [BlockStmt] {...}
# 20| 6: [Method] MD2
#-----| 1: (Type parameters)
# 20| 0: [TypeParameter] T7
#-----| 2: (Parameters)
# 20| 0: [Parameter] x
# 20| 1: [Parameter] y
# 20| 2: [Parameter] z
# 20| 4: [BlockStmt] {...}
# 24| 9: [Method] Construct
# 25| 4: [BlockStmt] {...}
# 26| 0: [LocalVariableDeclStmt] ... ...;
# 26| 0: [LocalVariableDeclAndInitExpr] A<Int32> a1 = ...
# 26| 0: [ObjectCreation] object creation of type A<Int32>
# 26| 1: [LocalVariableAccess] access to local variable a1
# 27| 1: [ExprStmt] ...;
# 27| 0: [MethodCall] call to method MA1
# 27| -1: [LocalVariableAccess] access to local variable a1
# 27| 0: [IntLiteral] 0
# 28| 2: [ExprStmt] ...;
# 28| 0: [MethodCall] call to method MA2
# 28| -1: [LocalVariableAccess] access to local variable a1
# 28| 0: [IntLiteral] 0
# 28| 1: [StringLiteral] ""
# 30| 3: [LocalVariableDeclStmt] ... ...;
# 30| 0: [LocalVariableDeclAndInitExpr] A<String> a2 = ...
# 30| 0: [ObjectCreation] object creation of type A<String>
# 30| 1: [LocalVariableAccess] access to local variable a2
# 31| 4: [ExprStmt] ...;
# 31| 0: [MethodCall] call to method MA1
# 31| -1: [LocalVariableAccess] access to local variable a2
# 31| 0: [StringLiteral] ""
# 32| 5: [ExprStmt] ...;
# 32| 0: [MethodCall] call to method MA2
# 32| -1: [LocalVariableAccess] access to local variable a2
# 32| 0: [StringLiteral] ""
# 32| 1: [IntLiteral] 0
# 34| 6: [LocalVariableDeclStmt] ... ...;
# 34| 0: [LocalVariableDeclAndInitExpr] B<String> b1 = ...
# 34| 0: [ObjectCreation] object creation of type B<String>
# 34| 1: [LocalVariableAccess] access to local variable b1
# 35| 7: [ExprStmt] ...;
# 35| 0: [MethodCall] call to method MB1
# 35| -1: [LocalVariableAccess] access to local variable b1
# 35| 0: [IntLiteral] 0
# 35| 1: [StringLiteral] ""
# 36| 8: [ExprStmt] ...;
# 36| 0: [MethodCall] call to method MB2
# 36| -1: [LocalVariableAccess] access to local variable b1
# 36| 0: [IntLiteral] 0
# 36| 1: [StringLiteral] ""
# 36| 2: [BoolLiteral] false
# 38| 9: [LocalVariableDeclStmt] ... ...;
# 38| 0: [LocalVariableDeclAndInitExpr] B<Int32> b2 = ...
# 38| 0: [ObjectCreation] object creation of type B<Int32>
# 38| 1: [LocalVariableAccess] access to local variable b2
# 39| 10: [ExprStmt] ...;
# 39| 0: [MethodCall] call to method MB1
# 39| -1: [LocalVariableAccess] access to local variable b2
# 39| 0: [StringLiteral] ""
# 39| 1: [IntLiteral] 0
# 40| 11: [ExprStmt] ...;
# 40| 0: [MethodCall] call to method MB2
# 40| -1: [LocalVariableAccess] access to local variable b2
# 40| 0: [StringLiteral] ""
# 40| 1: [IntLiteral] 0
# 40| 2: [BoolLiteral] false
# 42| 12: [LocalVariableDeclStmt] ... ...;
# 42| 0: [LocalVariableDeclAndInitExpr] C c1 = ...
# 42| 0: [ObjectCreation] object creation of type C
# 42| 1: [LocalVariableAccess] access to local variable c1
# 43| 13: [ExprStmt] ...;
# 43| 0: [MethodCall] call to method MC1
# 43| -1: [LocalVariableAccess] access to local variable c1
# 43| 0: [IntLiteral] 0
# 44| 14: [ExprStmt] ...;
# 44| 0: [MethodCall] call to method MC2
# 44| -1: [LocalVariableAccess] access to local variable c1
# 44| 0: [IntLiteral] 0
# 44| 1: [BoolLiteral] false
# 46| 15: [LocalVariableDeclStmt] ... ...;
# 46| 0: [LocalVariableDeclAndInitExpr] C c2 = ...
# 46| 0: [ObjectCreation] object creation of type C
# 46| 1: [LocalVariableAccess] access to local variable c2
# 47| 16: [ExprStmt] ...;
# 47| 0: [MethodCall] call to method MC1
# 47| -1: [LocalVariableAccess] access to local variable c2
# 47| 0: [StringLiteral] ""
# 48| 17: [ExprStmt] ...;
# 48| 0: [MethodCall] call to method MC2
# 48| -1: [LocalVariableAccess] access to local variable c2
# 48| 0: [StringLiteral] ""
# 48| 1: [BoolLiteral] false
# 50| 18: [LocalVariableDeclStmt] ... ...;
# 50| 0: [LocalVariableDeclAndInitExpr] D<Boolean> d1 = ...
# 50| 0: [ObjectCreation] object creation of type D<Boolean>
# 50| 1: [LocalVariableAccess] access to local variable d1
# 51| 19: [ExprStmt] ...;
# 51| 0: [MethodCall] call to method MD1
# 51| -1: [LocalVariableAccess] access to local variable d1
# 51| 0: [IntLiteral] 0
# 51| 1: [BoolLiteral] false
# 52| 20: [ExprStmt] ...;
# 52| 0: [MethodCall] call to method MD2
# 52| -1: [LocalVariableAccess] access to local variable d1
# 52| 0: [IntLiteral] 0
# 52| 1: [BoolLiteral] false
# 52| 2: [StringLiteral] ""
# 54| 21: [LocalVariableDeclStmt] ... ...;
# 54| 0: [LocalVariableDeclAndInitExpr] D<Decimal> d2 = ...
# 54| 0: [ObjectCreation] object creation of type D<Decimal>
# 54| 1: [LocalVariableAccess] access to local variable d2
# 55| 22: [ExprStmt] ...;
# 55| 0: [MethodCall] call to method MD1
# 55| -1: [LocalVariableAccess] access to local variable d2
# 55| 0: [StringLiteral] ""
# 55| 1: [DecimalLiteral] 0
# 56| 23: [ExprStmt] ...;
# 56| 0: [MethodCall] call to method MD2
# 56| -1: [LocalVariableAccess] access to local variable d2
# 56| 0: [StringLiteral] ""
# 56| 1: [DecimalLiteral] 0
# 56| 2: [BoolLiteral] false
generics.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 7| 1: [DelegateType] GenericDelegate<>
#-----| 1: (Type parameters)
# 7| 0: [TypeParameter] T
#-----| 2: (Parameters)
# 7| 0: [Parameter] t
# 9| 2: [Class] A
# 13| 3: [Class] A<>
#-----| 1: (Type parameters)
# 13| 0: [TypeParameter] T
# 16| 5: [DelegateType] GenericDelegateInGenericClass<>
#-----| 1: (Type parameters)
# 16| 0: [TypeParameter] U
#-----| 2: (Parameters)
# 16| 0: [Parameter] t
# 16| 1: [Parameter] u
# 18| 6: [Method] bar
#-----| 1: (Type parameters)
# 18| 0: [TypeParameter] X
#-----| 2: (Parameters)
# 18| 0: [Parameter] x
# 18| 1: [Parameter] t
# 18| 4: [BlockStmt] {...}
# 18| 0: [LocalVariableDeclStmt] ... ...;
# 18| 0: [LocalVariableDeclExpr] A<> a
# 18| 1: [ReturnStmt] return ...;
# 18| 0: [ParameterAccess] access to parameter t
# 22| 4: [Class] B<>
#-----| 1: (Type parameters)
# 22| 0: [TypeParameter] T
# 25| 5: [Field] at
# 27| 6: [Field] name
# 29| 7: [Method] foo
# 29| 4: [BlockStmt] {...}
# 31| 8: [Method] fooParams
#-----| 2: (Parameters)
# 31| 0: [Parameter] ts
# 31| 4: [BlockStmt] {...}
# 33| 9: [Method] staticFoo
# 33| 4: [BlockStmt] {...}
# 35| 10: [IndexerProperty] Name
# 35| 3: [Getter] get_Name
# 35| 4: [BlockStmt] {...}
# 35| 0: [ReturnStmt] return ...;
# 35| 0: [FieldAccess] access to field name
# 35| 4: [Setter] set_Name
#-----| 2: (Parameters)
# 35| 0: [Parameter] value
# 35| 4: [BlockStmt] {...}
# 35| 0: [ExprStmt] ...;
# 35| 0: [AssignExpr] ... = ...
# 35| 0: [ParameterAccess] access to parameter value
# 35| 1: [FieldAccess] access to field name
# 37| 11: [Event] myEvent
# 37| 3: [AddEventAccessor] add_myEvent
#-----| 2: (Parameters)
# 37| 0: [Parameter] value
# 37| 3: [RemoveEventAccessor] remove_myEvent
#-----| 2: (Parameters)
# 37| 0: [Parameter] value
# 39| 12: [IncrementOperator] ++
#-----| 2: (Parameters)
# 39| 0: [Parameter] a
# 40| 4: [BlockStmt] {...}
# 41| 0: [ReturnStmt] return ...;
# 41| 0: [ObjectCreation] object creation of type B<>
# 44| 13: [Destructor] ~B
# 44| 4: [BlockStmt] {...}
# 45| 14: [Method] f
#-----| 1: (Type parameters)
# 45| 0: [TypeParameter] X
# 45| 4: [BlockStmt] {...}
# 45| 0: [ExprStmt] ...;
# 45| 0: [ObjectCreation] object creation of type B<X>
# 48| 5: [Class] Outer<>
#-----| 1: (Type parameters)
# 48| 0: [TypeParameter] T
# 51| 5: [Class] Inner<>
#-----| 1: (Type parameters)
# 51| 0: [TypeParameter] U
# 54| 5: [Field] t
# 55| 6: [Field] myFunc
# 60| 6: [Class] Grid<>
#-----| 1: (Type parameters)
# 60| 0: [TypeParameter] T
# 63| 5: [Field] NumRows
# 63| 1: [AssignExpr] ... = ...
# 63| 0: [IntLiteral] 26
# 63| 1: [MemberConstantAccess] access to constant NumRows
# 64| 6: [Field] NumCols
# 64| 1: [AssignExpr] ... = ...
# 64| 0: [IntLiteral] 10
# 64| 1: [MemberConstantAccess] access to constant NumCols
# 66| 7: [Field] cells
# 66| 1: [AssignExpr] ... = ...
# 66| 0: [ArrayCreation] array creation of type T[,]
# 66| 0: [MemberConstantAccess] access to constant NumRows
# 66| 1: [MemberConstantAccess] access to constant NumCols
# 66| 1: [FieldAccess] access to field cells
# 68| 8: [Indexer] Item
#-----| 1: (Parameters)
# 68| 0: [Parameter] i
# 70| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 68| 0: [Parameter] i
# 70| 4: [BlockStmt] {...}
# 70| 0: [ReturnStmt] return ...;
# 70| 0: [ParameterAccess] access to parameter i
# 73| 9: [Indexer] Item
#-----| 1: (Parameters)
# 73| 0: [Parameter] c
# 73| 1: [Parameter] col
# 75| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 73| 0: [Parameter] c
# 73| 1: [Parameter] col
# 76| 4: [BlockStmt] {...}
# 77| 0: [ExprStmt] ...;
# 77| 0: [AssignExpr] ... = ...
# 77| 0: [MethodCall] call to method ToUpper
# 77| -1: [TypeAccess] access to type Char
# 77| 0: [ParameterAccess] access to parameter c
# 77| 1: [ParameterAccess] access to parameter c
# 78| 1: [IfStmt] if (...) ...
# 78| 0: [LogicalOrExpr] ... || ...
# 78| 0: [LTExpr] ... < ...
# 78| 0: [CastExpr] (...) ...
# 78| 0: [ParameterAccess] access to parameter c
# 78| 1: [CastExpr] (...) ...
# 78| 0: [CharLiteral] A
# 78| 1: [GTExpr] ... > ...
# 78| 0: [CastExpr] (...) ...
# 78| 0: [ParameterAccess] access to parameter c
# 78| 1: [CastExpr] (...) ...
# 78| 0: [CharLiteral] Z
# 79| 1: [BlockStmt] {...}
# 80| 0: [ThrowStmt] throw ...;
# 80| 0: [ObjectCreation] object creation of type ArgumentException
# 82| 2: [IfStmt] if (...) ...
# 82| 0: [LogicalOrExpr] ... || ...
# 82| 0: [LTExpr] ... < ...
# 82| 0: [ParameterAccess] access to parameter col
# 82| 1: [IntLiteral] 0
# 82| 1: [GEExpr] ... >= ...
# 82| 0: [ParameterAccess] access to parameter col
# 82| 1: [MemberConstantAccess] access to constant NumCols
# 83| 1: [BlockStmt] {...}
# 84| 0: [ThrowStmt] throw ...;
# 84| 0: [ObjectCreation] object creation of type IndexOutOfRangeException
# 86| 3: [ReturnStmt] return ...;
# 86| 0: [ArrayAccess] access to array element
# 86| -1: [FieldAccess] access to field cells
# 86| 0: [SubExpr] ... - ...
# 86| 0: [CastExpr] (...) ...
# 86| 0: [ParameterAccess] access to parameter c
# 86| 1: [CastExpr] (...) ...
# 86| 0: [CharLiteral] A
# 86| 1: [ParameterAccess] access to parameter col
# 88| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 73| 0: [Parameter] c
# 73| 1: [Parameter] col
# 88| 2: [Parameter] value
# 89| 4: [BlockStmt] {...}
# 90| 0: [ExprStmt] ...;
# 90| 0: [AssignExpr] ... = ...
# 90| 0: [MethodCall] call to method ToUpper
# 90| -1: [TypeAccess] access to type Char
# 90| 0: [ParameterAccess] access to parameter c
# 90| 1: [ParameterAccess] access to parameter c
# 91| 1: [IfStmt] if (...) ...
# 91| 0: [LogicalOrExpr] ... || ...
# 91| 0: [LTExpr] ... < ...
# 91| 0: [CastExpr] (...) ...
# 91| 0: [ParameterAccess] access to parameter c
# 91| 1: [CastExpr] (...) ...
# 91| 0: [CharLiteral] A
# 91| 1: [GTExpr] ... > ...
# 91| 0: [CastExpr] (...) ...
# 91| 0: [ParameterAccess] access to parameter c
# 91| 1: [CastExpr] (...) ...
# 91| 0: [CharLiteral] Z
# 92| 1: [BlockStmt] {...}
# 93| 0: [ThrowStmt] throw ...;
# 93| 0: [ObjectCreation] object creation of type ArgumentException
# 95| 2: [IfStmt] if (...) ...
# 95| 0: [LogicalOrExpr] ... || ...
# 95| 0: [LTExpr] ... < ...
# 95| 0: [ParameterAccess] access to parameter col
# 95| 1: [IntLiteral] 0
# 95| 1: [GEExpr] ... >= ...
# 95| 0: [ParameterAccess] access to parameter col
# 95| 1: [MemberConstantAccess] access to constant NumCols
# 96| 1: [BlockStmt] {...}
# 97| 0: [ThrowStmt] throw ...;
# 97| 0: [ObjectCreation] object creation of type IndexOutOfRangeException
# 99| 3: [ExprStmt] ...;
# 99| 0: [AssignExpr] ... = ...
# 99| 0: [ParameterAccess] access to parameter value
# 99| 1: [ArrayAccess] access to array element
# 99| -1: [FieldAccess] access to field cells
# 99| 0: [SubExpr] ... - ...
# 99| 0: [CastExpr] (...) ...
# 99| 0: [ParameterAccess] access to parameter c
# 99| 1: [CastExpr] (...) ...
# 99| 0: [CharLiteral] A
# 99| 1: [ParameterAccess] access to parameter col
# 105| 7: [Class] Test
# 108| 5: [Method] Main
# 109| 4: [BlockStmt] {...}
# 110| 0: [LocalVariableDeclStmt] ... ...;
# 110| 0: [LocalVariableDeclAndInitExpr] B<String> bs = ...
# 110| 0: [ObjectCreation] object creation of type B<String>
# 110| 1: [LocalVariableAccess] access to local variable bs
# 111| 1: [ExprStmt] ...;
# 111| 0: [AssignExpr] ... = ...
# 111| 0: [ObjectCreation] object creation of type A<String>
# 111| 1: [FieldAccess] access to field at
# 111| -1: [LocalVariableAccess] access to local variable bs
# 112| 2: [ExprStmt] ...;
# 112| 0: [MethodCall] call to method foo
# 112| -1: [LocalVariableAccess] access to local variable bs
# 113| 3: [ExprStmt] ...;
# 113| 0: [MethodCall] call to method fooParams
# 113| -1: [LocalVariableAccess] access to local variable bs
# 113| 0: [StringLiteral] "a"
# 113| 1: [StringLiteral] "b"
# 115| 4: [ExprStmt] ...;
# 115| 0: [MethodCall] call to method staticFoo
# 115| -1: [TypeAccess] access to type B<Object>
# 117| 5: [ExprStmt] ...;
# 117| 0: [AssignExpr] ... = ...
# 117| 0: [StringLiteral] ""
# 117| 1: [PropertyCall] access to property Name
# 117| -1: [LocalVariableAccess] access to local variable bs
# 118| 6: [ExprStmt] ...;
# 118| 0: [AddEventExpr] ... += ...
# 118| 0: [ExplicitDelegateCreation] delegate creation of type GenericDelegate<String>
# 118| 0: [MethodAccess] access to method f
# 118| 1: [EventAccess,EventCall] access to event myEvent
# 118| -1: [LocalVariableAccess] access to local variable bs
# 119| 7: [ExprStmt] ...;
# 119| 0: [OperatorCall] call to operator ++
# 119| 0: [LocalVariableAccess] access to local variable bs
# 121| 8: [LocalVariableDeclStmt] ... ...;
# 121| 0: [LocalVariableDeclAndInitExpr] Grid<Int32> g = ...
# 121| 0: [ObjectCreation] object creation of type Grid<Int32>
# 121| 1: [LocalVariableAccess] access to local variable g
# 122| 9: [LocalVariableDeclStmt] ... ...;
# 122| 0: [LocalVariableDeclAndInitExpr] Int32 j = ...
# 122| 0: [IndexerCall] access to indexer
# 122| -1: [LocalVariableAccess] access to local variable g
# 122| 0: [CharLiteral] e
# 122| 1: [IntLiteral] 1
# 122| 1: [LocalVariableAccess] access to local variable j
# 124| 10: [ExprStmt] ...;
# 124| 0: [AssignExpr] ... = ...
# 124| 0: [CastExpr] (...) ...
# 124| 0: [IntLiteral] 3
# 124| 1: [FieldAccess] access to field t
# 124| -1: [ObjectCreation] object creation of type Inner<String>
# 126| 11: [ExprStmt] ...;
# 126| 0: [MethodCall] call to method bar
# 126| -1: [ObjectCreation] object creation of type A<String>
# 126| 0: [IntLiteral] 2
# 126| 1: [StringLiteral] ""
# 127| 12: [ExprStmt] ...;
# 127| 0: [MethodCall] call to method bar
# 127| -1: [ObjectCreation] object creation of type A<Int32>
# 127| 0: [ObjectCreation] object creation of type Test
# 127| 1: [IntLiteral] 2
# 130| 6: [Method] f
#-----| 2: (Parameters)
# 130| 0: [Parameter] s
# 130| 4: [BlockStmt] {...}
# 130| 0: [ReturnStmt] return ...;
# 130| 0: [ParameterAccess] access to parameter s
# 134| 8: [Class] Subtle
# 137| 5: [Method] fs
#-----| 1: (Type parameters)
# 137| 0: [TypeParameter] X
#-----| 2: (Parameters)
# 137| 0: [Parameter] i
# 137| 4: [BlockStmt] {...}
# 139| 6: [Method] fs
#-----| 1: (Type parameters)
# 139| 0: [TypeParameter] X
#-----| 2: (Parameters)
# 139| 0: [Parameter] i
# 139| 1: [Parameter] j
# 139| 4: [BlockStmt] {...}
# 141| 7: [Method] fs
#-----| 2: (Parameters)
# 141| 0: [Parameter] i
# 141| 4: [BlockStmt] {...}
# 145| 9: [Class] Param<>
#-----| 1: (Type parameters)
# 145| 0: [TypeParameter] T
# 147| 5: [Enum] E
# 147| 5: [Field] x
# 150| 10: [Class] ConstructedMethods
# 152| 5: [Method] CM1
#-----| 1: (Type parameters)
# 152| 0: [TypeParameter] T
# 152| 4: [BlockStmt] {...}
# 153| 8: [Method] CM2
#-----| 1: (Type parameters)
# 153| 0: [TypeParameter] T
#-----| 2: (Parameters)
# 153| 0: [Parameter] t
# 153| 4: [BlockStmt] {...}
# 153| 0: [ReturnStmt] return ...;
# 153| 0: [ParameterAccess] access to parameter t
# 155| 11: [Class] Class<>
#-----| 1: (Type parameters)
# 155| 0: [TypeParameter] T1
# 157| 5: [Method] CM3
#-----| 1: (Type parameters)
# 157| 0: [TypeParameter] T2
#-----| 2: (Parameters)
# 157| 0: [Parameter] t
# 157| 1: [Parameter] t1
# 157| 4: [BlockStmt] {...}
# 157| 0: [ReturnStmt] return ...;
# 157| 0: [ParameterAccess] access to parameter t
# 160| 14: [Method] NonCM
# 160| 4: [BlockStmt] {...}
# 162| 15: [Method] CM
# 163| 4: [BlockStmt] {...}
# 164| 0: [ExprStmt] ...;
# 164| 0: [MethodCall] call to method CM1
# 165| 1: [ExprStmt] ...;
# 165| 0: [MethodCall] call to method CM1
# 166| 2: [ExprStmt] ...;
# 166| 0: [MethodCall] call to method CM2
# 166| 0: [IntLiteral] 4
# 167| 3: [ExprStmt] ...;
# 167| 0: [MethodCall] call to method CM2
# 167| 0: [DoubleLiteral] 2
# 168| 4: [ExprStmt] ...;
# 168| 0: [MethodCall] call to method CM3
# 168| -1: [ObjectCreation] object creation of type Class<Int32>
# 168| 0: [DoubleLiteral] 1
# 168| 1: [IntLiteral] 2
# 169| 5: [ExprStmt] ...;
# 169| 0: [MethodCall] call to method CM3
# 169| -1: [ObjectCreation] object creation of type Class<Double>
# 169| 0: [DoubleLiteral] 1
# 169| 1: [DoubleLiteral] 2
# 173| 11: [Interface] Interface<>
#-----| 1: (Type parameters)
# 173| 0: [TypeParameter] T
# 175| 4: [Method] set
#-----| 2: (Parameters)
# 175| 0: [Parameter] t
# 178| 12: [Class] Inheritance<>
#-----| 1: (Type parameters)
# 178| 0: [TypeParameter] T
#-----| 3: (Base types)
# 178| 1: [Interface] Interface<T>
# 180| 5: [Method] set
#-----| 2: (Parameters)
# 180| 0: [Parameter] t
# 180| 4: [BlockStmt] {...}
# 183| 13: [Class] InheritanceTest
# 185| 5: [Field] member
# 188| 14: [Interface] Interface2<,>
#-----| 1: (Type parameters)
# 188| 0: [TypeParameter] T1
# 188| 1: [TypeParameter] T2
# 190| 4: [Method] M
#-----| 2: (Parameters)
# 190| 0: [Parameter] x

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,42 @@
goto.cs:
# 2| [Class] Goto
# 4| 5: [Method] Main
# 5| 4: [BlockStmt] {...}
# 6| 0: [BlockStmt] {...}
# 7| 0: [LabelStmt] s1:
# 7| 1: [GotoLabelStmt] goto ...;
# 9| 1: [LabelStmt] s2:
# 9| 2: [LocalVariableDeclStmt] ... ...;
# 9| 0: [LocalVariableDeclAndInitExpr] String s = ...
# 9| 0: [StringLiteral] "5"
# 9| 1: [LocalVariableAccess] access to local variable s
# 10| 3: [SwitchStmt] switch (...) {...}
# 10| 0: [LocalVariableAccess] access to local variable s
# 12| 0: [ConstCase] case ...:
# 12| 0: [ConstantPatternExpr,NullLiteral] null
# 12| 1: [LabelStmt] s3:
# 12| 2: [GotoCaseStmt] goto case ...;
# 12| 0: [StringLiteral] "1"
# 13| 3: [ConstCase] case ...:
# 13| 0: [ConstantPatternExpr,StringLiteral] "1"
# 13| 4: [LabelStmt] s4:
# 13| 5: [GotoCaseStmt] goto case ...;
# 13| 0: [StringLiteral] "2"
# 14| 6: [ConstCase] case ...:
# 14| 0: [ConstantPatternExpr,StringLiteral] "2"
# 14| 7: [LabelStmt] s5:
# 14| 8: [GotoLabelStmt] goto ...;
# 15| 9: [ConstCase] case ...:
# 15| 0: [ConstantPatternExpr,StringLiteral] "3"
# 15| 10: [LabelStmt] s6:
# 15| 11: [GotoDefaultStmt] goto default;
# 16| 12: [ConstCase] case ...:
# 16| 0: [ConstantPatternExpr,StringLiteral] "4"
# 16| 13: [LabelStmt] s7:
# 16| 14: [BreakStmt] break;
# 17| 15: [DefaultCase] default:
# 17| 16: [LabelStmt] s8:
# 17| 17: [GotoCaseStmt] goto case ...;
# 17| 0: [NullLiteral] null
# 19| 4: [LabelStmt] s9:
# 19| 5: [EmptyStmt] ;

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,322 @@
indexers.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 8| 1: [Class] BitArray
# 11| 4: [Field] bits
# 12| 5: [Field] length
# 14| 6: [InstanceConstructor] BitArray
#-----| 2: (Parameters)
# 14| 0: [Parameter] length
# 15| 4: [BlockStmt] {...}
# 16| 0: [IfStmt] if (...) ...
# 16| 0: [LTExpr] ... < ...
# 16| 0: [ParameterAccess] access to parameter length
# 16| 1: [IntLiteral] 0
# 17| 1: [ThrowStmt] throw ...;
# 17| 0: [ObjectCreation] object creation of type ArgumentException
# 18| 1: [ExprStmt] ...;
# 18| 0: [AssignExpr] ... = ...
# 18| 0: [ArrayCreation] array creation of type Int32[]
# 18| 0: [AddExpr] ... + ...
# 18| 0: [RShiftExpr] ... >> ...
# 18| 0: [SubExpr] ... - ...
# 18| 0: [ParameterAccess] access to parameter length
# 18| 1: [IntLiteral] 1
# 18| 1: [IntLiteral] 5
# 18| 1: [IntLiteral] 1
# 18| 1: [FieldAccess] access to field bits
# 19| 2: [ExprStmt] ...;
# 19| 0: [AssignExpr] ... = ...
# 19| 0: [ParameterAccess] access to parameter length
# 19| 1: [FieldAccess] access to field length
# 19| -1: [ThisAccess] this access
# 22| 7: [Property] Length
# 22| 3: [Getter] get_Length
# 22| 4: [BlockStmt] {...}
# 22| 0: [ReturnStmt] return ...;
# 22| 0: [FieldAccess] access to field length
# 24| 8: [Indexer] Item
#-----| 1: (Parameters)
# 24| 0: [Parameter] index
# 26| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 24| 0: [Parameter] index
# 27| 4: [BlockStmt] {...}
# 28| 0: [IfStmt] if (...) ...
# 28| 0: [LogicalOrExpr] ... || ...
# 28| 0: [LTExpr] ... < ...
# 28| 0: [ParameterAccess] access to parameter index
# 28| 1: [IntLiteral] 0
# 28| 1: [GEExpr] ... >= ...
# 28| 0: [ParameterAccess] access to parameter index
# 28| 1: [FieldAccess] access to field length
# 29| 1: [BlockStmt] {...}
# 30| 0: [ThrowStmt] throw ...;
# 30| 0: [ObjectCreation] object creation of type IndexOutOfRangeException
# 32| 1: [ReturnStmt] return ...;
# 32| 0: [NEExpr] ... != ...
# 32| 0: [BitwiseAndExpr] ... & ...
# 32| 0: [ArrayAccess] access to array element
# 32| -1: [FieldAccess] access to field bits
# 32| 0: [RShiftExpr] ... >> ...
# 32| 0: [ParameterAccess] access to parameter index
# 32| 1: [IntLiteral] 5
# 32| 1: [LShiftExpr] ... << ...
# 32| 0: [IntLiteral] 1
# 32| 1: [ParameterAccess] access to parameter index
# 32| 1: [IntLiteral] 0
# 34| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 24| 0: [Parameter] index
# 34| 1: [Parameter] value
# 35| 4: [BlockStmt] {...}
# 36| 0: [IfStmt] if (...) ...
# 36| 0: [LogicalOrExpr] ... || ...
# 36| 0: [LTExpr] ... < ...
# 36| 0: [ParameterAccess] access to parameter index
# 36| 1: [IntLiteral] 0
# 36| 1: [GEExpr] ... >= ...
# 36| 0: [ParameterAccess] access to parameter index
# 36| 1: [FieldAccess] access to field length
# 37| 1: [BlockStmt] {...}
# 38| 0: [ThrowStmt] throw ...;
# 38| 0: [ObjectCreation] object creation of type IndexOutOfRangeException
# 40| 1: [IfStmt] if (...) ...
# 40| 0: [ParameterAccess] access to parameter value
# 41| 1: [BlockStmt] {...}
# 42| 0: [ExprStmt] ...;
# 42| 0: [AssignOrExpr] ... |= ...
# 42| 0: [LShiftExpr] ... << ...
# 42| 0: [IntLiteral] 1
# 42| 1: [ParameterAccess] access to parameter index
# 42| 1: [ArrayAccess] access to array element
# 42| -1: [FieldAccess] access to field bits
# 42| 0: [RShiftExpr] ... >> ...
# 42| 0: [ParameterAccess] access to parameter index
# 42| 1: [IntLiteral] 5
# 45| 2: [BlockStmt] {...}
# 46| 0: [ExprStmt] ...;
# 46| 0: [AssignAndExpr] ... &= ...
# 46| 0: [ComplementExpr] ~...
# 46| 0: [LShiftExpr] ... << ...
# 46| 0: [IntLiteral] 1
# 46| 1: [ParameterAccess] access to parameter index
# 46| 1: [ArrayAccess] access to array element
# 46| -1: [FieldAccess] access to field bits
# 46| 0: [RShiftExpr] ... >> ...
# 46| 0: [ParameterAccess] access to parameter index
# 46| 1: [IntLiteral] 5
# 53| 2: [Class] CountPrimes
# 56| 5: [Method] Count
#-----| 2: (Parameters)
# 56| 0: [Parameter] max
# 57| 4: [BlockStmt] {...}
# 58| 0: [LocalVariableDeclStmt] ... ...;
# 58| 0: [LocalVariableDeclAndInitExpr] BitArray flags = ...
# 58| 0: [ObjectCreation] object creation of type BitArray
# 58| 0: [AddExpr] ... + ...
# 58| 0: [ParameterAccess] access to parameter max
# 58| 1: [IntLiteral] 1
# 58| 1: [LocalVariableAccess] access to local variable flags
# 59| 1: [LocalVariableDeclStmt] ... ...;
# 59| 0: [LocalVariableDeclAndInitExpr] Int32 count = ...
# 59| 0: [IntLiteral] 1
# 59| 1: [LocalVariableAccess] access to local variable count
# 60| 2: [ForStmt] for (...;...;...) ...
# 60| -1: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 60| 0: [IntLiteral] 2
# 60| 1: [LocalVariableAccess] access to local variable i
# 60| 0: [LEExpr] ... <= ...
# 60| 0: [LocalVariableAccess] access to local variable i
# 60| 1: [ParameterAccess] access to parameter max
# 60| 1: [PostIncrExpr] ...++
# 60| 0: [LocalVariableAccess] access to local variable i
# 61| 2: [BlockStmt] {...}
# 62| 0: [IfStmt] if (...) ...
# 62| 0: [LogicalNotExpr] !...
# 62| 0: [IndexerCall] access to indexer
# 62| -1: [LocalVariableAccess] access to local variable flags
# 62| 0: [LocalVariableAccess] access to local variable i
# 63| 1: [BlockStmt] {...}
# 64| 0: [ForStmt] for (...;...;...) ...
# 64| -1: [LocalVariableDeclAndInitExpr] Int32 j = ...
# 64| 0: [MulExpr] ... * ...
# 64| 0: [LocalVariableAccess] access to local variable i
# 64| 1: [IntLiteral] 2
# 64| 1: [LocalVariableAccess] access to local variable j
# 64| 0: [LEExpr] ... <= ...
# 64| 0: [LocalVariableAccess] access to local variable j
# 64| 1: [ParameterAccess] access to parameter max
# 64| 1: [AssignAddExpr] ... += ...
# 64| 0: [LocalVariableAccess] access to local variable i
# 64| 1: [LocalVariableAccess] access to local variable j
# 65| 2: [ExprStmt] ...;
# 65| 0: [AssignExpr] ... = ...
# 65| 0: [BoolLiteral] true
# 65| 1: [IndexerCall] access to indexer
# 65| -1: [LocalVariableAccess] access to local variable flags
# 65| 0: [LocalVariableAccess] access to local variable j
# 66| 1: [ExprStmt] ...;
# 66| 0: [PostIncrExpr] ...++
# 66| 0: [LocalVariableAccess] access to local variable count
# 69| 3: [ReturnStmt] return ...;
# 69| 0: [LocalVariableAccess] access to local variable count
# 72| 6: [Method] Main
#-----| 2: (Parameters)
# 72| 0: [Parameter] args
# 73| 4: [BlockStmt] {...}
# 74| 0: [LocalVariableDeclStmt] ... ...;
# 74| 0: [LocalVariableDeclAndInitExpr] Int32 max = ...
# 74| 0: [MethodCall] call to method Parse
# 74| -1: [TypeAccess] access to type Int32
# 74| 0: [ArrayAccess] access to array element
# 74| -1: [ParameterAccess] access to parameter args
# 74| 0: [IntLiteral] 0
# 74| 1: [LocalVariableAccess] access to local variable max
# 75| 1: [LocalVariableDeclStmt] ... ...;
# 75| 0: [LocalVariableDeclAndInitExpr] Int32 count = ...
# 75| 0: [MethodCall] call to method Count
# 75| 0: [LocalVariableAccess] access to local variable max
# 75| 1: [LocalVariableAccess] access to local variable count
# 76| 2: [ExprStmt] ...;
# 76| 0: [MethodCall] call to method WriteLine
# 76| -1: [TypeAccess] access to type Console
# 76| 0: [StringLiteral] "Found {0} primes between 1 and {1}"
# 76| 1: [CastExpr] (...) ...
# 76| 0: [LocalVariableAccess] access to local variable count
# 76| 2: [CastExpr] (...) ...
# 76| 0: [LocalVariableAccess] access to local variable max
# 81| 3: [Class] Grid
# 84| 5: [Field] NumRows
# 84| 1: [AssignExpr] ... = ...
# 84| 0: [IntLiteral] 26
# 84| 1: [MemberConstantAccess] access to constant NumRows
# 85| 6: [Field] NumCols
# 85| 1: [AssignExpr] ... = ...
# 85| 0: [IntLiteral] 10
# 85| 1: [MemberConstantAccess] access to constant NumCols
# 87| 7: [Field] cells
# 87| 1: [AssignExpr] ... = ...
# 87| 0: [ArrayCreation] array creation of type Int32[,]
# 87| 0: [MemberConstantAccess] access to constant NumRows
# 87| 1: [MemberConstantAccess] access to constant NumCols
# 87| 1: [FieldAccess] access to field cells
# 89| 8: [Indexer] Item
#-----| 1: (Parameters)
# 89| 0: [Parameter] c
# 89| 1: [Parameter] col
# 91| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 89| 0: [Parameter] c
# 89| 1: [Parameter] col
# 92| 4: [BlockStmt] {...}
# 93| 0: [ExprStmt] ...;
# 93| 0: [AssignExpr] ... = ...
# 93| 0: [MethodCall] call to method ToUpper
# 93| -1: [TypeAccess] access to type Char
# 93| 0: [ParameterAccess] access to parameter c
# 93| 1: [ParameterAccess] access to parameter c
# 94| 1: [IfStmt] if (...) ...
# 94| 0: [LogicalOrExpr] ... || ...
# 94| 0: [LTExpr] ... < ...
# 94| 0: [CastExpr] (...) ...
# 94| 0: [ParameterAccess] access to parameter c
# 94| 1: [CastExpr] (...) ...
# 94| 0: [CharLiteral] A
# 94| 1: [GTExpr] ... > ...
# 94| 0: [CastExpr] (...) ...
# 94| 0: [ParameterAccess] access to parameter c
# 94| 1: [CastExpr] (...) ...
# 94| 0: [CharLiteral] Z
# 95| 1: [BlockStmt] {...}
# 96| 0: [ThrowStmt] throw ...;
# 96| 0: [ObjectCreation] object creation of type ArgumentException
# 98| 2: [IfStmt] if (...) ...
# 98| 0: [LogicalOrExpr] ... || ...
# 98| 0: [LTExpr] ... < ...
# 98| 0: [ParameterAccess] access to parameter col
# 98| 1: [IntLiteral] 0
# 98| 1: [GEExpr] ... >= ...
# 98| 0: [ParameterAccess] access to parameter col
# 98| 1: [MemberConstantAccess] access to constant NumCols
# 99| 1: [BlockStmt] {...}
# 100| 0: [ThrowStmt] throw ...;
# 100| 0: [ObjectCreation] object creation of type IndexOutOfRangeException
# 102| 3: [ReturnStmt] return ...;
# 102| 0: [ArrayAccess] access to array element
# 102| -1: [FieldAccess] access to field cells
# 102| 0: [SubExpr] ... - ...
# 102| 0: [CastExpr] (...) ...
# 102| 0: [ParameterAccess] access to parameter c
# 102| 1: [CastExpr] (...) ...
# 102| 0: [CharLiteral] A
# 102| 1: [ParameterAccess] access to parameter col
# 104| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 89| 0: [Parameter] c
# 89| 1: [Parameter] col
# 104| 2: [Parameter] value
# 105| 4: [BlockStmt] {...}
# 106| 0: [ExprStmt] ...;
# 106| 0: [AssignExpr] ... = ...
# 106| 0: [MethodCall] call to method ToUpper
# 106| -1: [TypeAccess] access to type Char
# 106| 0: [ParameterAccess] access to parameter c
# 106| 1: [ParameterAccess] access to parameter c
# 107| 1: [IfStmt] if (...) ...
# 107| 0: [LogicalOrExpr] ... || ...
# 107| 0: [LTExpr] ... < ...
# 107| 0: [CastExpr] (...) ...
# 107| 0: [ParameterAccess] access to parameter c
# 107| 1: [CastExpr] (...) ...
# 107| 0: [CharLiteral] A
# 107| 1: [GTExpr] ... > ...
# 107| 0: [CastExpr] (...) ...
# 107| 0: [ParameterAccess] access to parameter c
# 107| 1: [CastExpr] (...) ...
# 107| 0: [CharLiteral] Z
# 108| 1: [BlockStmt] {...}
# 109| 0: [ThrowStmt] throw ...;
# 109| 0: [ObjectCreation] object creation of type ArgumentException
# 111| 2: [IfStmt] if (...) ...
# 111| 0: [LogicalOrExpr] ... || ...
# 111| 0: [LTExpr] ... < ...
# 111| 0: [ParameterAccess] access to parameter col
# 111| 1: [IntLiteral] 0
# 111| 1: [GEExpr] ... >= ...
# 111| 0: [ParameterAccess] access to parameter col
# 111| 1: [MemberConstantAccess] access to constant NumCols
# 112| 1: [BlockStmt] {...}
# 113| 0: [ThrowStmt] throw ...;
# 113| 0: [ObjectCreation] object creation of type IndexOutOfRangeException
# 115| 3: [ExprStmt] ...;
# 115| 0: [AssignExpr] ... = ...
# 115| 0: [ParameterAccess] access to parameter value
# 115| 1: [ArrayAccess] access to array element
# 115| -1: [FieldAccess] access to field cells
# 115| 0: [SubExpr] ... - ...
# 115| 0: [CastExpr] (...) ...
# 115| 0: [ParameterAccess] access to parameter c
# 115| 1: [CastExpr] (...) ...
# 115| 0: [CharLiteral] A
# 115| 1: [ParameterAccess] access to parameter col
# 121| 4: [Class] DuplicateIndexerSignatures
# 123| 5: [Indexer] Item
#-----| 1: (Parameters)
# 123| 0: [Parameter] index
# 125| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 123| 0: [Parameter] index
# 125| 4: [BlockStmt] {...}
# 125| 0: [ReturnStmt] return ...;
# 125| 0: [BoolLiteral] false
# 128| 6: [Indexer] Item
#-----| 1: (Parameters)
# 128| 0: [Parameter] c
# 128| 1: [Parameter] col
# 130| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 128| 0: [Parameter] c
# 128| 1: [Parameter] col
# 130| 4: [BlockStmt] {...}
# 130| 0: [ReturnStmt] return ...;
# 130| 0: [IntLiteral] 0

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,58 @@
initializers.cs:
# 3| [Class] S1
# 5| 5: [Field] P1
# 6| 6: [Property] P2
# 6| 3: [Getter] get_P2
# 6| 4: [Setter] set_P2
#-----| 2: (Parameters)
# 6| 0: [Parameter] value
# 7| 7: [Property] P3
# 7| 3: [Setter] set_P3
#-----| 2: (Parameters)
# 7| 0: [Parameter] value
# 7| 4: [BlockStmt] {...}
# 10| [Class] S2
#-----| 3: (Base types)
# 10| 1: [Interface] IEnumerable
# 12| 5: [Method] Add
#-----| 2: (Parameters)
# 12| 0: [Parameter] x
# 12| 4: [BlockStmt] {...}
# 13| 6: [Method] Add
#-----| 2: (Parameters)
# 13| 0: [Parameter] x
# 13| 1: [Parameter] y
# 13| 4: [BlockStmt] {...}
# 14| 7: [Method] GetEnumerator
# 14| 4: [BlockStmt] {...}
# 14| 0: [ReturnStmt] return ...;
# 14| 0: [NullLiteral] null
# 17| [Class] Test
# 19| 5: [Method] Main
#-----| 2: (Parameters)
# 19| 0: [Parameter] args
# 20| 4: [BlockStmt] {...}
# 21| 0: [ExprStmt] ...;
# 21| 0: [ObjectCreation] object creation of type S1
# 21| -1: [ObjectInitializer] { ..., ... }
# 21| 0: [MemberInitializer] ... = ...
# 21| 0: [IntLiteral] 1
# 21| 1: [FieldAccess] access to field P1
# 21| 1: [MemberInitializer] ... = ...
# 21| 0: [IntLiteral] 2
# 21| 1: [PropertyCall] access to property P2
# 21| 2: [MemberInitializer] ... = ...
# 21| 0: [IntLiteral] 3
# 21| 1: [PropertyCall] access to property P3
# 22| 1: [ExprStmt] ...;
# 22| 0: [ObjectCreation] object creation of type S2
# 22| -1: [CollectionInitializer] { ..., ... }
# 22| 0: [ElementInitializer] call to method Add
# 22| 0: [IntLiteral] 1
# 22| 1: [ElementInitializer] call to method Add
# 22| 0: [IntLiteral] 2
# 22| 2: [ElementInitializer] call to method Add
# 22| 0: [IntLiteral] 3
# 22| 3: [ElementInitializer] call to method Add
# 22| 0: [IntLiteral] 4
# 22| 1: [IntLiteral] 5

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,194 @@
queries.cs:
# 5| [Class] Queries
# 7| 5: [Method] Queries1
# 8| 4: [BlockStmt] {...}
# 9| 0: [LocalVariableDeclStmt] ... ...;
# 9| 0: [LocalVariableDeclAndInitExpr] IList<Int32> list1 = ...
# 9| 0: [ObjectCreation] object creation of type List<Int32>
# 9| -1: [CollectionInitializer] { ..., ... }
# 9| 0: [ElementInitializer] call to method Add
# 9| 0: [IntLiteral] 1
# 9| 1: [ElementInitializer] call to method Add
# 9| 0: [IntLiteral] 2
# 9| 2: [ElementInitializer] call to method Add
# 9| 0: [IntLiteral] 3
# 9| 1: [LocalVariableAccess] access to local variable list1
# 10| 1: [LocalVariableDeclStmt] ... ...;
# 10| 0: [LocalVariableDeclAndInitExpr] IList<IList<Int32>> list2 = ...
# 10| 0: [ObjectCreation] object creation of type List<IList<Int32>>
# 10| -1: [CollectionInitializer] { ..., ... }
# 10| 0: [ElementInitializer] call to method Add
# 10| 0: [LocalVariableAccess] access to local variable list1
# 10| 1: [ElementInitializer] call to method Add
# 10| 0: [LocalVariableAccess] access to local variable list1
# 10| 1: [LocalVariableAccess] access to local variable list2
# 12| 2: [LocalVariableDeclStmt] ... ...;
# 12| 0: [LocalVariableDeclAndInitExpr] IEnumerable<Int32> list3 = ...
# 16| 0: [MethodCall] call to method Select
# 15| 0: [MethodCall] call to method OrderBy
# 14| 0: [MethodCall] call to method Where
# 13| 0: [LocalVariableDeclAndInitExpr] Int32 a = ...
# 13| 0: [LocalVariableAccess] access to local variable list1
# 13| 1: [LocalVariableAccess] access to local variable a
# 14| 1: [LogicalOrExpr] ... || ...
# 14| 0: [EQExpr] ... == ...
# 14| 0: [LocalVariableAccess] access to local variable a
# 14| 1: [IntLiteral] 2
# 14| 1: [EQExpr] ... == ...
# 14| 0: [LocalVariableAccess] access to local variable a
# 14| 1: [IntLiteral] 3
# 15| 1: [LocalVariableAccess] access to local variable a
# 16| 1: [AddExpr] ... + ...
# 16| 0: [LocalVariableAccess] access to local variable a
# 16| 1: [IntLiteral] 1
# 12| 1: [LocalVariableAccess] access to local variable list3
# 18| 3: [LocalVariableDeclStmt] ... ...;
# 18| 0: [LocalVariableDeclAndInitExpr] IEnumerable<Int32> list4 = ...
# 18| 0: [MethodCall] call to method Select
# 18| -1: [MethodCall] call to method OrderBy
# 18| -1: [MethodCall] call to method Where
# 18| -1: [LocalVariableAccess] access to local variable list1
# 19| 0: [LambdaExpr] (...) => ...
#-----| 2: (Parameters)
# 19| 0: [Parameter] a
# 19| 4: [LogicalOrExpr] ... || ...
# 19| 0: [EQExpr] ... == ...
# 19| 0: [ParameterAccess] access to parameter a
# 19| 1: [IntLiteral] 2
# 19| 1: [EQExpr] ... == ...
# 19| 0: [ParameterAccess] access to parameter a
# 19| 1: [IntLiteral] 3
# 20| 0: [LambdaExpr] (...) => ...
#-----| 2: (Parameters)
# 20| 0: [Parameter] a
# 20| 4: [ParameterAccess] access to parameter a
# 21| 0: [LambdaExpr] (...) => ...
#-----| 2: (Parameters)
# 21| 0: [Parameter] a
# 21| 4: [AddExpr] ... + ...
# 21| 0: [ParameterAccess] access to parameter a
# 21| 1: [IntLiteral] 1
# 18| 1: [LocalVariableAccess] access to local variable list4
# 23| 4: [LocalVariableDeclStmt] ... ...;
# 23| 0: [LocalVariableDeclAndInitExpr] IEnumerable<Int32> list5 = ...
# 28| 0: [MethodCall] call to method
# 27| 0: [MethodCall] call to method Join
# 26| 0: [MethodCall] call to method Select
# 25| 0: [MethodCall] call to method SelectMany
# 24| 0: [LocalVariableDeclAndInitExpr] IList<Int32> a = ...
# 24| 0: [LocalVariableAccess] access to local variable list2
# 24| 1: [LocalVariableAccess] access to local variable a
# 25| 1: [LocalVariableDeclAndInitExpr] IList<Int32> b = ...
# 25| 0: [LocalVariableAccess] access to local variable a
# 25| 1: [LocalVariableAccess] access to local variable b
# 25| 2: [LocalVariableAccess] access to local variable a
# 26| 1: [LocalVariableDeclAndInitExpr] Int32 next = ...
# 26| 0: [AddExpr] ... + ...
# 26| 0: [LocalVariableAccess] access to local variable b
# 26| 1: [IntLiteral] 1
# 26| 1: [LocalVariableAccess] access to local variable next
# 26| 2: [AddExpr] ... + ...
# 26| 0: [LocalVariableAccess] access to local variable b
# 26| 1: [IntLiteral] 1
# 27| 1: [LocalVariableDeclAndInitExpr] IList<Int32> c = ...
# 27| 0: [LocalVariableAccess] access to local variable list1
# 27| 1: [LocalVariableAccess] access to local variable c
# 27| 2: [LocalVariableAccess] access to local variable list1
# 27| 3: [LocalVariableAccess] access to local variable next
# 27| 4: [LocalVariableAccess] access to local variable c
# 28| 1: [IntLiteral] 1
# 23| 1: [LocalVariableAccess] access to local variable list5
# 30| 5: [LocalVariableDeclStmt] ... ...;
# 30| 0: [LocalVariableDeclAndInitExpr] IEnumerable<IGrouping<Int32,Int32>> list6 = ...
# 35| 0: [MethodCall] call to method GroupBy
# 34| 0: [MethodCall] call to method OrderByDescending
# 33| 0: [MethodCall] call to method Select
# 32| 0: [MethodCall] call to method SelectMany
# 31| 0: [LocalVariableDeclAndInitExpr] IList<Int32> a = ...
# 31| 0: [LocalVariableAccess] access to local variable list2
# 31| 1: [LocalVariableAccess] access to local variable a
# 32| 1: [LocalVariableDeclAndInitExpr] IList<Int32> b = ...
# 32| 0: [LocalVariableAccess] access to local variable a
# 32| 1: [LocalVariableAccess] access to local variable b
# 32| 2: [LocalVariableAccess] access to local variable a
# 33| 1: [LocalVariableDeclAndInitExpr] Int32 next = ...
# 33| 0: [AddExpr] ... + ...
# 33| 0: [LocalVariableAccess] access to local variable b
# 33| 1: [IntLiteral] 1
# 33| 1: [LocalVariableAccess] access to local variable next
# 33| 2: [AddExpr] ... + ...
# 33| 0: [LocalVariableAccess] access to local variable b
# 33| 1: [IntLiteral] 1
# 34| 1: [MulExpr] ... * ...
# 34| 0: [LocalVariableAccess] access to local variable next
# 34| 1: [IntLiteral] 2
# 35| 1: [LocalVariableAccess] access to local variable b
# 35| 2: [LocalVariableAccess] access to local variable next
# 30| 1: [LocalVariableAccess] access to local variable list6
# 37| 6: [LocalVariableDeclStmt] ... ...;
# 37| 0: [LocalVariableDeclAndInitExpr] B list7 = ...
# 37| 0: [ObjectCreation] object creation of type B
# 37| 1: [LocalVariableAccess] access to local variable list7
# 39| 7: [LocalVariableDeclStmt] ... ...;
# 39| 0: [LocalVariableDeclAndInitExpr] IEnumerable<Object> list8 = ...
# 41| 0: [MethodCall] call to method Select
# 40| 0: [LocalVariableDeclAndInitExpr] Object a = ...
# 40| 0: [LocalVariableAccess] access to local variable list7
# 40| 1: [LocalVariableAccess] access to local variable a
# 41| 1: [LocalVariableAccess] access to local variable a
# 39| 1: [LocalVariableAccess] access to local variable list8
# 43| 8: [LocalVariableDeclStmt] ... ...;
# 43| 0: [LocalVariableDeclAndInitExpr] C list9 = ...
# 43| 0: [ObjectCreation] object creation of type C
# 43| 1: [LocalVariableAccess] access to local variable list9
# 45| 9: [LocalVariableDeclStmt] ... ...;
# 45| 0: [LocalVariableDeclAndInitExpr] IEnumerable<Int32> list10 = ...
# 47| 0: [MethodCall] call to method Select
# 46| 0: [LocalVariableDeclAndInitExpr] Int32 a = ...
# 46| 0: [LocalVariableAccess] access to local variable list9
# 46| 1: [LocalVariableAccess] access to local variable a
# 47| 1: [LocalVariableAccess] access to local variable a
# 45| 1: [LocalVariableAccess] access to local variable list10
# 49| 10: [LocalVariableDeclStmt] ... ...;
# 49| 0: [LocalVariableDeclAndInitExpr] IEnumerable<String> list11 = ...
# 51| 0: [MethodCall] call to method Select
# 50| 0: [LocalVariableDeclAndInitExpr] String a = ...
# 50| 0: [LocalVariableAccess] access to local variable list7
# 50| 1: [LocalVariableAccess] access to local variable a
# 51| 1: [LocalVariableAccess] access to local variable a
# 49| 1: [LocalVariableAccess] access to local variable list11
# 53| 11: [LocalVariableDeclStmt] ... ...;
# 53| 0: [LocalVariableDeclAndInitExpr] IEnumerable<(Int32,IEnumerable<IList<Int32>>)> list12 = ...
# 56| 0: [MethodCall] call to method
# 55| 0: [MethodCall] call to method GroupJoin
# 54| 0: [LocalVariableDeclAndInitExpr] Int32 a = ...
# 54| 0: [LocalVariableAccess] access to local variable list1
# 54| 1: [LocalVariableAccess] access to local variable a
# 55| 1: [LocalVariableDeclAndInitExpr] IList<IList<Int32>> c = ...
# 55| 0: [LocalVariableAccess] access to local variable list2
# 55| 1: [LocalVariableAccess] access to local variable c
# 55| 2: [LocalVariableAccess] access to local variable list2
# 55| 3: [LocalVariableAccess] access to local variable a
# 55| 4: [IndexerCall] access to indexer
# 55| -1: [LocalVariableAccess] access to local variable c
# 55| 0: [IntLiteral] 0
# 55| 5: [LocalVariableDeclAndInitExpr] IList<IList<Int32>> d = ...
# 55| 0: [LocalVariableAccess] access to local variable list2
# 55| 1: [LocalVariableAccess] access to local variable d
# 56| 1: [TupleExpr] (..., ...)
# 56| 0: [LocalVariableAccess] access to local variable a
# 56| 1: [LocalVariableAccess] access to local variable d
# 53| 1: [LocalVariableAccess] access to local variable list12
# 59| 6: [Class] A
#-----| 3: (Base types)
# 59| 1: [Interface] IEnumerable
# 61| 5: [Method] GetEnumerator
# 62| 4: [BlockStmt] {...}
# 63| 0: [ThrowStmt] throw ...;
# 63| 0: [ObjectCreation] object creation of type NotImplementedException
# 67| 7: [Class] B
#-----| 3: (Base types)
# 67| 0: [Class] A
# 69| 8: [Class] C
#-----| 3: (Base types)
# 69| 0: [Class] List<Int32>

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,184 @@
Members.cs:
# 1| [NamespaceDeclaration] namespace ... { ... }
# 3| 1: [DelegateType] EventHandler
#-----| 2: (Parameters)
# 3| 0: [Parameter] sender
# 3| 1: [Parameter] e
# 6| 2: [Class] Class
# 9| 5: [Class] NestedClass
# 12| 5: [Method] Method
#-----| 1: (Type parameters)
# 12| 0: [TypeParameter] T
#-----| 2: (Parameters)
# 12| 0: [Parameter] t
# 12| 4: [MethodCall] call to method ToString
# 12| -1: [ParameterAccess] access to parameter t
# 14| 6: [Indexer] Item
#-----| 1: (Parameters)
# 14| 0: [Parameter] i
# 14| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 14| 0: [Parameter] i
# 14| 4: [MethodCall] call to method ToString
# 14| -1: [ParameterAccess] access to parameter i
# 14| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 14| 0: [Parameter] i
# 14| 1: [Parameter] value
# 14| 4: [BlockStmt] {...}
# 16| 7: [Field] Field
# 18| 8: [IndexerProperty] Prop
# 18| 3: [Getter] get_Prop
# 18| 4: [Setter] set_Prop
#-----| 2: (Parameters)
# 18| 0: [Parameter] value
# 20| 9: [Event] Event
# 20| 3: [AddEventAccessor] add_Event
#-----| 2: (Parameters)
# 20| 0: [Parameter] value
# 20| 3: [RemoveEventAccessor] remove_Event
#-----| 2: (Parameters)
# 20| 0: [Parameter] value
# 24| 6: [Method] Method
# 24| 4: [BlockStmt] {...}
# 26| 7: [Indexer] Item
#-----| 1: (Parameters)
# 26| 0: [Parameter] i
# 26| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 26| 0: [Parameter] i
# 26| 4: [MethodCall] call to method ToString
# 26| -1: [ParameterAccess] access to parameter i
# 26| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 26| 0: [Parameter] i
# 26| 1: [Parameter] value
# 26| 4: [BlockStmt] {...}
# 28| 8: [Field] Field
# 30| 9: [IndexerProperty] Prop
# 30| 3: [Getter] get_Prop
# 30| 4: [Setter] set_Prop
#-----| 2: (Parameters)
# 30| 0: [Parameter] value
# 32| 10: [Event] Event
# 32| 3: [AddEventAccessor] add_Event
#-----| 2: (Parameters)
# 32| 0: [Parameter] value
# 32| 3: [RemoveEventAccessor] remove_Event
#-----| 2: (Parameters)
# 32| 0: [Parameter] value
# 35| 3: [Class] Class2
# 37| 5: [Class] NestedClass2
# 39| 5: [Method] Method
#-----| 1: (Type parameters)
# 39| 0: [TypeParameter] T
#-----| 2: (Parameters)
# 39| 0: [Parameter] t
# 39| 4: [MethodCall] call to method ToString
# 39| -1: [ParameterAccess] access to parameter t
# 40| 6: [Indexer] Item
#-----| 1: (Parameters)
# 40| 0: [Parameter] i
# 40| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 40| 0: [Parameter] i
# 40| 4: [MethodCall] call to method ToString
# 40| -1: [ParameterAccess] access to parameter i
# 40| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 40| 0: [Parameter] i
# 40| 1: [Parameter] value
# 40| 4: [BlockStmt] {...}
# 41| 7: [Field] Field
# 42| 8: [IndexerProperty] Prop
# 42| 3: [Getter] get_Prop
# 42| 4: [Setter] set_Prop
#-----| 2: (Parameters)
# 42| 0: [Parameter] value
# 43| 9: [Event] Event
# 43| 3: [AddEventAccessor] add_Event
#-----| 2: (Parameters)
# 43| 0: [Parameter] value
# 43| 3: [RemoveEventAccessor] remove_Event
#-----| 2: (Parameters)
# 43| 0: [Parameter] value
# 46| 6: [Method] Method
# 46| 4: [BlockStmt] {...}
# 47| 7: [Indexer] Item
#-----| 1: (Parameters)
# 47| 0: [Parameter] i
# 47| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 47| 0: [Parameter] i
# 47| 4: [MethodCall] call to method ToString
# 47| -1: [ParameterAccess] access to parameter i
# 47| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 47| 0: [Parameter] i
# 47| 1: [Parameter] value
# 47| 4: [BlockStmt] {...}
# 48| 8: [Field] Field
# 49| 9: [IndexerProperty] Prop
# 49| 3: [Getter] get_Prop
# 49| 4: [Setter] set_Prop
#-----| 2: (Parameters)
# 49| 0: [Parameter] value
# 50| 10: [Event] Event
# 50| 3: [AddEventAccessor] add_Event
#-----| 2: (Parameters)
# 50| 0: [Parameter] value
# 50| 3: [RemoveEventAccessor] remove_Event
#-----| 2: (Parameters)
# 50| 0: [Parameter] value
# 54| 4: [Interface] Interface
# 56| 4: [Method] Method
# 57| 5: [Indexer] Item
#-----| 1: (Parameters)
# 57| 0: [Parameter] i
# 57| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 57| 0: [Parameter] i
# 57| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 57| 0: [Parameter] i
# 57| 1: [Parameter] value
# 58| 6: [IndexerProperty] Prop
# 58| 3: [Getter] get_Prop
# 58| 4: [Setter] set_Prop
#-----| 2: (Parameters)
# 58| 0: [Parameter] value
# 59| 7: [Event] Event
# 59| 3: [AddEventAccessor] add_Event
#-----| 2: (Parameters)
# 59| 0: [Parameter] value
# 59| 3: [RemoveEventAccessor] remove_Event
#-----| 2: (Parameters)
# 59| 0: [Parameter] value
# 62| 5: [Interface] Interface2
# 64| 4: [Method] Method
# 65| 5: [Indexer] Item
#-----| 1: (Parameters)
# 65| 0: [Parameter] i
# 65| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 65| 0: [Parameter] i
# 65| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 65| 0: [Parameter] i
# 65| 1: [Parameter] value
# 66| 6: [IndexerProperty] Prop
# 66| 3: [Getter] get_Prop
# 66| 4: [Setter] set_Prop
#-----| 2: (Parameters)
# 66| 0: [Parameter] value
# 67| 7: [Event] Event
# 67| 3: [AddEventAccessor] add_Event
#-----| 2: (Parameters)
# 67| 0: [Parameter] value
# 67| 3: [RemoveEventAccessor] remove_Event
#-----| 2: (Parameters)
# 67| 0: [Parameter] value
# 71| 6: [Enum] Enum
# 73| 7: [Enum] Enum2
# 76| 8: [Struct] Struct
# 78| 9: [Struct] Struct2

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,367 @@
methods.cs:
# 3| [NamespaceDeclaration] namespace ... { ... }
# 6| 1: [Class] TestRef
# 9| 5: [Method] Swap
#-----| 2: (Parameters)
# 9| 0: [Parameter] x
# 9| 1: [Parameter] y
# 10| 4: [BlockStmt] {...}
# 11| 0: [LocalVariableDeclStmt] ... ...;
# 11| 0: [LocalVariableDeclAndInitExpr] Int32 temp = ...
# 11| 0: [ParameterAccess] access to parameter x
# 11| 1: [LocalVariableAccess] access to local variable temp
# 12| 1: [ExprStmt] ...;
# 12| 0: [AssignExpr] ... = ...
# 12| 0: [ParameterAccess] access to parameter y
# 12| 1: [ParameterAccess] access to parameter x
# 13| 2: [ExprStmt] ...;
# 13| 0: [AssignExpr] ... = ...
# 13| 0: [LocalVariableAccess] access to local variable temp
# 13| 1: [ParameterAccess] access to parameter y
# 16| 6: [Method] Main
# 17| 4: [BlockStmt] {...}
# 18| 0: [LocalVariableDeclStmt] ... ...;
# 18| 0: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 18| 0: [IntLiteral] 1
# 18| 1: [LocalVariableAccess] access to local variable i
# 18| 1: [LocalVariableDeclAndInitExpr] Int32 j = ...
# 18| 0: [IntLiteral] 2
# 18| 1: [LocalVariableAccess] access to local variable j
# 19| 1: [ExprStmt] ...;
# 19| 0: [MethodCall] call to method Swap
# 19| 0: [LocalVariableAccess] access to local variable i
# 19| 1: [LocalVariableAccess] access to local variable j
# 20| 2: [ExprStmt] ...;
# 20| 0: [MethodCall] call to method WriteLine
# 20| -1: [TypeAccess] access to type Console
# 20| 0: [StringLiteral] "{0} {1}"
# 20| 1: [CastExpr] (...) ...
# 20| 0: [LocalVariableAccess] access to local variable i
# 20| 2: [CastExpr] (...) ...
# 20| 0: [LocalVariableAccess] access to local variable j
# 21| 3: [ExprStmt] ...;
# 21| 0: [MethodCall] call to method WriteLine
# 21| -1: [TypeAccess] access to type Console
# 21| 0: [StringLiteral] "{0} {1}"
# 21| 1: [CastExpr] (...) ...
# 21| 0: [LocalVariableAccess] access to local variable i
# 21| 2: [CastExpr] (...) ...
# 21| 0: [LocalVariableAccess] access to local variable j
# 25| 2: [Class] TestOut
# 28| 5: [Method] Divide
#-----| 2: (Parameters)
# 28| 0: [Parameter] x
# 28| 1: [Parameter] y
# 28| 2: [Parameter] result
# 28| 3: [Parameter] remainder
# 29| 4: [BlockStmt] {...}
# 30| 0: [ExprStmt] ...;
# 30| 0: [AssignExpr] ... = ...
# 30| 0: [DivExpr] ... / ...
# 30| 0: [ParameterAccess] access to parameter x
# 30| 1: [ParameterAccess] access to parameter y
# 30| 1: [ParameterAccess] access to parameter result
# 31| 1: [ExprStmt] ...;
# 31| 0: [AssignExpr] ... = ...
# 31| 0: [RemExpr] ... % ...
# 31| 0: [ParameterAccess] access to parameter x
# 31| 1: [ParameterAccess] access to parameter y
# 31| 1: [ParameterAccess] access to parameter remainder
# 34| 6: [Method] Main
# 35| 4: [BlockStmt] {...}
# 36| 0: [LocalVariableDeclStmt] ... ...;
# 36| 0: [LocalVariableDeclExpr] Int32 res
# 36| 1: [LocalVariableDeclExpr] Int32 rem
# 37| 1: [ExprStmt] ...;
# 37| 0: [MethodCall] call to method Divide
# 37| 0: [IntLiteral] 10
# 37| 1: [IntLiteral] 3
# 37| 2: [LocalVariableAccess] access to local variable res
# 37| 3: [LocalVariableAccess] access to local variable rem
# 38| 2: [ExprStmt] ...;
# 38| 0: [MethodCall] call to method WriteLine
# 38| -1: [TypeAccess] access to type Console
# 38| 0: [StringLiteral] "{0} {1}"
# 38| 1: [CastExpr] (...) ...
# 38| 0: [LocalVariableAccess] access to local variable res
# 38| 2: [CastExpr] (...) ...
# 38| 0: [LocalVariableAccess] access to local variable rem
# 42| 3: [Class] Console
# 45| 5: [Method] Write
#-----| 2: (Parameters)
# 45| 0: [Parameter] fmt
# 45| 1: [Parameter] args
# 45| 4: [BlockStmt] {...}
# 46| 6: [Method] WriteLine
#-----| 2: (Parameters)
# 46| 0: [Parameter] fmt
# 46| 1: [Parameter] args
# 46| 4: [BlockStmt] {...}
# 49| 4: [Class] TestOverloading
# 52| 5: [Method] F
# 53| 4: [BlockStmt] {...}
# 54| 0: [ExprStmt] ...;
# 54| 0: [MethodCall] call to method WriteLine
# 54| -1: [TypeAccess] access to type Console
# 54| 0: [StringLiteral] "F()"
# 57| 6: [Method] F
#-----| 2: (Parameters)
# 57| 0: [Parameter] x
# 58| 4: [BlockStmt] {...}
# 59| 0: [ExprStmt] ...;
# 59| 0: [MethodCall] call to method WriteLine
# 59| -1: [TypeAccess] access to type Console
# 59| 0: [StringLiteral] "F(object)"
# 62| 7: [Method] F
#-----| 2: (Parameters)
# 62| 0: [Parameter] x
# 63| 4: [BlockStmt] {...}
# 64| 0: [ExprStmt] ...;
# 64| 0: [MethodCall] call to method WriteLine
# 64| -1: [TypeAccess] access to type Console
# 64| 0: [StringLiteral] "F(int)"
# 67| 8: [Method] F
#-----| 2: (Parameters)
# 67| 0: [Parameter] x
# 68| 4: [BlockStmt] {...}
# 69| 0: [ExprStmt] ...;
# 69| 0: [MethodCall] call to method WriteLine
# 69| -1: [TypeAccess] access to type Console
# 69| 0: [StringLiteral] "F(double)"
# 72| 9: [Method] F
#-----| 1: (Type parameters)
# 72| 0: [TypeParameter] T
#-----| 2: (Parameters)
# 72| 0: [Parameter] x
# 73| 4: [BlockStmt] {...}
# 74| 0: [ExprStmt] ...;
# 74| 0: [MethodCall] call to method WriteLine
# 74| -1: [TypeAccess] access to type Console
# 74| 0: [StringLiteral] "F<T>(T)"
# 77| 12: [Method] F
#-----| 2: (Parameters)
# 77| 0: [Parameter] x
# 77| 1: [Parameter] y
# 78| 4: [BlockStmt] {...}
# 79| 0: [ExprStmt] ...;
# 79| 0: [MethodCall] call to method WriteLine
# 79| -1: [TypeAccess] access to type Console
# 79| 0: [StringLiteral] "F(double, double)"
# 82| 13: [Method] Main
# 83| 4: [BlockStmt] {...}
# 84| 0: [ExprStmt] ...;
# 84| 0: [MethodCall] call to method F
# 85| 1: [ExprStmt] ...;
# 85| 0: [MethodCall] call to method F
# 85| 0: [IntLiteral] 1
# 86| 2: [ExprStmt] ...;
# 86| 0: [MethodCall] call to method F
# 86| 0: [DoubleLiteral] 1
# 87| 3: [ExprStmt] ...;
# 87| 0: [MethodCall] call to method F
# 87| 0: [StringLiteral] "abc"
# 88| 4: [ExprStmt] ...;
# 88| 0: [MethodCall] call to method F
# 88| 0: [CastExpr] (...) ...
# 88| 0: [IntLiteral] 1
# 88| 1: [TypeAccess] access to type Double
# 89| 5: [ExprStmt] ...;
# 89| 0: [MethodCall] call to method F
# 89| 0: [CastExpr] (...) ...
# 89| 0: [IntLiteral] 1
# 89| 1: [TypeAccess] access to type Object
# 90| 6: [ExprStmt] ...;
# 90| 0: [MethodCall] call to method F
# 90| 0: [IntLiteral] 1
# 91| 7: [ExprStmt] ...;
# 91| 0: [MethodCall] call to method F
# 91| 0: [CastExpr] (...) ...
# 91| 0: [IntLiteral] 1
# 91| 1: [CastExpr] (...) ...
# 91| 0: [IntLiteral] 1
# 96| 5: [Class] Extensions
# 99| 4: [ExtensionMethod] ToInt32
#-----| 2: (Parameters)
# 99| 0: [Parameter] s
# 100| 4: [BlockStmt] {...}
# 101| 0: [ReturnStmt] return ...;
# 101| 0: [MethodCall] call to method Parse
# 101| -1: [TypeAccess] access to type Int32
# 101| 0: [ParameterAccess] access to parameter s
# 104| 5: [ExtensionMethod] ToBool
#-----| 2: (Parameters)
# 104| 0: [Parameter] s
# 104| 1: [Parameter] f
# 105| 4: [BlockStmt] {...}
# 106| 0: [ReturnStmt] return ...;
# 106| 0: [DelegateCall] delegate call
# 106| -1: [ParameterAccess] access to parameter f
# 106| 0: [ParameterAccess] access to parameter s
# 109| 6: [ExtensionMethod] Slice
#-----| 1: (Type parameters)
# 109| 0: [TypeParameter] T
#-----| 2: (Parameters)
# 109| 0: [Parameter] source
# 109| 1: [Parameter] index
# 109| 2: [Parameter] count
# 110| 4: [BlockStmt] {...}
# 111| 0: [IfStmt] if (...) ...
# 111| 0: [LogicalOrExpr] ... || ...
# 111| 0: [LogicalOrExpr] ... || ...
# 111| 0: [LTExpr] ... < ...
# 111| 0: [ParameterAccess] access to parameter index
# 111| 1: [IntLiteral] 0
# 111| 1: [LTExpr] ... < ...
# 111| 0: [ParameterAccess] access to parameter count
# 111| 1: [IntLiteral] 0
# 111| 1: [LTExpr] ... < ...
# 111| 0: [SubExpr] ... - ...
# 111| 0: [PropertyCall] access to property Length
# 111| -1: [ParameterAccess] access to parameter source
# 111| 1: [ParameterAccess] access to parameter index
# 111| 1: [ParameterAccess] access to parameter count
# 112| 1: [ThrowStmt] throw ...;
# 112| 0: [ObjectCreation] object creation of type ArgumentException
# 113| 1: [LocalVariableDeclStmt] ... ...;
# 113| 0: [LocalVariableDeclAndInitExpr] T[] result = ...
# 113| 0: [ArrayCreation] array creation of type T[]
# 113| 0: [ParameterAccess] access to parameter count
# 113| 1: [LocalVariableAccess] access to local variable result
# 114| 2: [ExprStmt] ...;
# 114| 0: [MethodCall] call to method Copy
# 114| -1: [TypeAccess] access to type Array
# 114| 0: [ParameterAccess] access to parameter source
# 114| 1: [ParameterAccess] access to parameter index
# 114| 2: [LocalVariableAccess] access to local variable result
# 114| 3: [IntLiteral] 0
# 114| 4: [ParameterAccess] access to parameter count
# 115| 3: [ReturnStmt] return ...;
# 115| 0: [LocalVariableAccess] access to local variable result
# 118| 8: [Method] CallToInt32
# 118| 4: [MethodCall] call to method ToInt32
# 118| 0: [StringLiteral] "0"
# 121| 6: [Class] TestExtensions
# 124| 4: [Method] Main
# 125| 4: [BlockStmt] {...}
# 126| 0: [LocalVariableDeclStmt] ... ...;
# 126| 0: [LocalVariableDeclAndInitExpr] String[] strings = ...
# 126| 0: [ArrayCreation] array creation of type String[]
# 126| -1: [ArrayInitializer] { ..., ... }
# 126| 0: [StringLiteral] "1"
# 126| 1: [StringLiteral] "22"
# 126| 2: [StringLiteral] "333"
# 126| 3: [StringLiteral] "4444"
# 126| 1: [LocalVariableAccess] access to local variable strings
# 127| 1: [ForeachStmt] foreach (... ... in ...) ...
# 127| 0: [LocalVariableDeclExpr] String s
# 127| 1: [MethodCall] call to method Slice
# 127| -1: [LocalVariableAccess] access to local variable strings
# 127| 0: [IntLiteral] 1
# 127| 1: [IntLiteral] 2
# 128| 2: [BlockStmt] {...}
# 129| 0: [ExprStmt] ...;
# 129| 0: [MethodCall] call to method WriteLine
# 129| -1: [TypeAccess] access to type Console
# 129| 0: [MethodCall] call to method ToInt32
# 129| -1: [LocalVariableAccess] access to local variable s
# 132| 2: [ExprStmt] ...;
# 132| 0: [MethodCall] call to method ToInt32
# 132| -1: [TypeAccess] access to type Extensions
# 132| 0: [StringLiteral] ""
# 134| 3: [ExprStmt] ...;
# 134| 0: [MethodCall] call to method ToBool
# 134| -1: [TypeAccess] access to type Extensions
# 134| 0: [StringLiteral] "true"
# 134| 1: [ImplicitDelegateCreation] delegate creation of type Func<String,Boolean>
# 134| 0: [MethodAccess] access to method Parse
# 134| -1: [TypeAccess] access to type Boolean
# 139| 7: [Class] TestDefaultParameters
# 141| 4: [Method] Method1
#-----| 2: (Parameters)
# 141| 0: [Parameter] x
# 141| 1: [Parameter] y
# 142| 4: [BlockStmt] {...}
# 145| 5: [Method] Method2
#-----| 2: (Parameters)
# 145| 0: [Parameter] a
# 145| 1: [Parameter] b
# 145| 2: [Parameter] c
# 145| 1: [IntLiteral] 1
# 145| 3: [Parameter] d
# 145| 1: [IntLiteral] 2
# 145| 4: [Parameter] e
# 145| 1: [AddExpr] ... + ...
# 145| 0: [StringLiteral] "a"
# 145| 1: [StringLiteral] "b"
# 146| 4: [BlockStmt] {...}
# 149| 6: [InstanceConstructor] TestDefaultParameters
#-----| 2: (Parameters)
# 149| 0: [Parameter] x
# 150| 4: [BlockStmt] {...}
# 153| 7: [InstanceConstructor] TestDefaultParameters
#-----| 2: (Parameters)
# 153| 0: [Parameter] x
# 153| 1: [StringLiteral] "abc"
# 153| 1: [Parameter] y
# 153| 1: [ObjectCreation] object creation of type Double
# 154| 4: [BlockStmt] {...}
# 157| 8: [DelegateType] Del
#-----| 2: (Parameters)
# 157| 0: [Parameter] a
# 157| 1: [Parameter] b
# 157| 1: [IntLiteral] 12
# 157| 2: [Parameter] c
# 157| 1: [ObjectCreation] object creation of type Double
# 159| 9: [Indexer] Item
#-----| 1: (Parameters)
# 159| 0: [Parameter] x
# 159| 1: [Parameter] y
# 159| 1: [IntLiteral] 0
# 161| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 159| 0: [Parameter] x
# 159| 1: [Parameter] y
# 159| 1: [IntLiteral] 0
# 161| 4: [BlockStmt] {...}
# 161| 0: [ReturnStmt] return ...;
# 161| 0: [AddExpr] ... + ...
# 161| 0: [ParameterAccess] access to parameter x
# 161| 1: [ParameterAccess] access to parameter y
# 162| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 159| 0: [Parameter] x
# 159| 1: [Parameter] y
# 159| 1: [IntLiteral] 0
# 162| 2: [Parameter] value
# 162| 4: [BlockStmt] {...}
# 166| 8: [Class] TestDefaultExtensionParameters
# 168| 4: [ExtensionMethod] Plus
#-----| 2: (Parameters)
# 168| 0: [Parameter] left
# 168| 1: [Parameter] right
# 168| 1: [IntLiteral] 0
# 169| 4: [BlockStmt] {...}
# 170| 0: [ReturnStmt] return ...;
# 170| 0: [AddExpr] ... + ...
# 170| 0: [ParameterAccess] access to parameter left
# 170| 1: [ParameterAccess] access to parameter right
# 173| 5: [ExtensionMethod] SkipTwo
#-----| 1: (Type parameters)
# 173| 0: [TypeParameter] T
#-----| 2: (Parameters)
# 173| 0: [Parameter] list
# 173| 1: [Parameter] i
# 173| 1: [IntLiteral] 1
# 174| 4: [BlockStmt] {...}
# 175| 0: [ReturnStmt] return ...;
# 175| 0: [ParameterAccess] access to parameter list
# 178| 7: [ExtensionMethod] SkipTwoInt
#-----| 2: (Parameters)
# 178| 0: [Parameter] list
# 178| 1: [Parameter] i
# 178| 1: [IntLiteral] 1
# 179| 4: [BlockStmt] {...}
# 180| 0: [ReturnStmt] return ...;
# 180| 0: [MethodCall] call to method SkipTwo
# 180| -1: [ParameterAccess] access to parameter list
# 180| 0: [ParameterAccess] access to parameter i

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,37 @@
namespaces.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 8| 1: [Class] A
# 9| 2: [Class] B
# 13| [NamespaceDeclaration] namespace ... { ... }
# 16| 1: [NamespaceDeclaration] namespace ... { ... }
# 19| 1: [Class] A
# 20| 2: [Class] B
# 26| [NamespaceDeclaration] namespace ... { ... }
# 29| 1: [Class] A
# 33| [NamespaceDeclaration] namespace ... { ... }
# 36| 1: [Class] B
# 38| 2: [Struct] S
# 40| 3: [Interface] I
# 44| [NamespaceDeclaration] namespace ... { ... }
# 50| [NamespaceDeclaration] namespace ... { ... }
# 53| 1: [Class] A
# 57| [NamespaceDeclaration] namespace ... { ... }
# 64| 1: [Class] B
#-----| 3: (Base types)
# 64| 0: [Class] A
# 66| 2: [Class] C
#-----| 3: (Base types)
# 66| 0: [Class] A
# 70| [NamespaceDeclaration] namespace ... { ... }
# 73| 1: [Class] A<>
#-----| 1: (Type parameters)
# 73| 0: [TypeParameter] T
# 76| 5: [Class] B
# 80| 2: [Class] A
# 84| [NamespaceDeclaration] namespace ... { ... }
# 91| [NamespaceDeclaration] namespace ... { ... }
# 94| 1: [Class] A
# 97| [NamespaceDeclaration] namespace ... { ... }
# 102| 1: [Class] B
#-----| 3: (Base types)
# 102| 0: [Class] A

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,77 @@
nestedtypes.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 8| 1: [Class] Base
# 11| 5: [Struct] S
# 13| 6: [Interface] I
# 15| 7: [DelegateType] MyDelegate
#-----| 2: (Parameters)
# 15| 0: [Parameter] s
# 17| 8: [Method] F
# 18| 4: [BlockStmt] {...}
# 19| 0: [ExprStmt] ...;
# 19| 0: [MethodCall] call to method WriteLine
# 19| -1: [TypeAccess] access to type Console
# 19| 0: [StringLiteral] "Base.F"
# 22| 9: [Class] C
# 26| 2: [Class] Derived
#-----| 3: (Base types)
# 26| 0: [Class] Base
# 29| 5: [Class] Nested
# 32| 5: [Method] G
# 33| 4: [BlockStmt] {...}
# 34| 0: [LocalVariableDeclStmt] ... ...;
# 34| 0: [LocalVariableDeclAndInitExpr] Derived d = ...
# 34| 0: [ObjectCreation] object creation of type Derived
# 34| 1: [LocalVariableAccess] access to local variable d
# 35| 1: [ExprStmt] ...;
# 35| 0: [MethodCall] call to method F
# 35| -1: [LocalVariableAccess] access to local variable d
# 42| 3: [Class] Test
# 45| 5: [Method] Main
# 46| 4: [BlockStmt] {...}
# 47| 0: [LocalVariableDeclStmt] ... ...;
# 47| 0: [LocalVariableDeclAndInitExpr] Nested n = ...
# 47| 0: [ObjectCreation] object creation of type Nested
# 47| 1: [LocalVariableAccess] access to local variable n
# 48| 1: [ExprStmt] ...;
# 48| 0: [MethodCall] call to method G
# 48| -1: [LocalVariableAccess] access to local variable n
# 53| 4: [Class] Outer<>
#-----| 1: (Type parameters)
# 53| 0: [TypeParameter] T
# 56| 5: [Class] Inner<>
#-----| 1: (Type parameters)
# 56| 0: [TypeParameter] U
# 59| 5: [Method] F
#-----| 2: (Parameters)
# 59| 0: [Parameter] t
# 59| 1: [Parameter] u
# 59| 4: [BlockStmt] {...}
# 63| 7: [Method] F
#-----| 2: (Parameters)
# 63| 0: [Parameter] t
# 64| 4: [BlockStmt] {...}
# 65| 0: [ExprStmt] ...;
# 65| 0: [MethodCall] call to method F
# 65| -1: [TypeAccess] access to type Inner<String>
# 65| -1: [TypeAccess] access to type Outer<>
# 65| 0: [ParameterAccess] access to parameter t
# 65| 1: [StringLiteral] "abc"
# 68| 1: [ExprStmt] ...;
# 68| 0: [MethodCall] call to method F
# 68| -1: [TypeAccess] access to type Inner<String>
# 68| -1: [TypeAccess] access to type Outer<Int32>
# 68| 0: [IntLiteral] 3
# 68| 1: [StringLiteral] "abc"
# 69| 2: [LocalVariableDeclStmt] ... ...;
# 69| 0: [LocalVariableDeclAndInitExpr] Type type = ...
# 69| 0: [TypeofExpr] typeof(...)
# 69| 0: [TypeAccess] access to type Inner<>
# 69| 1: [LocalVariableAccess] access to local variable type
# 74| 5: [Class] Outer2<>
#-----| 1: (Type parameters)
# 74| 0: [TypeParameter] T
# 77| 5: [Class] Inner2<>
#-----| 1: (Type parameters)
# 77| 0: [TypeParameter] T
# 80| 5: [Field] t

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,129 @@
operators.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 7| 1: [Class] IntVector
# 10| 4: [InstanceConstructor] IntVector
#-----| 2: (Parameters)
# 10| 0: [Parameter] length
# 10| 4: [BlockStmt] {...}
# 12| 5: [Property] Length
# 12| 3: [Getter] get_Length
# 12| 4: [BlockStmt] {...}
# 12| 0: [ReturnStmt] return ...;
# 12| 0: [IntLiteral] 4
# 14| 6: [Indexer] Item
#-----| 1: (Parameters)
# 14| 0: [Parameter] index
# 14| 3: [Getter] get_Item
#-----| 2: (Parameters)
# 14| 0: [Parameter] index
# 14| 4: [BlockStmt] {...}
# 14| 0: [ReturnStmt] return ...;
# 14| 0: [IntLiteral] 0
# 14| 4: [Setter] set_Item
#-----| 2: (Parameters)
# 14| 0: [Parameter] index
# 14| 1: [Parameter] value
# 14| 4: [BlockStmt] {...}
# 16| 7: [IncrementOperator] ++
#-----| 2: (Parameters)
# 16| 0: [Parameter] iv
# 17| 4: [BlockStmt] {...}
# 18| 0: [LocalVariableDeclStmt] ... ...;
# 18| 0: [LocalVariableDeclAndInitExpr] IntVector temp = ...
# 18| 0: [ObjectCreation] object creation of type IntVector
# 18| 0: [PropertyCall] access to property Length
# 18| -1: [ParameterAccess] access to parameter iv
# 18| 1: [LocalVariableAccess] access to local variable temp
# 19| 1: [ForStmt] for (...;...;...) ...
# 19| -1: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 19| 0: [IntLiteral] 0
# 19| 1: [LocalVariableAccess] access to local variable i
# 19| 0: [LTExpr] ... < ...
# 19| 0: [LocalVariableAccess] access to local variable i
# 19| 1: [PropertyCall] access to property Length
# 19| -1: [ParameterAccess] access to parameter iv
# 19| 1: [PostIncrExpr] ...++
# 19| 0: [LocalVariableAccess] access to local variable i
# 20| 2: [ExprStmt] ...;
# 20| 0: [AssignExpr] ... = ...
# 20| 0: [AddExpr] ... + ...
# 20| 0: [IndexerCall] access to indexer
# 20| -1: [ParameterAccess] access to parameter iv
# 20| 0: [LocalVariableAccess] access to local variable i
# 20| 1: [IntLiteral] 1
# 20| 1: [IndexerCall] access to indexer
# 20| -1: [LocalVariableAccess] access to local variable temp
# 20| 0: [LocalVariableAccess] access to local variable i
# 21| 2: [ReturnStmt] return ...;
# 21| 0: [LocalVariableAccess] access to local variable temp
# 26| 2: [Class] TestUnaryOperator
# 29| 5: [Method] Main
# 30| 4: [BlockStmt] {...}
# 31| 0: [LocalVariableDeclStmt] ... ...;
# 31| 0: [LocalVariableDeclAndInitExpr] IntVector iv1 = ...
# 31| 0: [ObjectCreation] object creation of type IntVector
# 31| 0: [IntLiteral] 4
# 31| 1: [LocalVariableAccess] access to local variable iv1
# 32| 1: [LocalVariableDeclStmt] ... ...;
# 32| 0: [LocalVariableDeclExpr] IntVector iv2
# 33| 2: [ExprStmt] ...;
# 33| 0: [AssignExpr] ... = ...
# 33| 0: [OperatorCall] call to operator ++
# 33| 0: [LocalVariableAccess] access to local variable iv1
# 33| 1: [LocalVariableAccess] access to local variable iv2
# 34| 3: [ExprStmt] ...;
# 34| 0: [AssignExpr] ... = ...
# 34| 0: [OperatorCall] call to operator ++
# 34| 0: [LocalVariableAccess] access to local variable iv1
# 34| 1: [LocalVariableAccess] access to local variable iv2
# 39| 3: [Struct] Digit
# 42| 5: [Field] value
# 44| 6: [InstanceConstructor] Digit
#-----| 2: (Parameters)
# 44| 0: [Parameter] value
# 45| 4: [BlockStmt] {...}
# 46| 0: [IfStmt] if (...) ...
# 46| 0: [LogicalOrExpr] ... || ...
# 46| 0: [LTExpr] ... < ...
# 46| 0: [CastExpr] (...) ...
# 46| 0: [ParameterAccess] access to parameter value
# 46| 1: [IntLiteral] 0
# 46| 1: [GTExpr] ... > ...
# 46| 0: [CastExpr] (...) ...
# 46| 0: [ParameterAccess] access to parameter value
# 46| 1: [IntLiteral] 9
# 47| 1: [ThrowStmt] throw ...;
# 47| 0: [ObjectCreation] object creation of type ArgumentException
# 48| 1: [ExprStmt] ...;
# 48| 0: [AssignExpr] ... = ...
# 48| 0: [ParameterAccess] access to parameter value
# 48| 1: [FieldAccess] access to field value
# 48| -1: [ThisAccess] this access
# 51| 7: [ImplicitConversionOperator] implicit conversion
#-----| 2: (Parameters)
# 51| 0: [Parameter] d
# 52| 4: [BlockStmt] {...}
# 53| 0: [ReturnStmt] return ...;
# 53| 0: [FieldAccess] access to field value
# 53| -1: [ParameterAccess] access to parameter d
# 56| 8: [ExplicitConversionOperator] explicit conversion
#-----| 2: (Parameters)
# 56| 0: [Parameter] b
# 57| 4: [BlockStmt] {...}
# 58| 0: [ReturnStmt] return ...;
# 58| 0: [ObjectCreation] object creation of type Digit
# 58| 0: [ParameterAccess] access to parameter b
# 63| 4: [Class] TestConversionOperator
# 66| 5: [Method] Main
# 67| 4: [BlockStmt] {...}
# 68| 0: [LocalVariableDeclStmt] ... ...;
# 68| 0: [LocalVariableDeclAndInitExpr] Digit d = ...
# 68| 0: [OperatorCall] call to operator explicit conversion
# 68| 0: [CastExpr] (...) ...
# 68| 0: [IntLiteral] 8
# 68| 1: [LocalVariableAccess] access to local variable d
# 69| 1: [LocalVariableDeclStmt] ... ...;
# 69| 0: [LocalVariableDeclAndInitExpr] Byte b = ...
# 69| 0: [OperatorCall] call to operator implicit conversion
# 69| 0: [LocalVariableAccess] access to local variable d
# 69| 1: [LocalVariableAccess] access to local variable b

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,16 @@
Partial.cs:
# 1| [Class] TwoPartClass
# 3| 5: [Method] PartialMethodWithBody1
# 10| 4: [BlockStmt] {...}
# 4| 6: [Method] PartialMethodWithoutBody1
# 5| 7: [Method] Method2
# 5| 4: [BlockStmt] {...}
# 11| 8: [Method] Method3
# 11| 4: [BlockStmt] {...}
# 14| [Class] OnePartPartialClass
# 16| 5: [Method] PartialMethodWithoutBody2
# 17| 6: [Method] Method4
# 17| 4: [BlockStmt] {...}
# 20| [Class] NonPartialClass
# 22| 5: [Method] Method5
# 22| 4: [BlockStmt] {...}

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,194 @@
properties.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 7| 1: [Class] Button
# 10| 5: [Field] caption
# 12| 6: [IndexerProperty] Caption
# 15| 3: [Getter] get_Caption
# 15| 4: [BlockStmt] {...}
# 15| 0: [ReturnStmt] return ...;
# 15| 0: [FieldAccess] access to field caption
# 17| 4: [Setter] set_Caption
#-----| 2: (Parameters)
# 17| 0: [Parameter] value
# 18| 4: [BlockStmt] {...}
# 19| 0: [IfStmt] if (...) ...
# 19| 0: [NEExpr] ... != ...
# 19| 0: [FieldAccess] access to field caption
# 19| 1: [ParameterAccess] access to parameter value
# 20| 1: [BlockStmt] {...}
# 21| 0: [ExprStmt] ...;
# 21| 0: [AssignExpr] ... = ...
# 21| 0: [ParameterAccess] access to parameter value
# 21| 1: [FieldAccess] access to field caption
# 26| 7: [Method] Paint
# 27| 4: [BlockStmt] {...}
# 28| 0: [LocalVariableDeclStmt] ... ...;
# 28| 0: [LocalVariableDeclAndInitExpr] Button okButton = ...
# 28| 0: [ObjectCreation] object creation of type Button
# 28| 1: [LocalVariableAccess] access to local variable okButton
# 29| 1: [ExprStmt] ...;
# 29| 0: [AssignExpr] ... = ...
# 29| 0: [StringLiteral] "OK"
# 29| 1: [PropertyCall] access to property Caption
# 29| -1: [LocalVariableAccess] access to local variable okButton
# 30| 2: [LocalVariableDeclStmt] ... ...;
# 30| 0: [LocalVariableDeclAndInitExpr] String s = ...
# 30| 0: [PropertyCall] access to property Caption
# 30| -1: [LocalVariableAccess] access to local variable okButton
# 30| 1: [LocalVariableAccess] access to local variable s
# 34| 2: [Class] Counter
# 37| 5: [Field] next
# 39| 6: [Property] Next
# 41| 3: [Getter] get_Next
# 41| 4: [BlockStmt] {...}
# 41| 0: [ReturnStmt] return ...;
# 41| 0: [PostIncrExpr] ...++
# 41| 0: [FieldAccess] access to field next
# 46| 3: [Class] Point
# 49| 5: [Property] X
# 49| 3: [Getter] get_X
# 49| 4: [Setter] set_X
#-----| 2: (Parameters)
# 49| 0: [Parameter] value
# 50| 6: [Property] Y
# 50| 3: [Getter] get_Y
# 50| 4: [Setter] set_Y
#-----| 2: (Parameters)
# 50| 0: [Parameter] value
# 54| 4: [Class] ReadOnlyPoint
# 57| 4: [Property] X
# 57| 3: [Getter] get_X
# 57| 4: [Setter] set_X
#-----| 2: (Parameters)
# 57| 0: [Parameter] value
# 58| 5: [Property] Y
# 58| 3: [Getter] get_Y
# 58| 4: [Setter] set_Y
#-----| 2: (Parameters)
# 58| 0: [Parameter] value
# 59| 6: [InstanceConstructor] ReadOnlyPoint
#-----| 2: (Parameters)
# 59| 0: [Parameter] x
# 59| 1: [Parameter] y
# 60| 4: [BlockStmt] {...}
# 61| 0: [ExprStmt] ...;
# 61| 0: [AssignExpr] ... = ...
# 61| 0: [ParameterAccess] access to parameter x
# 61| 1: [PropertyCall] access to property X
# 62| 1: [ExprStmt] ...;
# 62| 0: [AssignExpr] ... = ...
# 62| 0: [ParameterAccess] access to parameter y
# 62| 1: [PropertyCall] access to property Y
# 67| 5: [Class] A
# 69| 5: [Field] y
# 70| 6: [Property] X
# 70| 3: [Getter] get_X
# 70| 4: [BlockStmt] {...}
# 70| 0: [ReturnStmt] return ...;
# 70| 0: [IntLiteral] 0
# 71| 7: [Property] Y
# 73| 3: [Getter] get_Y
# 73| 4: [BlockStmt] {...}
# 73| 0: [ReturnStmt] return ...;
# 73| 0: [FieldAccess] access to field y
# 74| 4: [Setter] set_Y
#-----| 2: (Parameters)
# 74| 0: [Parameter] value
# 74| 4: [BlockStmt] {...}
# 74| 0: [ExprStmt] ...;
# 74| 0: [AssignExpr] ... = ...
# 74| 0: [ParameterAccess] access to parameter value
# 74| 1: [FieldAccess] access to field y
# 76| 8: [Property] Z
# 76| 3: [Getter] get_Z
# 76| 4: [Setter] set_Z
#-----| 2: (Parameters)
# 76| 0: [Parameter] value
# 79| 6: [Class] B
#-----| 3: (Base types)
# 79| 0: [Class] A
# 81| 5: [Field] z
# 82| 6: [Property] X
# 82| 3: [Getter] get_X
# 82| 4: [BlockStmt] {...}
# 82| 0: [ReturnStmt] return ...;
# 82| 0: [AddExpr] ... + ...
# 82| 0: [PropertyCall] access to property X
# 82| -1: [BaseAccess] base access
# 82| 1: [IntLiteral] 1
# 83| 7: [Property] Y
# 83| 3: [Setter] set_Y
#-----| 2: (Parameters)
# 83| 0: [Parameter] value
# 83| 4: [BlockStmt] {...}
# 83| 0: [ExprStmt] ...;
# 83| 0: [AssignExpr] ... = ...
# 83| 0: [ConditionalExpr] ... ? ... : ...
# 83| 0: [LTExpr] ... < ...
# 83| 0: [ParameterAccess] access to parameter value
# 83| 1: [IntLiteral] 0
# 83| 1: [IntLiteral] 0
# 83| 2: [ParameterAccess] access to parameter value
# 83| 1: [PropertyCall] access to property Y
# 83| -1: [BaseAccess] base access
# 84| 8: [Property] Z
# 86| 3: [Getter] get_Z
# 86| 4: [BlockStmt] {...}
# 86| 0: [ReturnStmt] return ...;
# 86| 0: [FieldAccess] access to field z
# 87| 4: [Setter] set_Z
#-----| 2: (Parameters)
# 87| 0: [Parameter] value
# 87| 4: [BlockStmt] {...}
# 87| 0: [ExprStmt] ...;
# 87| 0: [AssignExpr] ... = ...
# 87| 0: [ParameterAccess] access to parameter value
# 87| 1: [FieldAccess] access to field z
# 91| 7: [Class] Test
# 93| 5: [Property] Init
# 93| 3: [Setter] set_Init
#-----| 2: (Parameters)
# 93| 0: [Parameter] value
# 93| 4: [BlockStmt] {...}
# 94| 6: [Method] Main
# 95| 4: [BlockStmt] {...}
# 96| 0: [LocalVariableDeclStmt] ... ...;
# 96| 0: [LocalVariableDeclAndInitExpr] List<Double> ds = ...
# 96| 0: [ObjectCreation] object creation of type List<Double>
# 96| 1: [LocalVariableAccess] access to local variable ds
# 97| 1: [LocalVariableDeclStmt] ... ...;
# 97| 0: [LocalVariableDeclAndInitExpr] List<Object> os = ...
# 97| 0: [ObjectCreation] object creation of type List<Object>
# 97| 1: [LocalVariableAccess] access to local variable os
# 98| 2: [IfStmt] if (...) ...
# 98| 0: [EQExpr] ... == ...
# 98| 0: [PropertyCall] access to property Count
# 98| -1: [LocalVariableAccess] access to local variable ds
# 98| 1: [PropertyCall] access to property Count
# 98| -1: [LocalVariableAccess] access to local variable os
# 99| 1: [BlockStmt] {...}
# 104| 8: [Interface] InterfaceWithProperties
# 106| 4: [Property] Prop1
# 106| 3: [Getter] get_Prop1
# 107| 5: [Property] Prop2
# 107| 3: [Setter] set_Prop2
#-----| 2: (Parameters)
# 107| 0: [Parameter] value
# 110| 9: [Class] ImplementsProperties
#-----| 3: (Base types)
# 110| 1: [Interface] InterfaceWithProperties
# 112| 5: [Property] Prop1
# 114| 3: [Getter] get_Prop1
# 114| 4: [BlockStmt] {...}
# 114| 0: [ReturnStmt] return ...;
# 114| 0: [IntLiteral] 0
# 117| 6: [Property] Prop2
# 119| 3: [Setter] set_Prop2
#-----| 2: (Parameters)
# 119| 0: [Parameter] value
# 119| 4: [BlockStmt] {...}
# 122| 7: [Property] Prop2
# 124| 3: [Setter] set_Prop2
#-----| 2: (Parameters)
# 124| 0: [Parameter] value
# 124| 4: [BlockStmt] {...}

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,579 @@
fixed.cs:
# 3| [Class] Fixed
# 5| 5: [Method] fixed1
# 6| 4: [BlockStmt] {...}
# 7| 0: [LocalVariableDeclStmt] ... ...;
# 7| 0: [LocalVariableDeclAndInitExpr] Byte[] buffer = ...
# 7| 0: [ArrayCreation] array creation of type Byte[]
# 7| 0: [IntLiteral] 10
# 7| 1: [LocalVariableAccess] access to local variable buffer
# 9| 1: [FixedStmt] fixed(...) { ... }
# 9| -1: [LocalVariableDeclAndInitExpr] Byte* pinned_buffer = ...
# 9| 0: [AddressOfExpr] &...
# 9| 0: [ArrayAccess] access to array element
# 9| -1: [LocalVariableAccess] access to local variable buffer
# 9| 0: [IntLiteral] 0
# 9| 1: [LocalVariableAccess] access to local variable pinned_buffer
# 10| 0: [BlockStmt] {...}
# 11| 0: [LocalVariableDeclStmt] ... ...;
# 11| 0: [LocalVariableDeclAndInitExpr] Byte* t = ...
# 11| 0: [LocalVariableAccess] access to local variable pinned_buffer
# 11| 1: [LocalVariableAccess] access to local variable t
# 12| 1: [ExprStmt] ...;
# 12| 0: [MethodCall] call to method fixed1
# 15| 2: [FixedStmt] fixed(...) { ... }
# 15| -1: [LocalVariableDeclAndInitExpr] Byte* pinned_buffer = ...
# 15| 0: [AddressOfExpr] &...
# 15| 0: [ArrayAccess] access to array element
# 15| -1: [LocalVariableAccess] access to local variable buffer
# 15| 0: [IntLiteral] 0
# 15| 1: [LocalVariableAccess] access to local variable pinned_buffer
# 16| 0: [BlockStmt] {...}
# 19| 3: [FixedStmt] fixed(...) { ... }
# 19| -1: [LocalVariableDeclAndInitExpr] Byte* pinned_buffer = ...
# 19| 0: [AddressOfExpr] &...
# 19| 0: [ArrayAccess] access to array element
# 19| -1: [LocalVariableAccess] access to local variable buffer
# 19| 0: [IntLiteral] 0
# 19| 1: [LocalVariableAccess] access to local variable pinned_buffer
# 19| 0: [EmptyStmt] ;
statements.cs:
# 5| [NamespaceDeclaration] namespace ... { ... }
# 7| 1: [Class] Class
# 10| 5: [Method] Main
# 11| 4: [BlockStmt] {...}
# 12| 0: [LabelStmt] block:
# 13| 1: [BlockStmt] {...}
# 14| 0: [BlockStmt] {...}
# 16| 1: [BlockStmt] {...}
# 17| 0: [BlockStmt] {...}
# 23| 6: [Method] MainEmpty
# 24| 4: [BlockStmt] {...}
# 25| 0: [LocalVariableDeclStmt] ... ...;
# 25| 0: [LocalVariableDeclAndInitExpr] Class c = ...
# 25| 0: [ObjectCreation] object creation of type Class
# 25| 1: [LocalVariableAccess] access to local variable c
# 26| 1: [EmptyStmt] ;
# 26| 2: [EmptyStmt] ;
# 26| 3: [EmptyStmt] ;
# 27| 4: [IfStmt] if (...) ...
# 27| 0: [BoolLiteral] true
# 27| 1: [EmptyStmt] ;
# 30| 7: [Method] MainLocalVarDecl
# 31| 4: [BlockStmt] {...}
# 32| 0: [LocalVariableDeclStmt] ... ...;
# 32| 0: [LocalVariableDeclExpr] Int32 a
# 33| 1: [LocalVariableDeclStmt] ... ...;
# 33| 0: [LocalVariableDeclAndInitExpr] Int32 b = ...
# 33| 0: [IntLiteral] 2
# 33| 1: [LocalVariableAccess] access to local variable b
# 33| 1: [LocalVariableDeclAndInitExpr] Int32 c = ...
# 33| 0: [IntLiteral] 3
# 33| 1: [LocalVariableAccess] access to local variable c
# 34| 2: [ExprStmt] ...;
# 34| 0: [AssignExpr] ... = ...
# 34| 0: [IntLiteral] 1
# 34| 1: [LocalVariableAccess] access to local variable a
# 35| 3: [ExprStmt] ...;
# 35| 0: [MethodCall] call to method WriteLine
# 35| -1: [TypeAccess] access to type Console
# 35| 0: [AddExpr] ... + ...
# 35| 0: [AddExpr] ... + ...
# 35| 0: [LocalVariableAccess] access to local variable a
# 35| 1: [LocalVariableAccess] access to local variable b
# 35| 1: [LocalVariableAccess] access to local variable c
# 36| 4: [LocalVariableDeclStmt] ... ...;
# 36| 0: [LocalVariableDeclAndInitExpr] Int32 x = ...
# 36| 0: [IntLiteral] 45
# 36| 1: [LocalVariableAccess] access to local variable x
# 37| 5: [LocalVariableDeclStmt] ... ...;
# 37| 0: [LocalVariableDeclAndInitExpr] String y = ...
# 37| 0: [StringLiteral] "test"
# 37| 1: [LocalVariableAccess] access to local variable y
# 40| 8: [Method] MainLocalConstDecl
# 41| 4: [BlockStmt] {...}
# 42| 0: [LocalConstantDeclStmt] const ... ...;
# 42| 0: [LocalVariableDeclAndInitExpr] Single pi = ...
# 42| 0: [FloatLiteral] 3.1415927
# 42| 1: [LocalVariableAccess] access to local variable pi
# 43| 1: [LocalConstantDeclStmt] const ... ...;
# 43| 0: [LocalVariableDeclAndInitExpr] Int32 r = ...
# 43| 0: [AddExpr] ... + ...
# 43| 0: [IntLiteral] 5
# 43| 1: [IntLiteral] 20
# 43| 1: [LocalVariableAccess] access to local variable r
# 44| 2: [ExprStmt] ...;
# 44| 0: [MethodCall] call to method WriteLine
# 44| -1: [TypeAccess] access to type Console
# 44| 0: [MulExpr] ... * ...
# 44| 0: [MulExpr] ... * ...
# 44| 0: [LocalVariableAccess] access to local variable pi
# 44| 1: [CastExpr] (...) ...
# 44| 0: [LocalVariableAccess] access to local variable r
# 44| 1: [CastExpr] (...) ...
# 44| 0: [LocalVariableAccess] access to local variable r
# 47| 9: [Method] MainExpr
# 48| 4: [BlockStmt] {...}
# 49| 0: [LocalVariableDeclStmt] ... ...;
# 49| 0: [LocalVariableDeclExpr] Int32 i
# 50| 1: [ExprStmt] ...;
# 50| 0: [AssignExpr] ... = ...
# 50| 0: [IntLiteral] 123
# 50| 1: [LocalVariableAccess] access to local variable i
# 51| 2: [ExprStmt] ...;
# 51| 0: [MethodCall] call to method WriteLine
# 51| -1: [TypeAccess] access to type Console
# 51| 0: [LocalVariableAccess] access to local variable i
# 52| 3: [ExprStmt] ...;
# 52| 0: [PostIncrExpr] ...++
# 52| 0: [LocalVariableAccess] access to local variable i
# 53| 4: [ExprStmt] ...;
# 53| 0: [MethodCall] call to method WriteLine
# 53| -1: [TypeAccess] access to type Console
# 53| 0: [LocalVariableAccess] access to local variable i
# 56| 10: [Method] MainIf
#-----| 2: (Parameters)
# 56| 0: [Parameter] args
# 57| 4: [BlockStmt] {...}
# 58| 0: [IfStmt] if (...) ...
# 58| 0: [EQExpr] ... == ...
# 58| 0: [PropertyCall] access to property Length
# 58| -1: [ParameterAccess] access to parameter args
# 58| 1: [IntLiteral] 0
# 59| 1: [BlockStmt] {...}
# 60| 0: [ExprStmt] ...;
# 60| 0: [MethodCall] call to method WriteLine
# 60| -1: [TypeAccess] access to type Console
# 60| 0: [StringLiteral] "No arguments"
# 63| 2: [BlockStmt] {...}
# 64| 0: [ExprStmt] ...;
# 64| 0: [MethodCall] call to method WriteLine
# 64| -1: [TypeAccess] access to type Console
# 64| 0: [StringLiteral] "One or more arguments"
# 69| 11: [Method] MainSwitch
#-----| 2: (Parameters)
# 69| 0: [Parameter] args
# 70| 4: [BlockStmt] {...}
# 71| 0: [LocalVariableDeclStmt] ... ...;
# 71| 0: [LocalVariableDeclAndInitExpr] Int32 n = ...
# 71| 0: [PropertyCall] access to property Length
# 71| -1: [ParameterAccess] access to parameter args
# 71| 1: [LocalVariableAccess] access to local variable n
# 72| 1: [SwitchStmt] switch (...) {...}
# 72| 0: [LocalVariableAccess] access to local variable n
# 74| 0: [ConstCase] case ...:
# 74| 0: [ConstantPatternExpr,IntLiteral] 0
# 75| 1: [ExprStmt] ...;
# 75| 0: [MethodCall] call to method WriteLine
# 75| -1: [TypeAccess] access to type Console
# 75| 0: [StringLiteral] "No arguments"
# 76| 2: [BreakStmt] break;
# 77| 3: [ConstCase] case ...:
# 77| 0: [ConstantPatternExpr,IntLiteral] 1
# 78| 4: [ExprStmt] ...;
# 78| 0: [MethodCall] call to method WriteLine
# 78| -1: [TypeAccess] access to type Console
# 78| 0: [StringLiteral] "One argument"
# 79| 5: [BreakStmt] break;
# 80| 6: [DefaultCase] default:
# 81| 7: [ExprStmt] ...;
# 81| 0: [MethodCall] call to method WriteLine
# 81| -1: [TypeAccess] access to type Console
# 81| 0: [StringLiteral] "{0} arguments"
# 81| 1: [CastExpr] (...) ...
# 81| 0: [LocalVariableAccess] access to local variable n
# 82| 8: [BreakStmt] break;
# 86| 12: [Method] StringSwitch
#-----| 2: (Parameters)
# 86| 0: [Parameter] foo
# 87| 4: [BlockStmt] {...}
# 88| 0: [SwitchStmt] switch (...) {...}
# 88| 0: [ParameterAccess] access to parameter foo
# 90| 0: [ConstCase] case ...:
# 90| 0: [ConstantPatternExpr,StringLiteral] "black"
# 91| 1: [ReturnStmt] return ...;
# 91| 0: [IntLiteral] 0
# 92| 2: [ConstCase] case ...:
# 92| 0: [ConstantPatternExpr,StringLiteral] "red"
# 93| 3: [ReturnStmt] return ...;
# 93| 0: [IntLiteral] 1
# 94| 4: [ConstCase] case ...:
# 94| 0: [ConstantPatternExpr,StringLiteral] "green"
# 95| 5: [ReturnStmt] return ...;
# 95| 0: [IntLiteral] 2
# 96| 6: [ConstCase] case ...:
# 96| 0: [ConstantPatternExpr,StringLiteral] "yellow"
# 97| 7: [ReturnStmt] return ...;
# 97| 0: [IntLiteral] 3
# 98| 8: [ConstCase] case ...:
# 98| 0: [ConstantPatternExpr,StringLiteral] "blue"
# 99| 9: [ReturnStmt] return ...;
# 99| 0: [IntLiteral] 4
# 100| 10: [ConstCase] case ...:
# 100| 0: [ConstantPatternExpr,StringLiteral] "magenta"
# 101| 11: [ReturnStmt] return ...;
# 101| 0: [IntLiteral] 5
# 102| 12: [ConstCase] case ...:
# 102| 0: [ConstantPatternExpr,StringLiteral] "cyan"
# 103| 13: [ReturnStmt] return ...;
# 103| 0: [IntLiteral] 6
# 104| 14: [ConstCase] case ...:
# 104| 0: [ConstantPatternExpr,StringLiteral] "grey"
# 105| 15: [ConstCase] case ...:
# 105| 0: [ConstantPatternExpr,StringLiteral] "white"
# 106| 16: [ReturnStmt] return ...;
# 106| 0: [IntLiteral] 7
# 108| 1: [ReturnStmt] return ...;
# 108| 0: [IntLiteral] 7
# 111| 13: [Method] MainWhile
#-----| 2: (Parameters)
# 111| 0: [Parameter] args
# 112| 4: [BlockStmt] {...}
# 113| 0: [LocalVariableDeclStmt] ... ...;
# 113| 0: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 113| 0: [IntLiteral] 0
# 113| 1: [LocalVariableAccess] access to local variable i
# 114| 1: [WhileStmt] while (...) ...
# 114| 0: [LTExpr] ... < ...
# 114| 0: [LocalVariableAccess] access to local variable i
# 114| 1: [PropertyCall] access to property Length
# 114| -1: [ParameterAccess] access to parameter args
# 115| 1: [BlockStmt] {...}
# 116| 0: [ExprStmt] ...;
# 116| 0: [MethodCall] call to method WriteLine
# 116| -1: [TypeAccess] access to type Console
# 116| 0: [ArrayAccess] access to array element
# 116| -1: [ParameterAccess] access to parameter args
# 116| 0: [LocalVariableAccess] access to local variable i
# 117| 1: [ExprStmt] ...;
# 117| 0: [PostIncrExpr] ...++
# 117| 0: [LocalVariableAccess] access to local variable i
# 121| 14: [Method] MainDo
# 122| 4: [BlockStmt] {...}
# 123| 0: [LocalVariableDeclStmt] ... ...;
# 123| 0: [LocalVariableDeclExpr] String s
# 124| 1: [DoStmt] do ... while (...);
# 128| 0: [NEExpr] ... != ...
# 128| 0: [LocalVariableAccess] access to local variable s
# 128| 1: [NullLiteral] null
# 125| 1: [BlockStmt] {...}
# 126| 0: [ExprStmt] ...;
# 126| 0: [AssignExpr] ... = ...
# 126| 0: [MethodCall] call to method ReadLine
# 126| -1: [TypeAccess] access to type Console
# 126| 1: [LocalVariableAccess] access to local variable s
# 127| 1: [IfStmt] if (...) ...
# 127| 0: [NEExpr] ... != ...
# 127| 0: [LocalVariableAccess] access to local variable s
# 127| 1: [NullLiteral] null
# 127| 1: [ExprStmt] ...;
# 127| 0: [MethodCall] call to method WriteLine
# 127| -1: [TypeAccess] access to type Console
# 127| 0: [LocalVariableAccess] access to local variable s
# 131| 15: [Method] MainFor
#-----| 2: (Parameters)
# 131| 0: [Parameter] args
# 132| 4: [BlockStmt] {...}
# 133| 0: [ForStmt] for (...;...;...) ...
# 133| -1: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 133| 0: [IntLiteral] 0
# 133| 1: [LocalVariableAccess] access to local variable i
# 133| 0: [LTExpr] ... < ...
# 133| 0: [LocalVariableAccess] access to local variable i
# 133| 1: [PropertyCall] access to property Length
# 133| -1: [ParameterAccess] access to parameter args
# 133| 1: [PostIncrExpr] ...++
# 133| 0: [LocalVariableAccess] access to local variable i
# 134| 2: [BlockStmt] {...}
# 135| 0: [ExprStmt] ...;
# 135| 0: [MethodCall] call to method WriteLine
# 135| -1: [TypeAccess] access to type Console
# 135| 0: [ArrayAccess] access to array element
# 135| -1: [ParameterAccess] access to parameter args
# 135| 0: [LocalVariableAccess] access to local variable i
# 140| 16: [Method] MainForeach
#-----| 2: (Parameters)
# 140| 0: [Parameter] args
# 141| 4: [BlockStmt] {...}
# 142| 0: [ForeachStmt] foreach (... ... in ...) ...
# 142| 0: [LocalVariableDeclExpr] String s
# 142| 1: [ParameterAccess] access to parameter args
# 143| 2: [BlockStmt] {...}
# 144| 0: [ExprStmt] ...;
# 144| 0: [MethodCall] call to method WriteLine
# 144| -1: [TypeAccess] access to type Console
# 144| 0: [LocalVariableAccess] access to local variable s
# 148| 17: [Method] MainBreak
# 149| 4: [BlockStmt] {...}
# 150| 0: [WhileStmt] while (...) ...
# 150| 0: [BoolLiteral] true
# 151| 1: [BlockStmt] {...}
# 152| 0: [LocalVariableDeclStmt] ... ...;
# 152| 0: [LocalVariableDeclAndInitExpr] String s = ...
# 152| 0: [MethodCall] call to method ReadLine
# 152| -1: [TypeAccess] access to type Console
# 152| 1: [LocalVariableAccess] access to local variable s
# 153| 1: [IfStmt] if (...) ...
# 153| 0: [EQExpr] ... == ...
# 153| 0: [LocalVariableAccess] access to local variable s
# 153| 1: [NullLiteral] null
# 153| 1: [BreakStmt] break;
# 154| 2: [ExprStmt] ...;
# 154| 0: [MethodCall] call to method WriteLine
# 154| -1: [TypeAccess] access to type Console
# 154| 0: [LocalVariableAccess] access to local variable s
# 158| 18: [Method] MainContinue
#-----| 2: (Parameters)
# 158| 0: [Parameter] args
# 159| 4: [BlockStmt] {...}
# 160| 0: [ForStmt] for (...;...;...) ...
# 160| -1: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 160| 0: [IntLiteral] 0
# 160| 1: [LocalVariableAccess] access to local variable i
# 160| 0: [LTExpr] ... < ...
# 160| 0: [LocalVariableAccess] access to local variable i
# 160| 1: [PropertyCall] access to property Length
# 160| -1: [ParameterAccess] access to parameter args
# 160| 1: [PostIncrExpr] ...++
# 160| 0: [LocalVariableAccess] access to local variable i
# 161| 2: [BlockStmt] {...}
# 162| 0: [IfStmt] if (...) ...
# 162| 0: [MethodCall] call to method StartsWith
# 162| -1: [ArrayAccess] access to array element
# 162| -1: [ParameterAccess] access to parameter args
# 162| 0: [LocalVariableAccess] access to local variable i
# 162| 0: [StringLiteral] "/"
# 162| 1: [ContinueStmt] continue;
# 163| 1: [ExprStmt] ...;
# 163| 0: [MethodCall] call to method WriteLine
# 163| -1: [TypeAccess] access to type Console
# 163| 0: [ArrayAccess] access to array element
# 163| -1: [ParameterAccess] access to parameter args
# 163| 0: [LocalVariableAccess] access to local variable i
# 167| 19: [Method] MainGoto
#-----| 2: (Parameters)
# 167| 0: [Parameter] args
# 168| 4: [BlockStmt] {...}
# 169| 0: [LocalVariableDeclStmt] ... ...;
# 169| 0: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 169| 0: [IntLiteral] 0
# 169| 1: [LocalVariableAccess] access to local variable i
# 170| 1: [GotoLabelStmt] goto ...;
# 171| 2: [LabelStmt] loop:
# 171| 3: [ExprStmt] ...;
# 171| 0: [MethodCall] call to method WriteLine
# 171| -1: [TypeAccess] access to type Console
# 171| 0: [ArrayAccess] access to array element
# 171| -1: [ParameterAccess] access to parameter args
# 171| 0: [PostIncrExpr] ...++
# 171| 0: [LocalVariableAccess] access to local variable i
# 172| 4: [LabelStmt] check:
# 172| 5: [IfStmt] if (...) ...
# 172| 0: [LTExpr] ... < ...
# 172| 0: [LocalVariableAccess] access to local variable i
# 172| 1: [PropertyCall] access to property Length
# 172| -1: [ParameterAccess] access to parameter args
# 172| 1: [GotoLabelStmt] goto ...;
# 175| 20: [Method] Add
#-----| 2: (Parameters)
# 175| 0: [Parameter] a
# 175| 1: [Parameter] b
# 176| 4: [BlockStmt] {...}
# 177| 0: [ReturnStmt] return ...;
# 177| 0: [AddExpr] ... + ...
# 177| 0: [ParameterAccess] access to parameter a
# 177| 1: [ParameterAccess] access to parameter b
# 179| 21: [Method] MainReturn
# 180| 4: [BlockStmt] {...}
# 181| 0: [ExprStmt] ...;
# 181| 0: [MethodCall] call to method WriteLine
# 181| -1: [TypeAccess] access to type Console
# 181| 0: [MethodCall] call to method Add
# 181| 0: [IntLiteral] 1
# 181| 1: [IntLiteral] 2
# 182| 1: [ReturnStmt] return ...;
# 185| 22: [Method] Range
#-----| 2: (Parameters)
# 185| 0: [Parameter] from
# 185| 1: [Parameter] to
# 186| 4: [BlockStmt] {...}
# 187| 0: [ForStmt] for (...;...;...) ...
# 187| -1: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 187| 0: [ParameterAccess] access to parameter from
# 187| 1: [LocalVariableAccess] access to local variable i
# 187| 0: [LTExpr] ... < ...
# 187| 0: [LocalVariableAccess] access to local variable i
# 187| 1: [ParameterAccess] access to parameter to
# 187| 1: [PostIncrExpr] ...++
# 187| 0: [LocalVariableAccess] access to local variable i
# 188| 2: [BlockStmt] {...}
# 189| 0: [YieldReturnStmt] yield return ...;
# 189| 0: [LocalVariableAccess] access to local variable i
# 191| 1: [YieldBreakStmt] yield break;
# 193| 23: [Method] MainYield
# 194| 4: [BlockStmt] {...}
# 195| 0: [ForeachStmt] foreach (... ... in ...) ...
# 195| 0: [LocalVariableDeclExpr] Int32 x
# 195| 1: [MethodCall] call to method Range
# 195| 0: [UnaryMinusExpr] -...
# 195| 0: [IntLiteral] 10
# 195| 1: [IntLiteral] 10
# 196| 2: [BlockStmt] {...}
# 197| 0: [ExprStmt] ...;
# 197| 0: [MethodCall] call to method WriteLine
# 197| -1: [TypeAccess] access to type Console
# 197| 0: [LocalVariableAccess] access to local variable x
# 201| 24: [Method] Divide
#-----| 2: (Parameters)
# 201| 0: [Parameter] x
# 201| 1: [Parameter] y
# 202| 4: [BlockStmt] {...}
# 203| 0: [IfStmt] if (...) ...
# 203| 0: [EQExpr] ... == ...
# 203| 0: [ParameterAccess] access to parameter y
# 203| 1: [CastExpr] (...) ...
# 203| 0: [IntLiteral] 0
# 203| 1: [ThrowStmt] throw ...;
# 203| 0: [ObjectCreation] object creation of type DivideByZeroException
# 204| 1: [ReturnStmt] return ...;
# 204| 0: [DivExpr] ... / ...
# 204| 0: [ParameterAccess] access to parameter x
# 204| 1: [ParameterAccess] access to parameter y
# 206| 25: [Method] MainTryThrow
#-----| 2: (Parameters)
# 206| 0: [Parameter] args
# 207| 4: [BlockStmt] {...}
# 208| 0: [TryStmt] try {...} ...
# 227| -1: [BlockStmt] {...}
# 228| 0: [ExprStmt] ...;
# 228| 0: [MethodCall] call to method WriteLine
# 228| -1: [TypeAccess] access to type Console
# 228| 0: [StringLiteral] "Good bye!"
# 209| 0: [BlockStmt] {...}
# 210| 0: [IfStmt] if (...) ...
# 210| 0: [NEExpr] ... != ...
# 210| 0: [PropertyCall] access to property Length
# 210| -1: [ParameterAccess] access to parameter args
# 210| 1: [IntLiteral] 2
# 211| 1: [BlockStmt] {...}
# 212| 0: [ThrowStmt] throw ...;
# 212| 0: [ObjectCreation] object creation of type Exception
# 212| 0: [StringLiteral] "Two numbers required"
# 214| 1: [LocalVariableDeclStmt] ... ...;
# 214| 0: [LocalVariableDeclAndInitExpr] Double x = ...
# 214| 0: [MethodCall] call to method Parse
# 214| -1: [TypeAccess] access to type Double
# 214| 0: [ArrayAccess] access to array element
# 214| -1: [ParameterAccess] access to parameter args
# 214| 0: [IntLiteral] 0
# 214| 1: [LocalVariableAccess] access to local variable x
# 215| 2: [LocalVariableDeclStmt] ... ...;
# 215| 0: [LocalVariableDeclAndInitExpr] Double y = ...
# 215| 0: [MethodCall] call to method Parse
# 215| -1: [TypeAccess] access to type Double
# 215| 0: [ArrayAccess] access to array element
# 215| -1: [ParameterAccess] access to parameter args
# 215| 0: [IntLiteral] 1
# 215| 1: [LocalVariableAccess] access to local variable y
# 216| 3: [ExprStmt] ...;
# 216| 0: [MethodCall] call to method WriteLine
# 216| -1: [TypeAccess] access to type Console
# 216| 0: [MethodCall] call to method Divide
# 216| 0: [LocalVariableAccess] access to local variable x
# 216| 1: [LocalVariableAccess] access to local variable y
# 218| 1: [SpecificCatchClause] catch (...) {...}
# 218| 0: [LocalVariableDeclExpr] Exception e
# 219| 1: [BlockStmt] {...}
# 220| 0: [ExprStmt] ...;
# 220| 0: [MethodCall] call to method WriteLine
# 220| -1: [TypeAccess] access to type Console
# 220| 0: [PropertyCall] access to property Message
# 220| -1: [LocalVariableAccess] access to local variable e
# 222| 2: [GeneralCatchClause] catch {...}
# 223| 1: [BlockStmt] {...}
# 224| 0: [ExprStmt] ...;
# 224| 0: [MethodCall] call to method WriteLine
# 224| -1: [TypeAccess] access to type Console
# 224| 0: [StringLiteral] "Exception"
# 232| 26: [Method] MainCheckedUnchecked
# 233| 4: [BlockStmt] {...}
# 234| 0: [LocalVariableDeclStmt] ... ...;
# 234| 0: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 234| 0: [MemberConstantAccess] access to constant MaxValue
# 234| -1: [TypeAccess] access to type Int32
# 234| 1: [LocalVariableAccess] access to local variable i
# 235| 1: [CheckedStmt] checked {...}
# 236| 0: [BlockStmt] {...}
# 237| 0: [ExprStmt] ...;
# 237| 0: [MethodCall] call to method WriteLine
# 237| -1: [TypeAccess] access to type Console
# 237| 0: [AddExpr] ... + ...
# 237| 0: [LocalVariableAccess] access to local variable i
# 237| 1: [IntLiteral] 1
# 239| 2: [UncheckedStmt] unchecked {...}
# 240| 0: [BlockStmt] {...}
# 241| 0: [ExprStmt] ...;
# 241| 0: [MethodCall] call to method WriteLine
# 241| -1: [TypeAccess] access to type Console
# 241| 0: [AddExpr] ... + ...
# 241| 0: [LocalVariableAccess] access to local variable i
# 241| 1: [IntLiteral] 1
# 245| 27: [Class] AccountLock
# 247| 5: [Field] balance
# 248| 6: [Method] Withdraw
#-----| 2: (Parameters)
# 248| 0: [Parameter] amount
# 249| 4: [BlockStmt] {...}
# 250| 0: [LockStmt] lock (...) {...}
# 250| 0: [ThisAccess] this access
# 251| 1: [BlockStmt] {...}
# 252| 0: [IfStmt] if (...) ...
# 252| 0: [GTExpr] ... > ...
# 252| 0: [ParameterAccess] access to parameter amount
# 252| 1: [FieldAccess] access to field balance
# 253| 1: [BlockStmt] {...}
# 254| 0: [ThrowStmt] throw ...;
# 254| 0: [ObjectCreation] object creation of type Exception
# 254| 0: [StringLiteral] "Insufficient funds"
# 256| 1: [ExprStmt] ...;
# 256| 0: [AssignSubExpr] ... -= ...
# 256| 0: [ParameterAccess] access to parameter amount
# 256| 1: [FieldAccess] access to field balance
# 261| 28: [Method] MainUsing
# 262| 4: [BlockStmt] {...}
# 263| 0: [UsingBlockStmt] using (...) {...}
# 263| -1: [LocalVariableDeclAndInitExpr] TextWriter w = ...
# 263| 0: [MethodCall] call to method CreateText
# 263| -1: [TypeAccess] access to type File
# 263| 0: [StringLiteral] "test.txt"
# 263| 1: [LocalVariableAccess] access to local variable w
# 264| 1: [BlockStmt] {...}
# 265| 0: [ExprStmt] ...;
# 265| 0: [MethodCall] call to method WriteLine
# 265| -1: [LocalVariableAccess] access to local variable w
# 265| 0: [StringLiteral] "Line one"
# 266| 1: [ExprStmt] ...;
# 266| 0: [MethodCall] call to method WriteLine
# 266| -1: [LocalVariableAccess] access to local variable w
# 266| 0: [StringLiteral] "Line two"
# 267| 2: [ExprStmt] ...;
# 267| 0: [MethodCall] call to method WriteLine
# 267| -1: [LocalVariableAccess] access to local variable w
# 267| 0: [StringLiteral] "Line three"
# 269| 1: [UsingBlockStmt] using (...) {...}
# 269| 0: [MethodCall] call to method CreateText
# 269| -1: [TypeAccess] access to type File
# 269| 0: [StringLiteral] "test.txt"
# 270| 1: [BlockStmt] {...}
# 274| 29: [Method] MainLabeled
# 275| 4: [BlockStmt] {...}
# 276| 0: [GotoLabelStmt] goto ...;
# 277| 1: [LabelStmt] Label:
# 278| 2: [LocalVariableDeclStmt] ... ...;
# 278| 0: [LocalVariableDeclAndInitExpr] Int32 x = ...
# 278| 0: [IntLiteral] 23
# 278| 1: [LocalVariableAccess] access to local variable x
# 279| 3: [ExprStmt] ...;
# 279| 0: [AssignExpr] ... = ...
# 279| 0: [IntLiteral] 9
# 279| 1: [LocalVariableAccess] access to local variable x

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,48 @@
types.cs:
# 1| [NamespaceDeclaration] namespace ... { ... }
# 3| 1: [Class] Class
# 5| 5: [Method] BoolType
# 6| 6: [Method] CharType
# 7| 7: [Method] DecimalType
# 8| 8: [Method] SByteType
# 9| 9: [Method] ShortType
# 10| 10: [Method] IntType
# 11| 11: [Method] LongType
# 12| 12: [Method] ByteType
# 13| 13: [Method] UShortType
# 14| 14: [Method] UIntType
# 15| 15: [Method] ULongType
# 16| 16: [Method] FloatType
# 17| 17: [Method] DoubleType
# 18| 18: [Method] NullableType
# 19| 19: [Method] VoidType
# 20| 20: [Method] ArrayType
# 21| 21: [Method] ArrayArrayType
# 22| 22: [Method] ConstructedClassType
# 23| 23: [Method] ConstructedInterfaceType
# 24| 24: [Method] ConstructedStructType
# 25| 25: [Method] DelegateType
# 26| 26: [Method] PointerType
# 27| 27: [Method] PointerPointerType
# 28| 28: [Method] Map
# 29| 29: [Method] Null
# 30| 4: [BlockStmt] {...}
# 31| 0: [ReturnStmt] return ...;
# 31| 0: [NullLiteral] null
# 34| 2: [Enum] Enum
# 37| 3: [Struct] Struct
# 40| 4: [Interface] Interface
# 43| 5: [DelegateType] Delegate
# 44| 6: [Class] GenericClass<>
#-----| 1: (Type parameters)
# 44| 0: [TypeParameter] T
# 45| 7: [Interface] GenericInterface<>
#-----| 1: (Type parameters)
# 45| 0: [TypeParameter] T
# 46| 8: [Struct] GenericStruct<>
#-----| 1: (Type parameters)
# 46| 0: [TypeParameter] T
# 47| 9: [Class] Map<,>
#-----| 1: (Type parameters)
# 47| 0: [TypeParameter] U
# 47| 1: [TypeParameter] V

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql

View File

@@ -0,0 +1,115 @@
unsafe.cs:
# 1| [NamespaceDeclaration] namespace ... { ... }
# 3| 1: [Class] Test
# 5| 5: [Method] Main
#-----| 2: (Parameters)
# 5| 0: [Parameter] args
# 6| 4: [BlockStmt] {...}
# 7| 0: [LocalVariableDeclStmt] ... ...;
# 7| 0: [LocalVariableDeclAndInitExpr] Int32 i = ...
# 7| 0: [IntLiteral] 42
# 7| 1: [LocalVariableAccess] access to local variable i
# 8| 1: [LocalVariableDeclStmt] ... ...;
# 8| 0: [LocalVariableDeclAndInitExpr] Int32[] ia = ...
# 8| 0: [ArrayCreation] array creation of type Int32[]
# 8| 0: [IntLiteral] 2
# 8| 1: [LocalVariableAccess] access to local variable ia
# 9| 2: [ExprStmt] ...;
# 9| 0: [AssignExpr] ... = ...
# 9| 0: [IntLiteral] 0
# 9| 1: [ArrayAccess] access to array element
# 9| -1: [LocalVariableAccess] access to local variable ia
# 9| 0: [IntLiteral] 0
# 10| 3: [ExprStmt] ...;
# 10| 0: [AssignExpr] ... = ...
# 10| 0: [IntLiteral] 1
# 10| 1: [ArrayAccess] access to array element
# 10| -1: [LocalVariableAccess] access to local variable ia
# 10| 0: [IntLiteral] 1
# 11| 4: [LocalVariableDeclStmt] ... ...;
# 11| 0: [LocalVariableDeclAndInitExpr] Int32* ip = ...
# 11| 0: [AddressOfExpr] &...
# 11| 0: [LocalVariableAccess] access to local variable i
# 11| 1: [LocalVariableAccess] access to local variable ip
# 12| 5: [ExprStmt] ...;
# 12| 0: [AssignExpr] ... = ...
# 12| 0: [AddExpr] ... + ...
# 12| 0: [LocalVariableAccess] access to local variable ip
# 12| 1: [IntLiteral] 1
# 12| 1: [LocalVariableAccess] access to local variable ip
# 13| 6: [ExprStmt] ...;
# 13| 0: [AssignExpr] ... = ...
# 13| 0: [AddExpr] ... + ...
# 13| 0: [PointerIndirectionExpr] *...
# 13| 0: [LocalVariableAccess] access to local variable ip
# 13| 1: [LocalVariableAccess] access to local variable ip
# 13| 1: [LocalVariableAccess] access to local variable ip
# 14| 7: [ExprStmt] ...;
# 14| 0: [AssignExpr] ... = ...
# 14| 0: [AddExpr] ... + ...
# 14| 0: [PointerIndirectionExpr] *...
# 14| 0: [LocalVariableAccess] access to local variable ip
# 14| 1: [AddressOfExpr] &...
# 14| 0: [LocalVariableAccess] access to local variable i
# 14| 1: [LocalVariableAccess] access to local variable ip
# 15| 8: [LocalVariableDeclStmt] ... ...;
# 15| 0: [LocalVariableDeclAndInitExpr] Int32* ip42 = ...
# 15| 0: [AddressOfExpr] &...
# 15| 0: [LocalVariableAccess] access to local variable i
# 15| 1: [LocalVariableAccess] access to local variable ip42
# 16| 9: [ExprStmt] ...;
# 16| 0: [PostIncrExpr] ...++
# 16| 0: [LocalVariableAccess] access to local variable ip
# 17| 10: [ExprStmt] ...;
# 17| 0: [AssignExpr] ... = ...
# 17| 0: [SubExpr] ... - ...
# 17| 0: [LocalVariableAccess] access to local variable ip
# 17| 1: [IntLiteral] 1
# 17| 1: [LocalVariableAccess] access to local variable ip
# 18| 11: [ExprStmt] ...;
# 18| 0: [AssignExpr] ... = ...
# 18| 0: [SizeofExpr] sizeof(..)
# 18| 0: [TypeAccess] access to type Char*
# 18| 1: [PointerIndirectionExpr] *...
# 18| 0: [LocalVariableAccess] access to local variable ip42
# 19| 12: [LocalVariableDeclStmt] ... ...;
# 19| 0: [LocalVariableDeclAndInitExpr] Int64 distance = ...
# 19| 0: [SubExpr] ... - ...
# 19| 0: [LocalVariableAccess] access to local variable ip
# 19| 1: [LocalVariableAccess] access to local variable ip42
# 19| 1: [LocalVariableAccess] access to local variable distance
# 22| 6: [Method] f
#-----| 2: (Parameters)
# 22| 0: [Parameter] p
# 23| 4: [BlockStmt] {...}
# 24| 0: [ExprStmt] ...;
# 24| 0: [MethodCall] call to method ToString
# 24| -1: [PointerIndirectionExpr] *...
# 24| 0: [ParameterAccess] access to parameter p
# 25| 1: [ExprStmt] ...;
# 25| 0: [MethodCall] call to method ToString
# 25| -1: [PointerIndirectionExpr] *...
# 25| 0: [ParameterAccess] access to parameter p
# 26| 2: [ExprStmt] ...;
# 26| 0: [MethodCall] call to method ToString
# 26| -1: [PointerIndirectionExpr] *...
# 26| 0: [AddExpr] ... + ...
# 26| 0: [ParameterAccess] access to parameter p
# 26| 1: [IntLiteral] 0
# 30| 7: [Method] g
# 30| 4: [BlockStmt] {...}
# 32| 8: [Method] h
# 33| 4: [BlockStmt] {...}
# 34| 0: [UnsafeStmt] unsafe {...}
# 35| 0: [BlockStmt] {...}
# 36| 0: [LocalVariableDeclStmt] ... ...;
# 36| 0: [LocalVariableDeclAndInitExpr] Int32[] data = ...
# 36| 0: [ArrayCreation] array creation of type Int32[]
# 36| 0: [IntLiteral] 10
# 36| 1: [LocalVariableAccess] access to local variable data
# 37| 1: [FixedStmt] fixed(...) { ... }
# 37| -1: [LocalVariableDeclAndInitExpr] Int32* p = ...
# 37| 0: [LocalVariableAccess] access to local variable data
# 37| 1: [LocalVariableAccess] access to local variable p
# 38| 0: [BlockStmt] {...}
# 44| 2: [Class] SafeClass

View File

@@ -0,0 +1 @@
semmle/code/csharp/PrintAst.ql