mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
C#: Extract record declarations
This commit is contained in:
@@ -43,6 +43,11 @@ namespace Semmle.Extraction.CSharp.Populators
|
||||
Entities.NamedType.Create(cx, cx.GetModel(node).GetDeclaredSymbol(node)).ExtractRecursive(trapFile, parent);
|
||||
}
|
||||
|
||||
public override void VisitRecordDeclaration(RecordDeclarationSyntax node)
|
||||
{
|
||||
Entities.Type.Create(cx, cx.GetModel(node).GetDeclaredSymbol(node)).ExtractRecursive(trapFile, parent);
|
||||
}
|
||||
|
||||
public override void VisitClassDeclaration(ClassDeclarationSyntax classDecl)
|
||||
{
|
||||
Entities.Type.Create(cx, cx.GetModel(classDecl).GetDeclaredSymbol(classDecl)).ExtractRecursive(trapFile, parent);
|
||||
|
||||
@@ -102,15 +102,16 @@ private ValueOrRefType getAnInterestingBaseType(ValueOrRefType type) {
|
||||
not type instanceof ArrayType and
|
||||
not type instanceof NullableType and
|
||||
result = type.getABaseType() and
|
||||
isInterestingBaseType(result)
|
||||
isInterestingBaseType(type, result)
|
||||
}
|
||||
|
||||
private predicate isInterestingBaseType(ValueOrRefType base) {
|
||||
private predicate isInterestingBaseType(ValueOrRefType type, ValueOrRefType base) {
|
||||
not base instanceof ObjectType and
|
||||
not base.getQualifiedName() = "System.ValueType" and
|
||||
not base.getQualifiedName() = "System.Delegate" and
|
||||
not base.getQualifiedName() = "System.MulticastDelegate" and
|
||||
not base.getQualifiedName() = "System.Enum"
|
||||
not base.getQualifiedName() = "System.Enum" and
|
||||
exists(TypeMention tm | tm.getTarget() = type and tm.getType() = base)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
using System;
|
||||
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
public sealed class IsExternalInit
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class Base
|
||||
{
|
||||
public int Prop0 { get { return 1; } init { Prop1 = value; } }
|
||||
|
||||
7
csharp/ql/test/library-tests/csharp9/IsExternalInit.cs
Normal file
7
csharp/ql/test/library-tests/csharp9/IsExternalInit.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
public class IsExternalInit { }
|
||||
}
|
||||
@@ -287,87 +287,88 @@ FunctionPointer.cs:
|
||||
#-----| 3: (Base types)
|
||||
# 50| 0: [TypeMention] A
|
||||
InitOnlyProperty.cs:
|
||||
# 3| [NamespaceDeclaration] namespace ... { ... }
|
||||
# 5| 1: [Class] IsExternalInit
|
||||
# 10| [Class] Base
|
||||
# 12| 5: [Property] Prop0
|
||||
# 12| -1: [TypeMention] int
|
||||
# 12| 3: [Getter] get_Prop0
|
||||
# 12| 4: [BlockStmt] {...}
|
||||
# 12| 0: [ReturnStmt] return ...;
|
||||
# 12| 0: [IntLiteral] 1
|
||||
# 12| 4: [Setter] set_Prop0
|
||||
# 3| [Class] Base
|
||||
# 5| 5: [Property] Prop0
|
||||
# 5| -1: [TypeMention] int
|
||||
# 5| 3: [Getter] get_Prop0
|
||||
# 5| 4: [BlockStmt] {...}
|
||||
# 5| 0: [ReturnStmt] return ...;
|
||||
# 5| 0: [IntLiteral] 1
|
||||
# 5| 4: [Setter] set_Prop0
|
||||
#-----| 2: (Parameters)
|
||||
# 12| 0: [Parameter] value
|
||||
# 12| 4: [BlockStmt] {...}
|
||||
# 12| 0: [ExprStmt] ...;
|
||||
# 12| 0: [AssignExpr] ... = ...
|
||||
# 12| 0: [PropertyCall] access to property Prop1
|
||||
# 12| 1: [ParameterAccess] access to parameter value
|
||||
# 13| 6: [Property] Prop1
|
||||
# 5| 0: [Parameter] value
|
||||
# 5| 4: [BlockStmt] {...}
|
||||
# 5| 0: [ExprStmt] ...;
|
||||
# 5| 0: [AssignExpr] ... = ...
|
||||
# 5| 0: [PropertyCall] access to property Prop1
|
||||
# 5| 1: [ParameterAccess] access to parameter value
|
||||
# 6| 6: [Property] Prop1
|
||||
# 6| -1: [TypeMention] int
|
||||
# 6| 3: [Getter] get_Prop1
|
||||
# 6| 4: [Setter] set_Prop1
|
||||
#-----| 2: (Parameters)
|
||||
# 6| 0: [Parameter] value
|
||||
# 7| 7: [Property] Prop2
|
||||
# 7| -1: [TypeMention] int
|
||||
# 7| 3: [Getter] get_Prop2
|
||||
# 7| 4: [Setter] set_Prop2
|
||||
#-----| 2: (Parameters)
|
||||
# 7| 0: [Parameter] value
|
||||
# 11| [Class] Derived
|
||||
#-----| 3: (Base types)
|
||||
# 11| 0: [TypeMention] Base
|
||||
# 13| 5: [Property] Prop1
|
||||
# 13| -1: [TypeMention] int
|
||||
# 13| 3: [Getter] get_Prop1
|
||||
# 13| 4: [Setter] set_Prop1
|
||||
#-----| 2: (Parameters)
|
||||
# 13| 0: [Parameter] value
|
||||
# 14| 7: [Property] Prop2
|
||||
# 14| 6: [Property] Prop2
|
||||
# 14| -1: [TypeMention] int
|
||||
# 14| 3: [Getter] get_Prop2
|
||||
# 14| 4: [Setter] set_Prop2
|
||||
# 16| 3: [Getter] get_Prop2
|
||||
# 16| 4: [BlockStmt] {...}
|
||||
# 16| 0: [ReturnStmt] return ...;
|
||||
# 16| 0: [IntLiteral] 0
|
||||
# 17| 4: [Setter] set_Prop2
|
||||
#-----| 2: (Parameters)
|
||||
# 14| 0: [Parameter] value
|
||||
# 18| [Class] Derived
|
||||
#-----| 3: (Base types)
|
||||
# 18| 0: [TypeMention] Base
|
||||
# 20| 5: [Property] Prop1
|
||||
# 20| -1: [TypeMention] int
|
||||
# 20| 3: [Getter] get_Prop1
|
||||
# 20| 4: [Setter] set_Prop1
|
||||
#-----| 2: (Parameters)
|
||||
# 20| 0: [Parameter] value
|
||||
# 21| 6: [Property] Prop2
|
||||
# 21| -1: [TypeMention] int
|
||||
# 23| 3: [Getter] get_Prop2
|
||||
# 23| 4: [BlockStmt] {...}
|
||||
# 23| 0: [ReturnStmt] return ...;
|
||||
# 23| 0: [IntLiteral] 0
|
||||
# 24| 4: [Setter] set_Prop2
|
||||
#-----| 2: (Parameters)
|
||||
# 24| 0: [Parameter] value
|
||||
# 25| 4: [BlockStmt] {...}
|
||||
# 26| 0: [ExprStmt] ...;
|
||||
# 26| 0: [MethodCall] call to method WriteLine
|
||||
# 26| -1: [TypeAccess] access to type Console
|
||||
# 26| 0: [TypeMention] Console
|
||||
# 26| 0: [ParameterAccess] access to parameter value
|
||||
# 27| 1: [ExprStmt] ...;
|
||||
# 27| 0: [AssignExpr] ... = ...
|
||||
# 27| 0: [PropertyCall] access to property Prop1
|
||||
# 27| 1: [ParameterAccess] access to parameter value
|
||||
# 28| 2: [ExprStmt] ...;
|
||||
# 28| 0: [AssignExpr] ... = ...
|
||||
# 28| 0: [PropertyCall] access to property Prop0
|
||||
# 28| 1: [ParameterAccess] access to parameter value
|
||||
# 33| [Class] C1
|
||||
# 35| 5: [Method] M1
|
||||
# 35| -1: [TypeMention] Void
|
||||
# 36| 4: [BlockStmt] {...}
|
||||
# 37| 0: [LocalVariableDeclStmt] ... ...;
|
||||
# 37| 0: [LocalVariableDeclAndInitExpr] Derived d = ...
|
||||
# 37| -1: [TypeMention] Derived
|
||||
# 37| 0: [LocalVariableAccess] access to local variable d
|
||||
# 37| 1: [ObjectCreation] object creation of type Derived
|
||||
# 37| -2: [TypeMention] Derived
|
||||
# 38| -1: [ObjectInitializer] { ..., ... }
|
||||
# 39| 0: [MemberInitializer] ... = ...
|
||||
# 39| 0: [PropertyCall] access to property Prop1
|
||||
# 39| 1: [IntLiteral] 1
|
||||
# 40| 1: [MemberInitializer] ... = ...
|
||||
# 40| 0: [PropertyCall] access to property Prop2
|
||||
# 40| 1: [IntLiteral] 2
|
||||
# 41| 2: [MemberInitializer] ... = ...
|
||||
# 41| 0: [PropertyCall] access to property Prop0
|
||||
# 41| 1: [IntLiteral] 0
|
||||
# 17| 0: [Parameter] value
|
||||
# 18| 4: [BlockStmt] {...}
|
||||
# 19| 0: [ExprStmt] ...;
|
||||
# 19| 0: [MethodCall] call to method WriteLine
|
||||
# 19| -1: [TypeAccess] access to type Console
|
||||
# 19| 0: [TypeMention] Console
|
||||
# 19| 0: [ParameterAccess] access to parameter value
|
||||
# 20| 1: [ExprStmt] ...;
|
||||
# 20| 0: [AssignExpr] ... = ...
|
||||
# 20| 0: [PropertyCall] access to property Prop1
|
||||
# 20| 1: [ParameterAccess] access to parameter value
|
||||
# 21| 2: [ExprStmt] ...;
|
||||
# 21| 0: [AssignExpr] ... = ...
|
||||
# 21| 0: [PropertyCall] access to property Prop0
|
||||
# 21| 1: [ParameterAccess] access to parameter value
|
||||
# 26| [Class] C1
|
||||
# 28| 5: [Method] M1
|
||||
# 28| -1: [TypeMention] Void
|
||||
# 29| 4: [BlockStmt] {...}
|
||||
# 30| 0: [LocalVariableDeclStmt] ... ...;
|
||||
# 30| 0: [LocalVariableDeclAndInitExpr] Derived d = ...
|
||||
# 30| -1: [TypeMention] Derived
|
||||
# 30| 0: [LocalVariableAccess] access to local variable d
|
||||
# 30| 1: [ObjectCreation] object creation of type Derived
|
||||
# 30| -2: [TypeMention] Derived
|
||||
# 31| -1: [ObjectInitializer] { ..., ... }
|
||||
# 32| 0: [MemberInitializer] ... = ...
|
||||
# 32| 0: [PropertyCall] access to property Prop1
|
||||
# 32| 1: [IntLiteral] 1
|
||||
# 33| 1: [MemberInitializer] ... = ...
|
||||
# 33| 0: [PropertyCall] access to property Prop2
|
||||
# 33| 1: [IntLiteral] 2
|
||||
# 34| 2: [MemberInitializer] ... = ...
|
||||
# 34| 0: [PropertyCall] access to property Prop0
|
||||
# 34| 1: [IntLiteral] 0
|
||||
IsExternalInit.cs:
|
||||
# 4| [NamespaceDeclaration] namespace ... { ... }
|
||||
# 6| 1: [Class] IsExternalInit
|
||||
LambdaModifier.cs:
|
||||
# 4| [Class] Class1
|
||||
# 6| 5: [Method] M1
|
||||
@@ -656,6 +657,288 @@ ParenthesizedPattern.cs:
|
||||
# 27| 0: [TypeAccessPatternExpr] access to type String
|
||||
# 27| 0: [TypeMention] string
|
||||
# 27| 2: [IntLiteral] 5
|
||||
Record.cs:
|
||||
# 4| [Class] Person
|
||||
# 4| 11: [Property] EqualityContract
|
||||
# 4| 3: [Getter] get_EqualityContract
|
||||
# 4| 11: [NEOperator] !=
|
||||
#-----| 2: (Parameters)
|
||||
# 4| 0: [Parameter] r1
|
||||
# 4| 1: [Parameter] r2
|
||||
# 4| 11: [EQOperator] ==
|
||||
#-----| 2: (Parameters)
|
||||
# 4| 0: [Parameter] r1
|
||||
# 4| 1: [Parameter] r2
|
||||
# 6| 14: [IndexerProperty] LastName
|
||||
# 6| -1: [TypeMention] string
|
||||
# 6| 3: [Getter] get_LastName
|
||||
# 7| 15: [IndexerProperty] FirstName
|
||||
# 7| -1: [TypeMention] string
|
||||
# 7| 3: [Getter] get_FirstName
|
||||
# 9| 16: [InstanceConstructor] Person
|
||||
#-----| 2: (Parameters)
|
||||
# 9| 0: [Parameter] first
|
||||
# 9| -1: [TypeMention] string
|
||||
# 9| 1: [Parameter] last
|
||||
# 9| -1: [TypeMention] string
|
||||
# 9| 4: [AssignExpr] ... = ...
|
||||
# 9| 0: [TupleExpr] (..., ...)
|
||||
# 9| 0: [PropertyCall] access to property FirstName
|
||||
# 9| 1: [PropertyCall] access to property LastName
|
||||
# 9| 1: [TupleExpr] (..., ...)
|
||||
# 9| 0: [ParameterAccess] access to parameter first
|
||||
# 9| 1: [ParameterAccess] access to parameter last
|
||||
# 12| [Class] Teacher
|
||||
# 12| 12: [Property] EqualityContract
|
||||
# 12| 3: [Getter] get_EqualityContract
|
||||
# 12| 12: [NEOperator] !=
|
||||
#-----| 2: (Parameters)
|
||||
# 12| 0: [Parameter] r1
|
||||
# 12| 1: [Parameter] r2
|
||||
# 12| 12: [EQOperator] ==
|
||||
#-----| 2: (Parameters)
|
||||
# 12| 0: [Parameter] r1
|
||||
# 12| 1: [Parameter] r2
|
||||
# 14| 15: [IndexerProperty] Subject
|
||||
# 14| -1: [TypeMention] string
|
||||
# 14| 3: [Getter] get_Subject
|
||||
# 16| 16: [InstanceConstructor] Teacher
|
||||
#-----| 2: (Parameters)
|
||||
# 16| 0: [Parameter] first
|
||||
# 16| -1: [TypeMention] string
|
||||
# 16| 1: [Parameter] last
|
||||
# 16| -1: [TypeMention] string
|
||||
# 16| 2: [Parameter] sub
|
||||
# 16| -1: [TypeMention] string
|
||||
# 17| 3: [ConstructorInitializer] call to constructor Person
|
||||
# 17| 0: [ParameterAccess] access to parameter first
|
||||
# 17| 1: [ParameterAccess] access to parameter last
|
||||
# 17| 4: [AssignExpr] ... = ...
|
||||
# 17| 0: [PropertyCall] access to property Subject
|
||||
# 17| 1: [ParameterAccess] access to parameter sub
|
||||
# 20| [Class] Student
|
||||
# 20| 12: [Property] EqualityContract
|
||||
# 20| 3: [Getter] get_EqualityContract
|
||||
# 20| 12: [NEOperator] !=
|
||||
#-----| 2: (Parameters)
|
||||
# 20| 0: [Parameter] r1
|
||||
# 20| 1: [Parameter] r2
|
||||
# 20| 12: [EQOperator] ==
|
||||
#-----| 2: (Parameters)
|
||||
# 20| 0: [Parameter] r1
|
||||
# 20| 1: [Parameter] r2
|
||||
# 22| 15: [Property] Level
|
||||
# 22| -1: [TypeMention] int
|
||||
# 22| 3: [Getter] get_Level
|
||||
# 24| 16: [InstanceConstructor] Student
|
||||
#-----| 2: (Parameters)
|
||||
# 24| 0: [Parameter] first
|
||||
# 24| -1: [TypeMention] string
|
||||
# 24| 1: [Parameter] last
|
||||
# 24| -1: [TypeMention] string
|
||||
# 24| 2: [Parameter] level
|
||||
# 24| -1: [TypeMention] int
|
||||
# 24| 3: [ConstructorInitializer] call to constructor Person
|
||||
# 24| 0: [ParameterAccess] access to parameter first
|
||||
# 24| 1: [ParameterAccess] access to parameter last
|
||||
# 24| 4: [AssignExpr] ... = ...
|
||||
# 24| 0: [PropertyCall] access to property Level
|
||||
# 24| 1: [ParameterAccess] access to parameter level
|
||||
# 27| [Class] Person1
|
||||
# 27| 12: [Property] EqualityContract
|
||||
# 27| 3: [Getter] get_EqualityContract
|
||||
# 27| 12: [InstanceConstructor] Person1
|
||||
#-----| 2: (Parameters)
|
||||
# 27| 0: [Parameter] FirstName
|
||||
# 27| -1: [TypeMention] string
|
||||
# 27| 1: [Parameter] LastName
|
||||
# 27| -1: [TypeMention] string
|
||||
# 27| 12: [NEOperator] !=
|
||||
#-----| 2: (Parameters)
|
||||
# 27| 0: [Parameter] r1
|
||||
# 27| 1: [Parameter] r2
|
||||
# 27| 12: [EQOperator] ==
|
||||
#-----| 2: (Parameters)
|
||||
# 27| 0: [Parameter] r1
|
||||
# 27| 1: [Parameter] r2
|
||||
# 27| 16: [IndexerProperty] FirstName
|
||||
# 27| 3: [Getter] get_FirstName
|
||||
# 27| 4: [Setter] set_FirstName
|
||||
#-----| 2: (Parameters)
|
||||
# 27| 0: [Parameter] value
|
||||
# 27| 17: [IndexerProperty] LastName
|
||||
# 27| 3: [Getter] get_LastName
|
||||
# 27| 4: [Setter] set_LastName
|
||||
#-----| 2: (Parameters)
|
||||
# 27| 0: [Parameter] value
|
||||
# 29| [Class] Teacher1
|
||||
# 29| 13: [Property] EqualityContract
|
||||
# 29| 3: [Getter] get_EqualityContract
|
||||
# 29| 13: [NEOperator] !=
|
||||
#-----| 2: (Parameters)
|
||||
# 29| 0: [Parameter] r1
|
||||
# 29| 1: [Parameter] r2
|
||||
# 29| 13: [EQOperator] ==
|
||||
#-----| 2: (Parameters)
|
||||
# 29| 0: [Parameter] r1
|
||||
# 29| 1: [Parameter] r2
|
||||
# 29| 13: [InstanceConstructor] Teacher1
|
||||
#-----| 2: (Parameters)
|
||||
# 29| 0: [Parameter] FirstName
|
||||
# 29| -1: [TypeMention] string
|
||||
# 29| 1: [Parameter] LastName
|
||||
# 29| -1: [TypeMention] string
|
||||
# 29| 2: [Parameter] Subject
|
||||
# 29| -1: [TypeMention] string
|
||||
# 29| 17: [IndexerProperty] Subject
|
||||
# 29| 3: [Getter] get_Subject
|
||||
# 29| 4: [Setter] set_Subject
|
||||
#-----| 2: (Parameters)
|
||||
# 29| 0: [Parameter] value
|
||||
# 32| [Class] Student1
|
||||
# 32| 13: [Property] EqualityContract
|
||||
# 32| 3: [Getter] get_EqualityContract
|
||||
# 32| 13: [NEOperator] !=
|
||||
#-----| 2: (Parameters)
|
||||
# 32| 0: [Parameter] r1
|
||||
# 32| 1: [Parameter] r2
|
||||
# 32| 13: [EQOperator] ==
|
||||
#-----| 2: (Parameters)
|
||||
# 32| 0: [Parameter] r1
|
||||
# 32| 1: [Parameter] r2
|
||||
# 32| 13: [InstanceConstructor] Student1
|
||||
#-----| 2: (Parameters)
|
||||
# 32| 0: [Parameter] FirstName
|
||||
# 32| -1: [TypeMention] string
|
||||
# 32| 1: [Parameter] LastName
|
||||
# 32| -1: [TypeMention] string
|
||||
# 32| 2: [Parameter] Level
|
||||
# 32| -1: [TypeMention] int
|
||||
# 32| 17: [Property] Level
|
||||
# 32| 3: [Getter] get_Level
|
||||
# 32| 4: [Setter] set_Level
|
||||
#-----| 2: (Parameters)
|
||||
# 32| 0: [Parameter] value
|
||||
# 35| [Class] Pet
|
||||
# 35| 12: [Property] EqualityContract
|
||||
# 35| 3: [Getter] get_EqualityContract
|
||||
# 35| 12: [NEOperator] !=
|
||||
#-----| 2: (Parameters)
|
||||
# 35| 0: [Parameter] r1
|
||||
# 35| 1: [Parameter] r2
|
||||
# 35| 12: [EQOperator] ==
|
||||
#-----| 2: (Parameters)
|
||||
# 35| 0: [Parameter] r1
|
||||
# 35| 1: [Parameter] r2
|
||||
# 35| 12: [InstanceConstructor] Pet
|
||||
#-----| 2: (Parameters)
|
||||
# 35| 0: [Parameter] Name
|
||||
# 35| -1: [TypeMention] string
|
||||
# 35| 16: [IndexerProperty] Name
|
||||
# 35| 3: [Getter] get_Name
|
||||
# 35| 4: [Setter] set_Name
|
||||
#-----| 2: (Parameters)
|
||||
# 35| 0: [Parameter] value
|
||||
# 37| 17: [Method] ShredTheFurniture
|
||||
# 37| -1: [TypeMention] Void
|
||||
# 38| 4: [MethodCall] call to method WriteLine
|
||||
# 38| -1: [TypeAccess] access to type Console
|
||||
# 38| 0: [TypeMention] Console
|
||||
# 38| 0: [StringLiteral] "Shredding furniture"
|
||||
# 41| [Class] Dog
|
||||
# 41| 12: [Property] EqualityContract
|
||||
# 41| 3: [Getter] get_EqualityContract
|
||||
# 41| 12: [NEOperator] !=
|
||||
#-----| 2: (Parameters)
|
||||
# 41| 0: [Parameter] r1
|
||||
# 41| 1: [Parameter] r2
|
||||
# 41| 12: [EQOperator] ==
|
||||
#-----| 2: (Parameters)
|
||||
# 41| 0: [Parameter] r1
|
||||
# 41| 1: [Parameter] r2
|
||||
# 41| 12: [InstanceConstructor] Dog
|
||||
#-----| 2: (Parameters)
|
||||
# 41| 0: [Parameter] Name
|
||||
# 41| -1: [TypeMention] string
|
||||
# 43| 16: [Method] WagTail
|
||||
# 43| -1: [TypeMention] Void
|
||||
# 44| 4: [MethodCall] call to method WriteLine
|
||||
# 44| -1: [TypeAccess] access to type Console
|
||||
# 44| 0: [TypeMention] Console
|
||||
# 44| 0: [StringLiteral] "It's tail wagging time"
|
||||
# 46| 17: [Method] ToString
|
||||
# 46| -1: [TypeMention] string
|
||||
# 47| 4: [BlockStmt] {...}
|
||||
# 48| 0: [LocalVariableDeclStmt] ... ...;
|
||||
# 48| 0: [LocalVariableDeclAndInitExpr] StringBuilder s = ...
|
||||
# 48| -1: [TypeMention] StringBuilder
|
||||
# 48| 0: [LocalVariableAccess] access to local variable s
|
||||
# 48| 1: [ObjectCreation] object creation of type StringBuilder
|
||||
# 48| 0: [TypeMention] StringBuilder
|
||||
# 49| 1: [ExprStmt] ...;
|
||||
# 49| 0: [MethodCall] call to method PrintMembers
|
||||
# 49| -1: [BaseAccess] base access
|
||||
# 49| 0: [LocalVariableAccess] access to local variable s
|
||||
# 50| 2: [ReturnStmt] return ...;
|
||||
# 50| 0: [InterpolatedStringExpr] $"..."
|
||||
# 50| 0: [MethodCall] call to method ToString
|
||||
# 50| -1: [LocalVariableAccess] access to local variable s
|
||||
# 50| 1: [StringLiteral] " is a dog"
|
||||
# 54| [Class] Record1
|
||||
# 56| 5: [Method] M1
|
||||
# 56| -1: [TypeMention] Void
|
||||
# 57| 4: [BlockStmt] {...}
|
||||
# 58| 0: [LocalVariableDeclStmt] ... ...;
|
||||
# 58| 0: [LocalVariableDeclAndInitExpr] Person person = ...
|
||||
# 58| -1: [TypeMention] Person
|
||||
# 58| 0: [LocalVariableAccess] access to local variable person
|
||||
# 58| 1: [ObjectCreation] object creation of type Person
|
||||
# 58| -1: [TypeMention] Person
|
||||
# 58| 0: [StringLiteral] "Bill"
|
||||
# 58| 1: [StringLiteral] "Wagner"
|
||||
# 59| 1: [LocalVariableDeclStmt] ... ...;
|
||||
# 59| 0: [LocalVariableDeclAndInitExpr] Student student = ...
|
||||
# 59| -1: [TypeMention] Student
|
||||
# 59| 0: [LocalVariableAccess] access to local variable student
|
||||
# 59| 1: [ObjectCreation] object creation of type Student
|
||||
# 59| -1: [TypeMention] Student
|
||||
# 59| 0: [StringLiteral] "Bill"
|
||||
# 59| 1: [StringLiteral] "Wagner"
|
||||
# 59| 2: [IntLiteral] 11
|
||||
# 61| 2: [ExprStmt] ...;
|
||||
# 61| 0: [MethodCall] call to method WriteLine
|
||||
# 61| -1: [TypeAccess] access to type Console
|
||||
# 61| 0: [TypeMention] Console
|
||||
# 61| 0: [OperatorCall] call to operator ==
|
||||
# 61| 0: [LocalVariableAccess] access to local variable student
|
||||
# 61| 1: [LocalVariableAccess] access to local variable person
|
||||
# 64| 6: [Method] M2
|
||||
# 64| -1: [TypeMention] Void
|
||||
# 65| 4: [BlockStmt] {...}
|
||||
# 66| 0: [LocalVariableDeclStmt] ... ...;
|
||||
# 66| 0: [LocalVariableDeclAndInitExpr] Person1 person = ...
|
||||
# 66| -1: [TypeMention] Person1
|
||||
# 66| 0: [LocalVariableAccess] access to local variable person
|
||||
# 66| 1: [ObjectCreation] object creation of type Person1
|
||||
# 66| -1: [TypeMention] Person1
|
||||
# 66| 0: [StringLiteral] "Bill"
|
||||
# 66| 1: [StringLiteral] "Wagner"
|
||||
# 68| 1: [ExprStmt] ...;
|
||||
# 68| 0: [AssignExpr] ... = ...
|
||||
# 68| 0: [TupleExpr] (..., ...)
|
||||
# 68| 0: [LocalVariableDeclExpr] String first
|
||||
# 68| 1: [LocalVariableDeclExpr] String last
|
||||
# 68| 1: [LocalVariableAccess] access to local variable person
|
||||
# 69| 2: [ExprStmt] ...;
|
||||
# 69| 0: [MethodCall] call to method WriteLine
|
||||
# 69| -1: [TypeAccess] access to type Console
|
||||
# 69| 0: [TypeMention] Console
|
||||
# 69| 0: [LocalVariableAccess] access to local variable first
|
||||
# 70| 3: [ExprStmt] ...;
|
||||
# 70| 0: [MethodCall] call to method WriteLine
|
||||
# 70| -1: [TypeAccess] access to type Console
|
||||
# 70| 0: [TypeMention] Console
|
||||
# 70| 0: [LocalVariableAccess] access to local variable last
|
||||
RelationalPattern.cs:
|
||||
# 3| [Class] RelationalPattern
|
||||
# 5| 5: [Method] M1
|
||||
|
||||
72
csharp/ql/test/library-tests/csharp9/Record.cs
Normal file
72
csharp/ql/test/library-tests/csharp9/Record.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
public record Person
|
||||
{
|
||||
public string LastName { get; }
|
||||
public string FirstName { get; }
|
||||
|
||||
public Person(string first, string last) => (FirstName, LastName) = (first, last);
|
||||
}
|
||||
|
||||
public record Teacher : Person
|
||||
{
|
||||
public string Subject { get; }
|
||||
|
||||
public Teacher(string first, string last, string sub)
|
||||
: base(first, last) => Subject = sub;
|
||||
}
|
||||
|
||||
public sealed record Student : Person
|
||||
{
|
||||
public int Level { get; }
|
||||
|
||||
public Student(string first, string last, int level) : base(first, last) => Level = level;
|
||||
}
|
||||
|
||||
public record Person1(string FirstName, string LastName);
|
||||
|
||||
public record Teacher1(string FirstName, string LastName, string Subject)
|
||||
: Person1(FirstName, LastName);
|
||||
|
||||
public sealed record Student1(string FirstName, string LastName, int Level)
|
||||
: Person1(FirstName, LastName);
|
||||
|
||||
public record Pet(string Name)
|
||||
{
|
||||
public void ShredTheFurniture() =>
|
||||
Console.WriteLine("Shredding furniture");
|
||||
}
|
||||
|
||||
public record Dog(string Name) : Pet(Name)
|
||||
{
|
||||
public void WagTail() =>
|
||||
Console.WriteLine("It's tail wagging time");
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var s = new StringBuilder();
|
||||
base.PrintMembers(s);
|
||||
return $"{s.ToString()} is a dog";
|
||||
}
|
||||
}
|
||||
|
||||
public class Record1
|
||||
{
|
||||
public void M1()
|
||||
{
|
||||
var person = new Person("Bill", "Wagner");
|
||||
var student = new Student("Bill", "Wagner", 11);
|
||||
|
||||
Console.WriteLine(student == person);
|
||||
}
|
||||
|
||||
public void M2()
|
||||
{
|
||||
var person = new Person1("Bill", "Wagner");
|
||||
|
||||
var (first, last) = person;
|
||||
Console.WriteLine(first);
|
||||
Console.WriteLine(last);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
| AnonymousObjectCreation.cs:9:29:9:31 | set_Prop1 | set |
|
||||
| BinaryPattern.cs:5:26:5:28 | set_P1 | set |
|
||||
| InitOnlyProperty.cs:12:42:12:45 | set_Prop0 | init |
|
||||
| InitOnlyProperty.cs:13:37:13:40 | set_Prop1 | init |
|
||||
| InitOnlyProperty.cs:14:37:14:39 | set_Prop2 | set |
|
||||
| InitOnlyProperty.cs:20:38:20:41 | set_Prop1 | init |
|
||||
| InitOnlyProperty.cs:24:9:24:12 | set_Prop2 | init |
|
||||
| InitOnlyProperty.cs:5:42:5:45 | set_Prop0 | init |
|
||||
| InitOnlyProperty.cs:6:37:6:40 | set_Prop1 | init |
|
||||
| InitOnlyProperty.cs:7:37:7:39 | set_Prop2 | set |
|
||||
| InitOnlyProperty.cs:13:38:13:41 | set_Prop1 | init |
|
||||
| InitOnlyProperty.cs:17:9:17:12 | set_Prop2 | init |
|
||||
| Record.cs:27:30:27:38 | set_FirstName | init |
|
||||
| Record.cs:27:48:27:55 | set_LastName | init |
|
||||
| Record.cs:29:66:29:72 | set_Subject | init |
|
||||
| Record.cs:32:70:32:74 | set_Level | init |
|
||||
| Record.cs:35:26:35:29 | set_Name | init |
|
||||
| UnaryPattern.cs:5:26:5:28 | set_P1 | set |
|
||||
|
||||
212
csharp/ql/test/library-tests/csharp9/record.expected
Normal file
212
csharp/ql/test/library-tests/csharp9/record.expected
Normal file
@@ -0,0 +1,212 @@
|
||||
types
|
||||
| Record.cs:4:1:10:1 | Person | IEquatable<Person> |
|
||||
| Record.cs:12:1:18:1 | Teacher | IEquatable<Teacher> |
|
||||
| Record.cs:20:1:25:1 | Student | IEquatable<Student> |
|
||||
| Record.cs:27:1:27:57 | Person1 | IEquatable<Person1> |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | IEquatable<Teacher1> |
|
||||
| Record.cs:32:1:33:35 | Student1 | IEquatable<Student1> |
|
||||
| Record.cs:35:1:39:1 | Pet | IEquatable<Pet> |
|
||||
| Record.cs:41:1:52:1 | Dog | IEquatable<Dog> |
|
||||
members
|
||||
| Record.cs:4:1:10:1 | Person | Person.!=(Person, Person) | Record.cs:4:15:4:20 |
|
||||
| Record.cs:4:1:10:1 | Person | Person.<Clone>$() | no location |
|
||||
| Record.cs:4:1:10:1 | Person | Person.==(Person, Person) | Record.cs:4:15:4:20 |
|
||||
| Record.cs:4:1:10:1 | Person | Person.EqualityContract | Record.cs:4:15:4:20 |
|
||||
| Record.cs:4:1:10:1 | Person | Person.Equals(Person) | no location |
|
||||
| Record.cs:4:1:10:1 | Person | Person.Equals(object) | no location |
|
||||
| Record.cs:4:1:10:1 | Person | Person.FirstName | Record.cs:7:19:7:27 |
|
||||
| Record.cs:4:1:10:1 | Person | Person.GetHashCode() | no location |
|
||||
| Record.cs:4:1:10:1 | Person | Person.LastName | Record.cs:6:19:6:26 |
|
||||
| Record.cs:4:1:10:1 | Person | Person.Person(Person) | no location |
|
||||
| Record.cs:4:1:10:1 | Person | Person.Person(string, string) | Record.cs:9:12:9:17 |
|
||||
| Record.cs:4:1:10:1 | Person | Person.PrintMembers(StringBuilder) | no location |
|
||||
| Record.cs:4:1:10:1 | Person | Person.ToString() | no location |
|
||||
| Record.cs:4:1:10:1 | Person | System.Object.Equals(object, object) | no location |
|
||||
| Record.cs:4:1:10:1 | Person | System.Object.GetType() | no location |
|
||||
| Record.cs:4:1:10:1 | Person | System.Object.MemberwiseClone() | no location |
|
||||
| Record.cs:4:1:10:1 | Person | System.Object.Object() | no location |
|
||||
| Record.cs:4:1:10:1 | Person | System.Object.ReferenceEquals(object, object) | no location |
|
||||
| Record.cs:4:1:10:1 | Person | System.Object.~Object() | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | Person.!=(Person, Person) | Record.cs:4:15:4:20 |
|
||||
| Record.cs:12:1:18:1 | Teacher | Person.==(Person, Person) | Record.cs:4:15:4:20 |
|
||||
| Record.cs:12:1:18:1 | Teacher | Person.FirstName | Record.cs:7:19:7:27 |
|
||||
| Record.cs:12:1:18:1 | Teacher | Person.LastName | Record.cs:6:19:6:26 |
|
||||
| Record.cs:12:1:18:1 | Teacher | Person.Person(Person) | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | Person.Person(string, string) | Record.cs:9:12:9:17 |
|
||||
| Record.cs:12:1:18:1 | Teacher | System.Object.Equals(object, object) | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | System.Object.GetType() | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | System.Object.MemberwiseClone() | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | System.Object.Object() | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | System.Object.ReferenceEquals(object, object) | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | System.Object.~Object() | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.!=(Teacher, Teacher) | Record.cs:12:15:12:21 |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.<Clone>$() | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.==(Teacher, Teacher) | Record.cs:12:15:12:21 |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.EqualityContract | Record.cs:12:15:12:21 |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.Equals(Person) | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.Equals(Teacher) | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.Equals(object) | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.GetHashCode() | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.PrintMembers(StringBuilder) | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.Subject | Record.cs:14:19:14:25 |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.Teacher(Teacher) | no location |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.Teacher(string, string, string) | Record.cs:16:12:16:18 |
|
||||
| Record.cs:12:1:18:1 | Teacher | Teacher.ToString() | no location |
|
||||
| Record.cs:20:1:25:1 | Student | Person.!=(Person, Person) | Record.cs:4:15:4:20 |
|
||||
| Record.cs:20:1:25:1 | Student | Person.==(Person, Person) | Record.cs:4:15:4:20 |
|
||||
| Record.cs:20:1:25:1 | Student | Person.FirstName | Record.cs:7:19:7:27 |
|
||||
| Record.cs:20:1:25:1 | Student | Person.LastName | Record.cs:6:19:6:26 |
|
||||
| Record.cs:20:1:25:1 | Student | Person.Person(Person) | no location |
|
||||
| Record.cs:20:1:25:1 | Student | Person.Person(string, string) | Record.cs:9:12:9:17 |
|
||||
| Record.cs:20:1:25:1 | Student | Student.!=(Student, Student) | Record.cs:20:22:20:28 |
|
||||
| Record.cs:20:1:25:1 | Student | Student.<Clone>$() | no location |
|
||||
| Record.cs:20:1:25:1 | Student | Student.==(Student, Student) | Record.cs:20:22:20:28 |
|
||||
| Record.cs:20:1:25:1 | Student | Student.EqualityContract | Record.cs:20:22:20:28 |
|
||||
| Record.cs:20:1:25:1 | Student | Student.Equals(Person) | no location |
|
||||
| Record.cs:20:1:25:1 | Student | Student.Equals(Student) | no location |
|
||||
| Record.cs:20:1:25:1 | Student | Student.Equals(object) | no location |
|
||||
| Record.cs:20:1:25:1 | Student | Student.GetHashCode() | no location |
|
||||
| Record.cs:20:1:25:1 | Student | Student.Level | Record.cs:22:16:22:20 |
|
||||
| Record.cs:20:1:25:1 | Student | Student.PrintMembers(StringBuilder) | no location |
|
||||
| Record.cs:20:1:25:1 | Student | Student.Student(Student) | no location |
|
||||
| Record.cs:20:1:25:1 | Student | Student.Student(string, string, int) | Record.cs:24:12:24:18 |
|
||||
| Record.cs:20:1:25:1 | Student | Student.ToString() | no location |
|
||||
| Record.cs:20:1:25:1 | Student | System.Object.Equals(object, object) | no location |
|
||||
| Record.cs:20:1:25:1 | Student | System.Object.GetType() | no location |
|
||||
| Record.cs:20:1:25:1 | Student | System.Object.MemberwiseClone() | no location |
|
||||
| Record.cs:20:1:25:1 | Student | System.Object.Object() | no location |
|
||||
| Record.cs:20:1:25:1 | Student | System.Object.ReferenceEquals(object, object) | no location |
|
||||
| Record.cs:20:1:25:1 | Student | System.Object.~Object() | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.!=(Person1, Person1) | Record.cs:27:15:27:21 |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.<Clone>$() | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.==(Person1, Person1) | Record.cs:27:15:27:21 |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.Deconstruct(out string, out string) | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.EqualityContract | Record.cs:27:15:27:21 |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.Equals(Person1) | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.Equals(object) | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.FirstName | Record.cs:27:30:27:38 |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.GetHashCode() | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.LastName | Record.cs:27:48:27:55 |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.Person1(Person1) | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.Person1(string, string) | Record.cs:27:15:27:21 |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.PrintMembers(StringBuilder) | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | Person1.ToString() | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | System.Object.Equals(object, object) | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | System.Object.GetType() | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | System.Object.MemberwiseClone() | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | System.Object.Object() | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | System.Object.ReferenceEquals(object, object) | no location |
|
||||
| Record.cs:27:1:27:57 | Person1 | System.Object.~Object() | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Person1.!=(Person1, Person1) | Record.cs:27:15:27:21 |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Person1.==(Person1, Person1) | Record.cs:27:15:27:21 |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Person1.Deconstruct(out string, out string) | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Person1.FirstName | Record.cs:27:30:27:38 |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Person1.LastName | Record.cs:27:48:27:55 |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Person1.Person1(Person1) | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Person1.Person1(string, string) | Record.cs:27:15:27:21 |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | System.Object.Equals(object, object) | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | System.Object.GetType() | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | System.Object.MemberwiseClone() | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | System.Object.Object() | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | System.Object.ReferenceEquals(object, object) | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | System.Object.~Object() | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.!=(Teacher1, Teacher1) | Record.cs:29:15:29:22 |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.<Clone>$() | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.==(Teacher1, Teacher1) | Record.cs:29:15:29:22 |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.Deconstruct(out string, out string, out string) | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.EqualityContract | Record.cs:29:15:29:22 |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.Equals(Person1) | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.Equals(Teacher1) | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.Equals(object) | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.GetHashCode() | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.PrintMembers(StringBuilder) | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.Subject | Record.cs:29:66:29:72 |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.Teacher1(Teacher1) | no location |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.Teacher1(string, string, string) | Record.cs:29:15:29:22 |
|
||||
| Record.cs:29:1:30:35 | Teacher1 | Teacher1.ToString() | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | Person1.!=(Person1, Person1) | Record.cs:27:15:27:21 |
|
||||
| Record.cs:32:1:33:35 | Student1 | Person1.==(Person1, Person1) | Record.cs:27:15:27:21 |
|
||||
| Record.cs:32:1:33:35 | Student1 | Person1.Deconstruct(out string, out string) | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | Person1.FirstName | Record.cs:27:30:27:38 |
|
||||
| Record.cs:32:1:33:35 | Student1 | Person1.LastName | Record.cs:27:48:27:55 |
|
||||
| Record.cs:32:1:33:35 | Student1 | Person1.Person1(Person1) | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | Person1.Person1(string, string) | Record.cs:27:15:27:21 |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.!=(Student1, Student1) | Record.cs:32:22:32:29 |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.<Clone>$() | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.==(Student1, Student1) | Record.cs:32:22:32:29 |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.Deconstruct(out string, out string, out int) | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.EqualityContract | Record.cs:32:22:32:29 |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.Equals(Person1) | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.Equals(Student1) | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.Equals(object) | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.GetHashCode() | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.Level | Record.cs:32:70:32:74 |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.PrintMembers(StringBuilder) | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.Student1(Student1) | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.Student1(string, string, int) | Record.cs:32:22:32:29 |
|
||||
| Record.cs:32:1:33:35 | Student1 | Student1.ToString() | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | System.Object.Equals(object, object) | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | System.Object.GetType() | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | System.Object.MemberwiseClone() | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | System.Object.Object() | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | System.Object.ReferenceEquals(object, object) | no location |
|
||||
| Record.cs:32:1:33:35 | Student1 | System.Object.~Object() | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.!=(Pet, Pet) | Record.cs:35:15:35:17 |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.<Clone>$() | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.==(Pet, Pet) | Record.cs:35:15:35:17 |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.Deconstruct(out string) | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.EqualityContract | Record.cs:35:15:35:17 |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.Equals(Pet) | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.Equals(object) | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.GetHashCode() | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.Name | Record.cs:35:26:35:29 |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.Pet(Pet) | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.Pet(string) | Record.cs:35:15:35:17 |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.PrintMembers(StringBuilder) | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.ShredTheFurniture() | Record.cs:37:17:37:33 |
|
||||
| Record.cs:35:1:39:1 | Pet | Pet.ToString() | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | System.Object.Equals(object, object) | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | System.Object.GetType() | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | System.Object.MemberwiseClone() | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | System.Object.Object() | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | System.Object.ReferenceEquals(object, object) | no location |
|
||||
| Record.cs:35:1:39:1 | Pet | System.Object.~Object() | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.!=(Dog, Dog) | Record.cs:41:15:41:17 |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.<Clone>$() | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.==(Dog, Dog) | Record.cs:41:15:41:17 |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.Deconstruct(out string) | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.Dog(Dog) | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.Dog(string) | Record.cs:41:15:41:17 |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.EqualityContract | Record.cs:41:15:41:17 |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.Equals(Dog) | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.Equals(Pet) | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.Equals(object) | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.GetHashCode() | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.PrintMembers(StringBuilder) | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.ToString() | Record.cs:46:28:46:35 |
|
||||
| Record.cs:41:1:52:1 | Dog | Dog.WagTail() | Record.cs:43:17:43:23 |
|
||||
| Record.cs:41:1:52:1 | Dog | Pet.!=(Pet, Pet) | Record.cs:35:15:35:17 |
|
||||
| Record.cs:41:1:52:1 | Dog | Pet.==(Pet, Pet) | Record.cs:35:15:35:17 |
|
||||
| Record.cs:41:1:52:1 | Dog | Pet.Deconstruct(out string) | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | Pet.Name | Record.cs:35:26:35:29 |
|
||||
| Record.cs:41:1:52:1 | Dog | Pet.Pet(Pet) | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | Pet.Pet(string) | Record.cs:35:15:35:17 |
|
||||
| Record.cs:41:1:52:1 | Dog | Pet.ShredTheFurniture() | Record.cs:37:17:37:33 |
|
||||
| Record.cs:41:1:52:1 | Dog | System.Object.Equals(object, object) | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | System.Object.GetType() | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | System.Object.MemberwiseClone() | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | System.Object.Object() | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | System.Object.ReferenceEquals(object, object) | no location |
|
||||
| Record.cs:41:1:52:1 | Dog | System.Object.~Object() | no location |
|
||||
| Record.cs:54:14:54:20 | Record1 | Record1.M1() | Record.cs:56:17:56:18 |
|
||||
| Record.cs:54:14:54:20 | Record1 | Record1.M2() | Record.cs:64:17:64:18 |
|
||||
| Record.cs:54:14:54:20 | Record1 | Record1.Record1() | no location |
|
||||
| Record.cs:54:14:54:20 | Record1 | System.Object.Equals(object) | no location |
|
||||
| Record.cs:54:14:54:20 | Record1 | System.Object.Equals(object, object) | no location |
|
||||
| Record.cs:54:14:54:20 | Record1 | System.Object.GetHashCode() | no location |
|
||||
| Record.cs:54:14:54:20 | Record1 | System.Object.GetType() | no location |
|
||||
| Record.cs:54:14:54:20 | Record1 | System.Object.MemberwiseClone() | no location |
|
||||
| Record.cs:54:14:54:20 | Record1 | System.Object.Object() | no location |
|
||||
| Record.cs:54:14:54:20 | Record1 | System.Object.ReferenceEquals(object, object) | no location |
|
||||
| Record.cs:54:14:54:20 | Record1 | System.Object.ToString() | no location |
|
||||
| Record.cs:54:14:54:20 | Record1 | System.Object.~Object() | no location |
|
||||
18
csharp/ql/test/library-tests/csharp9/record.ql
Normal file
18
csharp/ql/test/library-tests/csharp9/record.ql
Normal file
@@ -0,0 +1,18 @@
|
||||
import csharp
|
||||
|
||||
query predicate types(Class t, string i) {
|
||||
t.getFile().getStem() = "Record" and
|
||||
t.getABaseInterface().toStringWithTypes() = i
|
||||
}
|
||||
|
||||
private string getMemberName(Member m) {
|
||||
result = m.getDeclaringType().getQualifiedName() + "." + m.toStringWithTypes()
|
||||
}
|
||||
|
||||
query predicate members(Class t, string ms, string l) {
|
||||
t.getFile().getStem() = "Record" and
|
||||
exists(Member m | t.hasMember(m) |
|
||||
ms = getMemberName(m) and
|
||||
if m.fromSource() then l = m.getLocation().toString() else l = "no location"
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user