mirror of
https://github.com/github/codeql.git
synced 2026-02-12 05:01:06 +01:00
Merge pull request #21220 from michaelnebel/csharp14/extension
C# 14: Support `extension` types.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
description: Remove the relation `extension_receiver_type` and remove the `extension_type` type kind.
|
||||
compatibility: backwards
|
||||
extension_receiver_type.rel: delete
|
||||
@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Semmle.Util;
|
||||
using Semmle.Extraction.CSharp.Entities;
|
||||
|
||||
namespace Semmle.Extraction.CSharp
|
||||
@@ -164,6 +165,7 @@ namespace Semmle.Extraction.CSharp
|
||||
case TypeKind.Enum:
|
||||
case TypeKind.Delegate:
|
||||
case TypeKind.Error:
|
||||
case TypeKind.Extension:
|
||||
var named = (INamedTypeSymbol)type;
|
||||
named.BuildNamedTypeId(cx, trapFile, symbolBeingDefined, constructUnderlyingTupleType);
|
||||
return;
|
||||
@@ -275,6 +277,20 @@ namespace Semmle.Extraction.CSharp
|
||||
public static IEnumerable<IFieldSymbol?> GetTupleElementsMaybeNull(this INamedTypeSymbol type) =>
|
||||
type.TupleElements;
|
||||
|
||||
private static void BuildExtensionTypeId(this INamedTypeSymbol named, Context cx, EscapingTextWriter trapFile)
|
||||
{
|
||||
trapFile.Write("extension(");
|
||||
if (named.ExtensionMarkerName is not null)
|
||||
{
|
||||
trapFile.Write(named.ExtensionMarkerName);
|
||||
}
|
||||
else
|
||||
{
|
||||
trapFile.Write("unknown");
|
||||
}
|
||||
trapFile.Write(")");
|
||||
}
|
||||
|
||||
private static void BuildQualifierAndName(INamedTypeSymbol named, Context cx, EscapingTextWriter trapFile, ISymbol symbolBeingDefined)
|
||||
{
|
||||
if (named.ContainingType is not null)
|
||||
@@ -289,8 +305,18 @@ namespace Semmle.Extraction.CSharp
|
||||
named.ContainingNamespace.BuildNamespace(cx, trapFile);
|
||||
}
|
||||
|
||||
var name = named.IsFileLocal ? named.MetadataName : named.Name;
|
||||
trapFile.Write(name);
|
||||
if (named.IsFileLocal)
|
||||
{
|
||||
trapFile.Write(named.MetadataName);
|
||||
}
|
||||
else if (named.IsExtension)
|
||||
{
|
||||
named.BuildExtensionTypeId(cx, trapFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
trapFile.Write(named.Name);
|
||||
}
|
||||
}
|
||||
|
||||
private static void BuildTupleId(INamedTypeSymbol named, Context cx, EscapingTextWriter trapFile, ISymbol symbolBeingDefined)
|
||||
@@ -391,6 +417,7 @@ namespace Semmle.Extraction.CSharp
|
||||
case TypeKind.Enum:
|
||||
case TypeKind.Delegate:
|
||||
case TypeKind.Error:
|
||||
case TypeKind.Extension:
|
||||
var named = (INamedTypeSymbol)type;
|
||||
named.BuildNamedTypeDisplayName(cx, trapFile, constructUnderlyingTupleType);
|
||||
return;
|
||||
@@ -465,6 +492,20 @@ namespace Semmle.Extraction.CSharp
|
||||
private static void BuildFunctionPointerTypeDisplayName(this IFunctionPointerTypeSymbol funptr, Context cx, TextWriter trapFile) =>
|
||||
BuildFunctionPointerSignature(funptr, trapFile, s => s.BuildDisplayName(cx, trapFile));
|
||||
|
||||
private static void BuildExtensionTypeDisplayName(this INamedTypeSymbol named, Context cx, TextWriter trapFile)
|
||||
{
|
||||
trapFile.Write("extension(");
|
||||
if (named.ExtensionParameter?.Type is ITypeSymbol type)
|
||||
{
|
||||
type.BuildDisplayName(cx, trapFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
trapFile.Write("unknown");
|
||||
}
|
||||
trapFile.Write(")");
|
||||
}
|
||||
|
||||
private static void BuildNamedTypeDisplayName(this INamedTypeSymbol namedType, Context cx, TextWriter trapFile, bool constructUnderlyingTupleType)
|
||||
{
|
||||
if (!constructUnderlyingTupleType && namedType.IsTupleType)
|
||||
@@ -484,6 +525,12 @@ namespace Semmle.Extraction.CSharp
|
||||
return;
|
||||
}
|
||||
|
||||
if (namedType.IsExtension)
|
||||
{
|
||||
namedType.BuildExtensionTypeDisplayName(cx, trapFile);
|
||||
return;
|
||||
}
|
||||
|
||||
if (namedType.IsAnonymousType)
|
||||
{
|
||||
namedType.BuildAnonymousName(cx, trapFile);
|
||||
@@ -596,6 +643,84 @@ namespace Semmle.Extraction.CSharp
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return true if this method is a compiler-generated extension method.
|
||||
/// </summary>
|
||||
public static bool IsCompilerGeneratedExtensionMethod(this IMethodSymbol method) =>
|
||||
method.TryGetExtensionMethod() is not null;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the extension method corresponding to this compiler-generated extension method, if it exists.
|
||||
/// </summary>
|
||||
public static IMethodSymbol? TryGetExtensionMethod(this IMethodSymbol method)
|
||||
{
|
||||
if (method.IsImplicitlyDeclared && method.ContainingSymbol is INamedTypeSymbol containingType)
|
||||
{
|
||||
// Extension types are declared within the same type as the generated
|
||||
// extension method implementation.
|
||||
var extensions = containingType.GetMembers()
|
||||
.OfType<INamedTypeSymbol>()
|
||||
.Where(t => t.IsExtension);
|
||||
// Find the (possibly unbound) original extension method that maps to this implementation (if any).
|
||||
var unboundDeclaration = extensions.SelectMany(e => e.GetMembers())
|
||||
.OfType<IMethodSymbol>()
|
||||
.FirstOrDefault(m => SymbolEqualityComparer.Default.Equals(m.AssociatedExtensionImplementation, method.ConstructedFrom));
|
||||
|
||||
var isFullyConstructed = method.IsBoundGenericMethod();
|
||||
if (isFullyConstructed && unboundDeclaration?.ContainingType is INamedTypeSymbol extensionType)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Use the type arguments from the constructed extension method to construct the extension type.
|
||||
var arguments = method.TypeArguments.ToArray();
|
||||
var (extensionTypeArguments, extensionMethodArguments) = arguments.SplitAt(extensionType.TypeParameters.Length);
|
||||
|
||||
// Construct the extension type.
|
||||
var boundExtensionType = extensionType.IsUnboundGenericType()
|
||||
? extensionType.Construct(extensionTypeArguments.ToArray())
|
||||
: extensionType;
|
||||
|
||||
// Find the extension method declaration within the constructed extension type.
|
||||
var extensionDeclaration = boundExtensionType.GetMembers()
|
||||
.OfType<IMethodSymbol>()
|
||||
.First(c => SymbolEqualityComparer.Default.Equals(c.OriginalDefinition, unboundDeclaration));
|
||||
|
||||
// If the extension declaration is unbound apply the remaning type arguments and construct it.
|
||||
return extensionDeclaration.IsUnboundGenericMethod()
|
||||
? extensionDeclaration.Construct(extensionMethodArguments.ToArray())
|
||||
: extensionDeclaration;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// If anything goes wrong, fall back to the unbound declaration.
|
||||
return unboundDeclaration;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return unboundDeclaration;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this method is an unbound generic method.
|
||||
/// </summary>
|
||||
public static bool IsUnboundGenericMethod(this IMethodSymbol method) =>
|
||||
method.IsGenericMethod && SymbolEqualityComparer.Default.Equals(method.ConstructedFrom, method);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this method is a bound generic method.
|
||||
/// </summary>
|
||||
public static bool IsBoundGenericMethod(this IMethodSymbol method) => method.IsGenericMethod && !method.IsUnboundGenericMethod();
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this type is an unbound generic type.
|
||||
/// </summary>
|
||||
public static bool IsUnboundGenericType(this INamedTypeSymbol type) =>
|
||||
type.IsGenericType && SymbolEqualityComparer.Default.Equals(type.ConstructedFrom, type);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base type of `symbol`. Unlike `symbol.BaseType`, this excludes effective base
|
||||
/// types of type parameters as well as `object` base types.
|
||||
@@ -692,5 +817,35 @@ namespace Semmle.Extraction.CSharp
|
||||
/// </summary>
|
||||
public static IEnumerable<T> ExtractionCandidates<T>(this IEnumerable<T> symbols) where T : ISymbol =>
|
||||
symbols.Where(symbol => symbol.ShouldExtractSymbol());
|
||||
|
||||
/// <summary>
|
||||
/// Returns the parameter kind for this parameter symbol, e.g. `ref`, `out`, `params`, etc.
|
||||
/// </summary>
|
||||
public static Parameter.Kind GetParameterKind(this IParameterSymbol parameter)
|
||||
{
|
||||
switch (parameter.RefKind)
|
||||
{
|
||||
case RefKind.Out:
|
||||
return Parameter.Kind.Out;
|
||||
case RefKind.Ref:
|
||||
return Parameter.Kind.Ref;
|
||||
case RefKind.In:
|
||||
return Parameter.Kind.In;
|
||||
case RefKind.RefReadOnlyParameter:
|
||||
return Parameter.Kind.RefReadOnly;
|
||||
default:
|
||||
if (parameter.IsParams)
|
||||
return Parameter.Kind.Params;
|
||||
|
||||
if (parameter.Ordinal == 0)
|
||||
{
|
||||
if (parameter.ContainingSymbol is IMethodSymbol method && method.IsExtensionMethod)
|
||||
{
|
||||
return Parameter.Kind.This;
|
||||
}
|
||||
}
|
||||
return Parameter.Kind.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,22 +54,6 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
}
|
||||
}
|
||||
|
||||
protected static void WriteLocationToTrap<T1>(Action<T1, Location> writeAction, T1 entity, Location l)
|
||||
{
|
||||
if (l is not EmptyLocation)
|
||||
{
|
||||
writeAction(entity, l);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void WriteLocationsToTrap<T1>(Action<T1, Location> writeAction, T1 entity, IEnumerable<Location> locations)
|
||||
{
|
||||
foreach (var loc in locations)
|
||||
{
|
||||
WriteLocationToTrap(writeAction, entity, loc);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool NeedsPopulation { get; }
|
||||
|
||||
public override int GetHashCode() => Symbol is null ? 0 : Symbol.GetHashCode();
|
||||
|
||||
@@ -32,32 +32,6 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
Attribute.ExtractAttributes(Context, Symbol, this);
|
||||
}
|
||||
|
||||
protected void PopulateNullability(TextWriter trapFile, AnnotatedTypeSymbol type)
|
||||
{
|
||||
var n = NullabilityEntity.Create(Context, Nullability.Create(type));
|
||||
if (!type.HasObliviousNullability())
|
||||
{
|
||||
trapFile.type_nullability(this, n);
|
||||
}
|
||||
}
|
||||
|
||||
protected void PopulateRefKind(TextWriter trapFile, RefKind kind)
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
case RefKind.Out:
|
||||
trapFile.type_annotation(this, Kinds.TypeAnnotation.Out);
|
||||
break;
|
||||
case RefKind.Ref:
|
||||
trapFile.type_annotation(this, Kinds.TypeAnnotation.Ref);
|
||||
break;
|
||||
case RefKind.RefReadOnly:
|
||||
case RefKind.RefReadOnlyParameter:
|
||||
trapFile.type_annotation(this, Kinds.TypeAnnotation.ReadonlyRef);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void PopulateScopedKind(TextWriter trapFile, ScopedKind kind)
|
||||
{
|
||||
switch (kind)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Semmle.Extraction.CSharp.Entities;
|
||||
|
||||
namespace Semmle.Extraction.CSharp
|
||||
{
|
||||
@@ -24,7 +26,7 @@ namespace Semmle.Extraction.CSharp
|
||||
trapFile.WriteUnescaped('\"');
|
||||
}
|
||||
|
||||
public abstract Location? ReportingLocation { get; }
|
||||
public abstract Microsoft.CodeAnalysis.Location? ReportingLocation { get; }
|
||||
|
||||
public abstract TrapStackBehaviour TrapStackBehaviour { get; }
|
||||
|
||||
@@ -65,6 +67,48 @@ namespace Semmle.Extraction.CSharp
|
||||
}
|
||||
#endif
|
||||
|
||||
protected void PopulateRefKind(TextWriter trapFile, RefKind kind)
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
case RefKind.Out:
|
||||
trapFile.type_annotation(this, Kinds.TypeAnnotation.Out);
|
||||
break;
|
||||
case RefKind.Ref:
|
||||
trapFile.type_annotation(this, Kinds.TypeAnnotation.Ref);
|
||||
break;
|
||||
case RefKind.RefReadOnly:
|
||||
case RefKind.RefReadOnlyParameter:
|
||||
trapFile.type_annotation(this, Kinds.TypeAnnotation.ReadonlyRef);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void PopulateNullability(TextWriter trapFile, AnnotatedTypeSymbol type)
|
||||
{
|
||||
var n = NullabilityEntity.Create(Context, Nullability.Create(type));
|
||||
if (!type.HasObliviousNullability())
|
||||
{
|
||||
trapFile.type_nullability(this, n);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void WriteLocationToTrap<T1>(Action<T1, Entities.Location> writeAction, T1 entity, Entities.Location l)
|
||||
{
|
||||
if (l is not EmptyLocation)
|
||||
{
|
||||
writeAction(entity, l);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void WriteLocationsToTrap<T1>(Action<T1, Entities.Location> writeAction, T1 entity, IEnumerable<Entities.Location> locations)
|
||||
{
|
||||
foreach (var loc in locations)
|
||||
{
|
||||
WriteLocationToTrap(writeAction, entity, loc);
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() => Label.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,16 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
private bool IsExplicitDelegateInvokeCall() => Kind == ExprKind.DELEGATE_INVOCATION && Context.GetModel(Syntax.Expression).GetSymbolInfo(Syntax.Expression).Symbol is IMethodSymbol m && m.MethodKind == MethodKind.DelegateInvoke;
|
||||
|
||||
private bool IsOperatorCall() => Kind == ExprKind.OPERATOR_INVOCATION;
|
||||
|
||||
private bool IsValidMemberAccessKind()
|
||||
{
|
||||
return Kind == ExprKind.METHOD_INVOCATION ||
|
||||
IsEventDelegateCall() ||
|
||||
IsExplicitDelegateInvokeCall() ||
|
||||
IsOperatorCall();
|
||||
}
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
if (IsNameof(Syntax))
|
||||
@@ -37,7 +47,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
var target = TargetSymbol;
|
||||
switch (Syntax.Expression)
|
||||
{
|
||||
case MemberAccessExpressionSyntax memberAccess when Kind == ExprKind.METHOD_INVOCATION || IsEventDelegateCall() || IsExplicitDelegateInvokeCall():
|
||||
case MemberAccessExpressionSyntax memberAccess when IsValidMemberAccessKind():
|
||||
memberName = memberAccess.Name.Identifier.Text;
|
||||
if (Syntax.Expression.Kind() == SyntaxKind.SimpleMemberAccessExpression)
|
||||
// Qualified method call; `x.M()`
|
||||
@@ -113,14 +123,24 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
public SymbolInfo SymbolInfo => info.SymbolInfo;
|
||||
|
||||
private static bool IsOperatorLikeCall(ExpressionNodeInfo info)
|
||||
{
|
||||
return info.SymbolInfo.Symbol is IMethodSymbol method &&
|
||||
method.TryGetExtensionMethod()?.MethodKind == MethodKind.UserDefinedOperator;
|
||||
}
|
||||
|
||||
public IMethodSymbol? TargetSymbol
|
||||
{
|
||||
get
|
||||
{
|
||||
var si = SymbolInfo;
|
||||
|
||||
if (si.Symbol is not null)
|
||||
return si.Symbol as IMethodSymbol;
|
||||
if (si.Symbol is ISymbol symbol)
|
||||
{
|
||||
var method = symbol as IMethodSymbol;
|
||||
// Case for compiler-generated extension methods.
|
||||
return method?.TryGetExtensionMethod() ?? method;
|
||||
}
|
||||
|
||||
if (si.CandidateReason == CandidateReason.OverloadResolutionFailure)
|
||||
{
|
||||
@@ -196,15 +216,25 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
private static ExprKind GetKind(ExpressionNodeInfo info)
|
||||
{
|
||||
return IsNameof((InvocationExpressionSyntax)info.Node)
|
||||
? ExprKind.NAMEOF
|
||||
: IsDelegateLikeCall(info)
|
||||
? IsDelegateInvokeCall(info)
|
||||
? ExprKind.DELEGATE_INVOCATION
|
||||
: ExprKind.FUNCTION_POINTER_INVOCATION
|
||||
: IsLocalFunctionInvocation(info)
|
||||
? ExprKind.LOCAL_FUNCTION_INVOCATION
|
||||
: ExprKind.METHOD_INVOCATION;
|
||||
if (IsNameof((InvocationExpressionSyntax)info.Node))
|
||||
{
|
||||
return ExprKind.NAMEOF;
|
||||
}
|
||||
if (IsDelegateLikeCall(info))
|
||||
{
|
||||
return IsDelegateInvokeCall(info)
|
||||
? ExprKind.DELEGATE_INVOCATION
|
||||
: ExprKind.FUNCTION_POINTER_INVOCATION;
|
||||
}
|
||||
if (IsLocalFunctionInvocation(info))
|
||||
{
|
||||
return ExprKind.LOCAL_FUNCTION_INVOCATION;
|
||||
}
|
||||
if (IsOperatorLikeCall(info))
|
||||
{
|
||||
return ExprKind.OPERATOR_INVOCATION;
|
||||
}
|
||||
return ExprKind.METHOD_INVOCATION;
|
||||
}
|
||||
|
||||
private static bool IsNameof(InvocationExpressionSyntax syntax)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Marker interface for parameter entities.
|
||||
/// </summary>
|
||||
internal interface IParameter : IEntity
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,28 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
protected Method(Context cx, IMethodSymbol init)
|
||||
: base(cx, init) { }
|
||||
|
||||
private SyntheticExtensionParameter? SyntheticParameter { get; set; }
|
||||
|
||||
private int SynthesizeExtensionParameter()
|
||||
{
|
||||
// Synthesize implicit parameter for extension methods declared using extension(...) syntax.
|
||||
if (Symbol.ContainingSymbol is INamedTypeSymbol type &&
|
||||
type.IsExtension && type.ExtensionParameter is IParameterSymbol parameter &&
|
||||
!string.IsNullOrEmpty(parameter.Name) && !Symbol.IsStatic)
|
||||
{
|
||||
var originalSyntheticParam = OriginalDefinition.SyntheticParameter;
|
||||
SyntheticParameter = SyntheticExtensionParameter.Create(Context, this, parameter, originalSyntheticParam);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected void PopulateParameters()
|
||||
{
|
||||
var originalMethod = OriginalDefinition;
|
||||
var positionOffset = SynthesizeExtensionParameter();
|
||||
|
||||
IEnumerable<IParameterSymbol> parameters = Symbol.Parameters;
|
||||
IEnumerable<IParameterSymbol> originalParameters = originalMethod.Symbol.Parameters;
|
||||
|
||||
@@ -24,8 +43,8 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
var original = SymbolEqualityComparer.Default.Equals(p.paramSymbol, p.originalParam)
|
||||
? null
|
||||
: Parameter.Create(Context, p.originalParam, originalMethod);
|
||||
Parameter.Create(Context, p.paramSymbol, this, original);
|
||||
: Parameter.Create(Context, p.originalParam, originalMethod, null, positionOffset);
|
||||
Parameter.Create(Context, p.paramSymbol, this, original, positionOffset);
|
||||
}
|
||||
|
||||
if (Symbol.IsVararg)
|
||||
@@ -302,9 +321,9 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
/// <summary>
|
||||
/// Whether this method has unbound type parameters.
|
||||
/// </summary>
|
||||
public bool IsUnboundGeneric => IsGeneric && SymbolEqualityComparer.Default.Equals(Symbol.ConstructedFrom, Symbol);
|
||||
public bool IsUnboundGeneric => Symbol.IsUnboundGenericMethod();
|
||||
|
||||
public bool IsBoundGeneric => IsGeneric && !IsUnboundGeneric;
|
||||
public bool IsBoundGeneric => Symbol.IsBoundGenericMethod();
|
||||
|
||||
protected IMethodSymbol ConstructedFromSymbol => Symbol.ConstructedFrom;
|
||||
|
||||
|
||||
@@ -23,7 +23,11 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
? Symbol.ContainingType.GetSymbolLocation()
|
||||
: BodyDeclaringSymbol.GetSymbolLocation();
|
||||
|
||||
public override bool NeedsPopulation => base.NeedsPopulation || IsCompilerGeneratedDelegate();
|
||||
public override bool NeedsPopulation =>
|
||||
(base.NeedsPopulation || IsCompilerGeneratedDelegate()) &&
|
||||
// Exclude compiler-generated extension methods. A call to such a method
|
||||
// is replaced by a call to the defining extension method.
|
||||
!Symbol.IsCompilerGeneratedExtensionMethod();
|
||||
|
||||
public override void Populate(TextWriter trapFile)
|
||||
{
|
||||
|
||||
@@ -7,16 +7,23 @@ using Semmle.Extraction.CSharp.Populators;
|
||||
|
||||
namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
internal class Parameter : CachedSymbol<IParameterSymbol>, IExpressionParentEntity
|
||||
internal class Parameter : CachedSymbol<IParameterSymbol>, IExpressionParentEntity, IParameter
|
||||
{
|
||||
protected IEntity? Parent { get; set; }
|
||||
protected Parameter Original { get; }
|
||||
private int PositionOffset { get; set; }
|
||||
|
||||
protected Parameter(Context cx, IParameterSymbol init, IEntity? parent, Parameter? original)
|
||||
private Parameter(Context cx, IParameterSymbol init, IEntity? parent, Parameter? original, int positionOffset)
|
||||
: base(cx, init)
|
||||
{
|
||||
Parent = parent;
|
||||
Original = original ?? this;
|
||||
PositionOffset = positionOffset;
|
||||
}
|
||||
|
||||
protected Parameter(Context cx, IParameterSymbol init, IEntity? parent, Parameter? original)
|
||||
: this(cx, init, parent, original, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public override Microsoft.CodeAnalysis.Location ReportingLocation => Symbol.GetSymbolLocation();
|
||||
@@ -32,46 +39,18 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
RefReadOnly = 6
|
||||
}
|
||||
|
||||
protected virtual int Ordinal => Symbol.Ordinal;
|
||||
protected virtual int Ordinal => Symbol.Ordinal + PositionOffset;
|
||||
|
||||
private Kind ParamKind
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (Symbol.RefKind)
|
||||
{
|
||||
case RefKind.Out:
|
||||
return Kind.Out;
|
||||
case RefKind.Ref:
|
||||
return Kind.Ref;
|
||||
case RefKind.In:
|
||||
return Kind.In;
|
||||
case RefKind.RefReadOnlyParameter:
|
||||
return Kind.RefReadOnly;
|
||||
default:
|
||||
if (Symbol.IsParams)
|
||||
return Kind.Params;
|
||||
|
||||
if (Ordinal == 0)
|
||||
{
|
||||
if (Symbol.ContainingSymbol is IMethodSymbol method && method.IsExtensionMethod)
|
||||
return Kind.This;
|
||||
}
|
||||
return Kind.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Parameter Create(Context cx, IParameterSymbol param, IEntity parent, Parameter? original = null)
|
||||
public static Parameter Create(Context cx, IParameterSymbol param, IEntity parent, Parameter? original = null, int positionOffset = 0)
|
||||
{
|
||||
var cachedSymbol = cx.GetPossiblyCachedParameterSymbol(param);
|
||||
return ParameterFactory.Instance.CreateEntity(cx, cachedSymbol, (cachedSymbol, parent, original));
|
||||
return ParameterFactory.Instance.CreateEntity(cx, cachedSymbol, (cachedSymbol, parent, original, positionOffset));
|
||||
}
|
||||
|
||||
public static Parameter Create(Context cx, IParameterSymbol param)
|
||||
{
|
||||
var cachedSymbol = cx.GetPossiblyCachedParameterSymbol(param);
|
||||
return ParameterFactory.Instance.CreateEntity(cx, cachedSymbol, (cachedSymbol, null, null));
|
||||
return ParameterFactory.Instance.CreateEntity(cx, cachedSymbol, (cachedSymbol, null, null, 0));
|
||||
}
|
||||
|
||||
public override void WriteId(EscapingTextWriter trapFile)
|
||||
@@ -79,6 +58,9 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
if (Parent is null)
|
||||
Parent = Method.Create(Context, Symbol.ContainingSymbol as IMethodSymbol);
|
||||
|
||||
if (Parent is null && Symbol.ContainingSymbol is INamedTypeSymbol type && type.IsExtension)
|
||||
Parent = Type.Create(Context, type);
|
||||
|
||||
if (Parent is null)
|
||||
throw new InternalError(Symbol, "Couldn't get parent of symbol.");
|
||||
|
||||
@@ -113,7 +95,8 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
Context.ModelError(Symbol, "Inconsistent parameter declaration");
|
||||
|
||||
var type = Type.Create(Context, Symbol.Type);
|
||||
trapFile.@params(this, Name, type.TypeRef, Ordinal, ParamKind, Parent!, Original);
|
||||
var kind = Symbol.GetParameterKind();
|
||||
trapFile.@params(this, Name, type.TypeRef, Ordinal, kind, Parent!, Original);
|
||||
|
||||
if (Context.OnlyScaffold)
|
||||
{
|
||||
@@ -194,11 +177,11 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
return syntax?.Default;
|
||||
}
|
||||
|
||||
private class ParameterFactory : CachedEntityFactory<(IParameterSymbol, IEntity?, Parameter?), Parameter>
|
||||
private class ParameterFactory : CachedEntityFactory<(IParameterSymbol, IEntity?, Parameter?, int), Parameter>
|
||||
{
|
||||
public static ParameterFactory Instance { get; } = new ParameterFactory();
|
||||
|
||||
public override Parameter Create(Context cx, (IParameterSymbol, IEntity?, Parameter?) init) => new Parameter(cx, init.Item1, init.Item2, init.Item3);
|
||||
public override Parameter Create(Context cx, (IParameterSymbol, IEntity?, Parameter?, int) init) => new Parameter(cx, init.Item1, init.Item2, init.Item3, init.Item4);
|
||||
}
|
||||
|
||||
public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.OptionalLabel;
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Synthetic parameter for extension methods declared using the extension syntax.
|
||||
/// That is, we add a synthetic parameter `s` to `IsValid` in the following example:
|
||||
/// extension(string s) {
|
||||
/// public bool IsValid() { ... }
|
||||
/// }
|
||||
///
|
||||
/// Note, that we use the characteristics of the parameter of the extension type
|
||||
/// to populate the database.
|
||||
/// </summary>
|
||||
internal class SyntheticExtensionParameter : FreshEntity, IParameter
|
||||
{
|
||||
private Method ExtensionMethod { get; }
|
||||
private IParameterSymbol ExtensionParameter { get; }
|
||||
private SyntheticExtensionParameter Original { get; }
|
||||
|
||||
private SyntheticExtensionParameter(Context cx, Method method, IParameterSymbol parameter, SyntheticExtensionParameter? original) : base(cx)
|
||||
{
|
||||
ExtensionMethod = method;
|
||||
ExtensionParameter = parameter;
|
||||
Original = original ?? this;
|
||||
}
|
||||
|
||||
private static int Ordinal => 0;
|
||||
|
||||
private string Name => ExtensionParameter.Name;
|
||||
|
||||
private bool IsSourceDeclaration => ExtensionMethod.Symbol.IsSourceDeclaration();
|
||||
|
||||
protected override void Populate(TextWriter trapFile)
|
||||
{
|
||||
PopulateNullability(trapFile, ExtensionParameter.GetAnnotatedType());
|
||||
PopulateRefKind(trapFile, ExtensionParameter.RefKind);
|
||||
|
||||
var type = Type.Create(Context, ExtensionParameter.Type);
|
||||
var kind = ExtensionParameter.GetParameterKind();
|
||||
trapFile.@params(this, Name, type.TypeRef, Ordinal, kind, ExtensionMethod, Original);
|
||||
|
||||
if (Context.OnlyScaffold)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Context.ExtractLocation(ExtensionParameter))
|
||||
{
|
||||
var locations = Context.GetLocations(ExtensionParameter);
|
||||
WriteLocationsToTrap(trapFile.param_location, this, locations);
|
||||
}
|
||||
|
||||
if (IsSourceDeclaration)
|
||||
{
|
||||
foreach (var syntax in ExtensionParameter.DeclaringSyntaxReferences
|
||||
.Select(d => d.GetSyntax())
|
||||
.OfType<ParameterSyntax>()
|
||||
.Where(s => s.Type is not null))
|
||||
{
|
||||
TypeMention.Create(Context, syntax.Type!, this, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static SyntheticExtensionParameter Create(Context cx, Method method, IParameterSymbol parameter, SyntheticExtensionParameter? original)
|
||||
{
|
||||
var p = new SyntheticExtensionParameter(cx, method, parameter, original);
|
||||
p.TryPopulate();
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,6 +20,8 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
public static NamedType Create(Context cx, INamedTypeSymbol type) =>
|
||||
NamedTypeFactory.Instance.CreateEntityFromSymbol(cx, type);
|
||||
|
||||
public NamedType OriginalDefinition => Create(Context, Symbol.OriginalDefinition);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a named type entity from a tuple type. Unlike <see cref="Create"/>, this
|
||||
/// will create an entity for the underlying `System.ValueTuple` struct.
|
||||
@@ -90,6 +92,25 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
trapFile.anonymous_types(this);
|
||||
}
|
||||
|
||||
if (Symbol.IsExtension && Symbol.ExtensionParameter is IParameterSymbol parameter)
|
||||
{
|
||||
// For some reason an extension type has a receiver parameter with an empty name
|
||||
// even when there is no parameter.
|
||||
if (!string.IsNullOrEmpty(parameter.Name))
|
||||
{
|
||||
var originalType = OriginalDefinition;
|
||||
// In case this is a constructed generic, we also need to create the unbound parameter.
|
||||
var originalParameter = SymbolEqualityComparer.Default.Equals(Symbol, originalType.Symbol.ExtensionParameter) || originalType.Symbol.ExtensionParameter is null
|
||||
? null
|
||||
: Parameter.Create(Context, originalType.Symbol.ExtensionParameter, originalType);
|
||||
Parameter.Create(Context, parameter, this, originalParameter);
|
||||
}
|
||||
|
||||
// Use the parameter type as the receiver type.
|
||||
var receiverType = Type.Create(Context, parameter.Type).TypeRef;
|
||||
trapFile.extension_receiver_type(this, receiverType);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Lazy<Type[]> typeArgumentsLazy;
|
||||
|
||||
@@ -105,6 +105,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
case TypeKind.Pointer: return Kinds.TypeKind.POINTER;
|
||||
case TypeKind.FunctionPointer: return Kinds.TypeKind.FUNCTION_POINTER;
|
||||
case TypeKind.Error: return Kinds.TypeKind.UNKNOWN;
|
||||
case TypeKind.Extension: return Kinds.TypeKind.EXTENSION;
|
||||
default:
|
||||
cx.ModelError(Symbol, $"Unhandled type kind '{Symbol.TypeKind}'");
|
||||
return Kinds.TypeKind.UNKNOWN;
|
||||
@@ -366,7 +367,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
private DelegateTypeParameter(Context cx, IParameterSymbol init, IEntity parent, Parameter? original)
|
||||
: base(cx, init, parent, original) { }
|
||||
|
||||
public static new DelegateTypeParameter Create(Context cx, IParameterSymbol param, IEntity parent, Parameter? original = null) =>
|
||||
public static DelegateTypeParameter Create(Context cx, IParameterSymbol param, IEntity parent, Parameter? original = null) =>
|
||||
// We need to use a different cache key than `param` to avoid mixing up
|
||||
// `DelegateTypeParameter`s and `Parameter`s
|
||||
DelegateTypeParameterFactory.Instance.CreateEntity(cx, (typeof(DelegateTypeParameter), new SymbolEqualityWrapper(param)), (param, parent, original));
|
||||
|
||||
@@ -38,5 +38,6 @@ namespace Semmle.Extraction.Kinds
|
||||
TUPLE = 32,
|
||||
FUNCTION_POINTER = 33,
|
||||
INLINE_ARRAY = 34,
|
||||
EXTENSION = 35
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,6 +202,9 @@ namespace Semmle.Extraction.CSharp
|
||||
internal static void extend(this TextWriter trapFile, Type type, Type super) =>
|
||||
trapFile.WriteTuple("extend", type, super);
|
||||
|
||||
internal static void extension_receiver_type(this TextWriter trapFile, Type @extension, Type receiverType) =>
|
||||
trapFile.WriteTuple("extension_receiver_type", extension, receiverType);
|
||||
|
||||
internal static void anonymous_types(this TextWriter trapFile, Type type) =>
|
||||
trapFile.WriteTuple("anonymous_types", type);
|
||||
|
||||
@@ -292,10 +295,10 @@ namespace Semmle.Extraction.CSharp
|
||||
internal static void overrides(this TextWriter trapFile, Method overriding, Method overridden) =>
|
||||
trapFile.WriteTuple("overrides", overriding, overridden);
|
||||
|
||||
internal static void param_location(this TextWriter trapFile, Parameter param, Location location) =>
|
||||
internal static void param_location(this TextWriter trapFile, IParameter param, Location location) =>
|
||||
trapFile.WriteTuple("param_location", param, location);
|
||||
|
||||
internal static void @params(this TextWriter trapFile, Parameter param, string name, Type type, int child, Parameter.Kind mode, IEntity method, Parameter originalDefinition) =>
|
||||
internal static void @params(this TextWriter trapFile, IParameter param, string name, Type type, int child, Parameter.Kind mode, IEntity method, IParameter originalDefinition) =>
|
||||
trapFile.WriteTuple("params", param, name, type, child, (int)mode, method, originalDefinition);
|
||||
|
||||
internal static void parent_namespace(this TextWriter trapFile, IEntity type, Namespace parent) =>
|
||||
|
||||
@@ -119,5 +119,28 @@ namespace Semmle.Util
|
||||
/// </summary>
|
||||
public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T?> items) where T : class =>
|
||||
items.Where(i => i is not null)!;
|
||||
|
||||
/// <summary>
|
||||
/// Splits the sequence at the given index.
|
||||
/// </summary>
|
||||
public static (IEnumerable<T>, IEnumerable<T>) SplitAt<T>(this IEnumerable<T> items, int index)
|
||||
{
|
||||
var left = new List<T>();
|
||||
var right = new List<T>();
|
||||
var i = 0;
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (i < index)
|
||||
{
|
||||
left.Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
right.Add(item);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (left, right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
csharp/ql/lib/change-notes/2026-02-05-extension-types.md
Normal file
4
csharp/ql/lib/change-notes/2026-02-05-extension-types.md
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* C# 14: Added support for `extension` members in the extractor, QL library, data flow, and Models as Data, covering extension methods, properties, and operators.
|
||||
@@ -10,6 +10,7 @@ import exprs.Call
|
||||
private import commons.QualifiedName
|
||||
private import commons.Collections
|
||||
private import semmle.code.csharp.ExprOrStmtParent
|
||||
private import semmle.code.csharp.internal.Callable
|
||||
private import semmle.code.csharp.metrics.Complexity
|
||||
private import TypeRef
|
||||
|
||||
@@ -223,6 +224,8 @@ class Callable extends Parameterizable, ExprOrStmtParent, @callable {
|
||||
Call getACall() { this = result.getTarget() }
|
||||
}
|
||||
|
||||
final class ExtensionCallable = ExtensionCallableImpl;
|
||||
|
||||
/**
|
||||
* A method, for example
|
||||
*
|
||||
@@ -267,8 +270,11 @@ class Method extends Callable, Virtualizable, Attributable, @method {
|
||||
|
||||
override Location getALocation() { method_location(this.getUnboundDeclaration(), result) }
|
||||
|
||||
/** Holds if this method is a classic extension method. */
|
||||
predicate isClassicExtensionMethod() { this.getParameter(0).hasExtensionMethodModifier() }
|
||||
|
||||
/** Holds if this method is an extension method. */
|
||||
predicate isExtensionMethod() { this.getParameter(0).hasExtensionMethodModifier() }
|
||||
predicate isExtensionMethod() { this.isClassicExtensionMethod() or this.isInExtension() }
|
||||
|
||||
/** Gets the type of the `params` parameter of this method, if any. */
|
||||
Type getParamsType() {
|
||||
@@ -295,8 +301,10 @@ class Method extends Callable, Virtualizable, Attributable, @method {
|
||||
override string getAPrimaryQlClass() { result = "Method" }
|
||||
}
|
||||
|
||||
final class ExtensionMethod = ExtensionMethodImpl;
|
||||
|
||||
/**
|
||||
* An extension method, for example
|
||||
* An extension method, for example
|
||||
*
|
||||
* ```csharp
|
||||
* static bool IsDefined(this Widget w) {
|
||||
@@ -304,16 +312,28 @@ class Method extends Callable, Virtualizable, Attributable, @method {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class ExtensionMethod extends Method {
|
||||
ExtensionMethod() { this.isExtensionMethod() }
|
||||
class ClassicExtensionMethod extends ExtensionMethodImpl {
|
||||
ClassicExtensionMethod() { this.isClassicExtensionMethod() }
|
||||
|
||||
pragma[noinline]
|
||||
override Type getExtendedType() { result = this.getParameter(0).getType() }
|
||||
|
||||
override predicate isStatic() { any() }
|
||||
}
|
||||
|
||||
/** Gets the type being extended by this method. */
|
||||
pragma[noinline]
|
||||
Type getExtendedType() { result = this.getParameter(0).getType() }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ExtensionMethod" }
|
||||
/**
|
||||
* An extension method declared in an extension type, for example `IsNullOrEmpty` in
|
||||
*
|
||||
* ```csharp
|
||||
* static class MyExtensions {
|
||||
* extension(string s) {
|
||||
* public bool IsNullOrEmpty() { ... }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class ExtensionTypeExtensionMethod extends ExtensionMethodImpl {
|
||||
ExtensionTypeExtensionMethod() { this.isInExtension() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -536,6 +556,21 @@ class RecordCloneMethod extends Method {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An extension operator, for example `*` in
|
||||
*
|
||||
* ```csharp
|
||||
* static class MyExtensions {
|
||||
* extension(string s) {
|
||||
* public static string operator *(int s1, string s2) { ... }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class ExtensionOperator extends ExtensionCallableImpl, Operator {
|
||||
ExtensionOperator() { this.isInExtension() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A user-defined unary operator - an operator taking one operand.
|
||||
*
|
||||
|
||||
@@ -102,6 +102,9 @@ class Declaration extends NamedElement, @declaration {
|
||||
* implicit constructors or accessors.
|
||||
*/
|
||||
predicate isCompilerGenerated() { compiler_generated(this) }
|
||||
|
||||
/** Holds if this declaration is in an extension type. */
|
||||
predicate isInExtension() { this.getDeclaringType() instanceof ExtensionType }
|
||||
}
|
||||
|
||||
/** A declaration that can have a modifier. */
|
||||
@@ -469,7 +472,7 @@ class Virtualizable extends Overridable, Member, @virtualizable {
|
||||
|
||||
/**
|
||||
* A parameterizable declaration. Either a callable (`Callable`), a delegate
|
||||
* type (`DelegateType`), or an indexer (`Indexer`).
|
||||
* type (`DelegateType`), an indexer (`Indexer`), or an extension (`ExtensionType`).
|
||||
*/
|
||||
class Parameterizable extends Declaration, @parameterizable {
|
||||
/** Gets raw parameter `i`, including the `this` parameter at index 0. */
|
||||
|
||||
@@ -6,6 +6,7 @@ import Member
|
||||
import Stmt
|
||||
import Type
|
||||
private import semmle.code.csharp.ExprOrStmtParent
|
||||
private import semmle.code.csharp.internal.Callable
|
||||
private import TypeRef
|
||||
|
||||
/**
|
||||
@@ -260,6 +261,21 @@ class Property extends DeclarationWithGetSetAccessors, @property {
|
||||
override string getAPrimaryQlClass() { result = "Property" }
|
||||
}
|
||||
|
||||
/**
|
||||
* An extension property, for example `FirstChar` in
|
||||
*
|
||||
* ```csharp
|
||||
* static class MyExtensions {
|
||||
* extension(string s) {
|
||||
* public char FirstChar { get { ... } }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class ExtensionProperty extends Property {
|
||||
ExtensionProperty() { this.isInExtension() }
|
||||
}
|
||||
|
||||
/**
|
||||
* An indexer, for example `string this[int i]` on line 2 in
|
||||
*
|
||||
@@ -413,6 +429,22 @@ class Accessor extends Callable, Modifiable, Attributable, Overridable, @callabl
|
||||
override string toString() { result = this.getName() }
|
||||
}
|
||||
|
||||
/**
|
||||
* An extension accessor. Either a getter (`Getter`) or a setter (`Setter`) of an
|
||||
* extension property, for example `get` in
|
||||
*
|
||||
* ```csharp
|
||||
* static class MyExtensions {
|
||||
* extension(string s) {
|
||||
* public char FirstChar { get { ... } }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class ExtensionAccessor extends ExtensionCallableImpl, Accessor {
|
||||
ExtensionAccessor() { this.isInExtension() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A `get` accessor, for example `get { return p; }` in
|
||||
*
|
||||
|
||||
@@ -17,7 +17,8 @@ private import semmle.code.csharp.frameworks.system.runtime.CompilerServices
|
||||
*
|
||||
* Either a value or reference type (`ValueOrRefType`), the `void` type (`VoidType`),
|
||||
* a pointer type (`PointerType`), the arglist type (`ArglistType`), an unknown
|
||||
* type (`UnknownType`), or a type parameter (`TypeParameter`).
|
||||
* type (`UnknownType`), a type parameter (`TypeParameter`) or
|
||||
* an extension type (`ExtensionType`).
|
||||
*/
|
||||
class Type extends Member, TypeContainer, @type {
|
||||
/** Gets the name of this type without additional syntax such as `[]` or `*`. */
|
||||
@@ -1326,3 +1327,35 @@ class TypeMention extends @type_mention {
|
||||
/** Gets the location of this type mention. */
|
||||
Location getLocation() { type_mention_location(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A type extension declaration, for example `extension(string s) { ... }` in
|
||||
*
|
||||
* ```csharp
|
||||
* static class MyExtensions {
|
||||
* extension(string s) { ... }
|
||||
* ```
|
||||
*/
|
||||
class ExtensionType extends Parameterizable, @extension_type {
|
||||
/**
|
||||
* Gets the receiver parameter of this extension type, if any.
|
||||
*/
|
||||
Parameter getReceiverParameter() { result = this.getParameter(0) }
|
||||
|
||||
/**
|
||||
* Holds if this extension type has a receiver parameter.
|
||||
*/
|
||||
predicate hasReceiverParameter() { exists(this.getReceiverParameter()) }
|
||||
|
||||
/**
|
||||
* Gets the type being extended by this extension type.
|
||||
*/
|
||||
Type getExtendedType() {
|
||||
extension_receiver_type(this, result)
|
||||
or
|
||||
not extension_receiver_type(this, any(Type t)) and
|
||||
extension_receiver_type(this, getTypeRef(result))
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ExtensionType" }
|
||||
}
|
||||
|
||||
@@ -67,6 +67,12 @@ module QualifiedName<QualifiedNameInputSig Input> {
|
||||
)
|
||||
}
|
||||
|
||||
private string getName(ValueOrRefType t) {
|
||||
not t instanceof ExtensionType and result = t.getUndecoratedName()
|
||||
or
|
||||
result = "extension(" + getFullName(t.(ExtensionType).getExtendedType()) + ")"
|
||||
}
|
||||
|
||||
/** Holds if declaration `d` has the qualified name `qualifier`.`name`. */
|
||||
predicate hasQualifiedName(Declaration d, string qualifier, string name) {
|
||||
d =
|
||||
@@ -86,12 +92,12 @@ module QualifiedName<QualifiedNameInputSig Input> {
|
||||
exists(string name0 | name = name0 + Input::getUnboundGenericSuffix(ugt) |
|
||||
exists(string enclosing |
|
||||
hasQualifiedName(ugt.getDeclaringType(), qualifier, enclosing) and
|
||||
name0 = enclosing + "+" + ugt.getUndecoratedName()
|
||||
name0 = enclosing + "+" + getName(ugt)
|
||||
)
|
||||
or
|
||||
not exists(ugt.getDeclaringType()) and
|
||||
qualifier = ugt.getNamespace().getFullName() and
|
||||
name0 = ugt.getUndecoratedName()
|
||||
name0 = getName(ugt)
|
||||
)
|
||||
)
|
||||
or
|
||||
@@ -100,12 +106,12 @@ module QualifiedName<QualifiedNameInputSig Input> {
|
||||
exists(string name0 | name = name0 + "<" + getTypeArgumentsQualifiedNames(ct) + ">" |
|
||||
exists(string enclosing |
|
||||
hasQualifiedName(ct.getDeclaringType(), qualifier, enclosing) and
|
||||
name0 = enclosing + "+" + ct.getUndecoratedName()
|
||||
name0 = enclosing + "+" + getName(ct)
|
||||
)
|
||||
or
|
||||
not exists(ct.getDeclaringType()) and
|
||||
qualifier = ct.getNamespace().getFullName() and
|
||||
name0 = ct.getUndecoratedName()
|
||||
name0 = getName(ct)
|
||||
)
|
||||
)
|
||||
or
|
||||
@@ -116,12 +122,12 @@ module QualifiedName<QualifiedNameInputSig Input> {
|
||||
(
|
||||
exists(string enclosing |
|
||||
hasQualifiedName(vort.getDeclaringType(), qualifier, enclosing) and
|
||||
name = enclosing + "+" + vort.getUndecoratedName()
|
||||
name = enclosing + "+" + getName(vort)
|
||||
)
|
||||
or
|
||||
not exists(vort.getDeclaringType()) and
|
||||
qualifier = vort.getNamespace().getFullName() and
|
||||
name = vort.getUndecoratedName()
|
||||
name = getName(vort)
|
||||
)
|
||||
)
|
||||
or
|
||||
|
||||
@@ -214,7 +214,7 @@ module ModelValidation {
|
||||
not namespace.regexpMatch("[a-zA-Z0-9_\\.]+") and
|
||||
result = "Dubious namespace \"" + namespace + "\" in " + pred + " model."
|
||||
or
|
||||
not type.regexpMatch("[a-zA-Z0-9_<>,\\+]+") and
|
||||
not type.regexpMatch("[a-zA-Z0-9_<>,\\(\\)\\+\\.]+") and
|
||||
result = "Dubious type \"" + type + "\" in " + pred + " model."
|
||||
or
|
||||
not name.regexpMatch("[a-zA-Z0-9_<>,\\.]*") and
|
||||
|
||||
@@ -87,7 +87,8 @@ private module Internal {
|
||||
newtype TDispatchCall =
|
||||
TDispatchMethodCall(MethodCall mc) {
|
||||
not isReflectionCall(mc, _, _, _, _) and
|
||||
not mc.isLateBound()
|
||||
not mc.isLateBound() and
|
||||
not isExtensionAccessorCall(mc)
|
||||
} or
|
||||
TDispatchAccessorCall(AccessorCall ac) or
|
||||
TDispatchOperatorCall(OperatorCall oc) { not oc.isLateBound() } or
|
||||
@@ -110,7 +111,8 @@ private module Internal {
|
||||
c instanceof ConstructorInitializer
|
||||
or
|
||||
c instanceof LocalFunctionCall
|
||||
}
|
||||
} or
|
||||
TDispatchExtensionAccessorCall(MethodCall mc) { isExtensionAccessorCall(mc) }
|
||||
|
||||
cached
|
||||
Expr getCall(DispatchCall dc) { result = dc.(DispatchCallImpl).getCall() }
|
||||
@@ -142,6 +144,8 @@ private module Internal {
|
||||
|
||||
import Cached
|
||||
|
||||
private predicate isExtensionAccessorCall(MethodCall mc) { exists(mc.getTargetAccessor()) }
|
||||
|
||||
/**
|
||||
* Holds if `mc` is a reflection call to a method named `name`, where
|
||||
* `object` is the object on which to invoke the method (`null` if a
|
||||
@@ -819,6 +823,33 @@ private module Internal {
|
||||
override Method getAStaticTarget() { result = this.getCall().getTarget() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to an extension accessor method.
|
||||
*/
|
||||
private class DispatchExtensionAccessorCall extends DispatchCallImpl,
|
||||
TDispatchExtensionAccessorCall
|
||||
{
|
||||
override MethodCall getCall() { this = TDispatchExtensionAccessorCall(result) }
|
||||
|
||||
private Expr getArgumentForParameter(Parameter p) {
|
||||
this.getCall().getTargetAccessor().getAParameter() = p and
|
||||
result = this.getCall().getArgument(p.getPosition())
|
||||
}
|
||||
|
||||
override Expr getArgument(int i) {
|
||||
exists(MethodCall call, Parameter p | call = this.getCall() |
|
||||
p = call.getTargetAccessor().getParameter(i) and
|
||||
result = this.getArgumentForParameter(p)
|
||||
)
|
||||
}
|
||||
|
||||
override Expr getQualifier() { result = this.getCall().getQualifier() }
|
||||
|
||||
override Accessor getAStaticTarget() { result = this.getCall().getTargetAccessor() }
|
||||
|
||||
override RuntimeCallable getADynamicTarget() { result = this.getAStaticTarget() }
|
||||
}
|
||||
|
||||
/**
|
||||
* An ordinary operator call.
|
||||
*
|
||||
|
||||
@@ -223,6 +223,40 @@ class ParameterAccess extends LocalScopeVariableAccess, @parameter_access_expr {
|
||||
override string getAPrimaryQlClass() { result = "ParameterAccess" }
|
||||
}
|
||||
|
||||
/**
|
||||
* An access to a synthetic parameter for an extension method, for example the
|
||||
* access to `s` on line 3 in
|
||||
*
|
||||
* ```csharp
|
||||
* static class MyExtensions {
|
||||
* extension(string s) {
|
||||
* public bool IsEmpty() { return s == string.Empty; }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class SyntheticExtensionParameterAccess extends ParameterAccess {
|
||||
SyntheticExtensionParameterAccess() {
|
||||
exists(ExtensionType et, Parameter p |
|
||||
p = et.getReceiverParameter() and
|
||||
expr_access(this, p)
|
||||
)
|
||||
}
|
||||
|
||||
override Parameter getTarget() {
|
||||
exists(ExtensionCallable c |
|
||||
this.getEnclosingCallable+() = c and
|
||||
result = c.getParameter(0)
|
||||
)
|
||||
}
|
||||
|
||||
override string toString() {
|
||||
result = "access to extension synthetic parameter " + this.getTarget().getName()
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "SyntheticExtensionParameterAccess" }
|
||||
}
|
||||
|
||||
/**
|
||||
* An access to a parameter that reads the underlying value, for example
|
||||
* the access to `p` on line 2 in
|
||||
|
||||
@@ -267,9 +267,33 @@ class Call extends Expr, @call {
|
||||
class MethodCall extends Call, QualifiableExpr, LateBindableExpr, @method_invocation_expr {
|
||||
override Method getTarget() { expr_call(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the accessor that was used to generate this method, if any. For example, the
|
||||
* method call `MyExtensions.get_FirstChar(s)` on line 9 is generated from the property
|
||||
* accessor `get_FirstChar` on line 3 in
|
||||
*
|
||||
* ```csharp
|
||||
* static class MyExtensions {
|
||||
* extension(string s) {
|
||||
* public char FirstChar { get { ... } }
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* class A {
|
||||
* char M(string s) {
|
||||
* return MyExtensions.get_FirstChar(s);
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
Accessor getTargetAccessor() { expr_call(this, result) }
|
||||
|
||||
override Method getQualifiedDeclaration() { result = this.getTarget() }
|
||||
|
||||
override string toString() { result = "call to method " + concat(this.getTarget().getName()) }
|
||||
override string toString() {
|
||||
if exists(this.getTargetAccessor())
|
||||
then result = "call to extension accessor " + concat(this.getTargetAccessor().getName())
|
||||
else result = "call to method " + concat(this.getTarget().getName())
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "MethodCall" }
|
||||
|
||||
@@ -479,6 +503,30 @@ class OperatorCall extends Call, LateBindableExpr, @operator_invocation_expr {
|
||||
override string getAPrimaryQlClass() { result = "OperatorCall" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to an extension operator, for example `3 * s` on
|
||||
* line 9 in
|
||||
*
|
||||
* ```csharp
|
||||
* static class MyExtensions {
|
||||
* extension(string s) {
|
||||
* public static string operator *(int i, string s) { ... }
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* class A {
|
||||
* string M(string s) {
|
||||
* return 3 * s;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class ExtensionOperatorCall extends OperatorCall {
|
||||
ExtensionOperatorCall() { this.getTarget() instanceof ExtensionOperator }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ExtensionOperatorCall" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to a user-defined mutator operator, for example `a++` on
|
||||
* line 7 in
|
||||
@@ -658,6 +706,44 @@ class IndexerCall extends AccessorCall, IndexerAccessExpr {
|
||||
override string getAPrimaryQlClass() { result = "IndexerCall" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to an extension property accessor (via the property), for example
|
||||
* `s.FirstChar` on line 9 in
|
||||
*
|
||||
* ```csharp
|
||||
* static class MyExtensions {
|
||||
* extension(string s) {
|
||||
* public char FirstChar { get { ... } }
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* class A {
|
||||
* char M(string s) {
|
||||
* return s.FirstChar;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class ExtensionPropertyCall extends PropertyCall {
|
||||
private ExtensionProperty prop;
|
||||
|
||||
ExtensionPropertyCall() { this.getProperty() = prop }
|
||||
|
||||
override Expr getArgument(int i) {
|
||||
if prop.isStatic()
|
||||
then result = super.getArgument(i)
|
||||
else (
|
||||
// Shift arguments as the qualifier is an explicit argument in the getter/setter.
|
||||
i = 0 and
|
||||
result = this.getQualifier()
|
||||
or
|
||||
result = super.getArgument(i - 1)
|
||||
)
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ExtensionPropertyCall" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to an event accessor, for example the call to `add_Click`
|
||||
* (defined on line 5) on line 12 in
|
||||
|
||||
33
csharp/ql/lib/semmle/code/csharp/internal/Callable.qll
Normal file
33
csharp/ql/lib/semmle/code/csharp/internal/Callable.qll
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*
|
||||
* Provides `Callable` classes, which are things that can be called
|
||||
* such as methods and operators.
|
||||
*/
|
||||
|
||||
private import semmle.code.csharp.Callable
|
||||
private import semmle.code.csharp.Property
|
||||
|
||||
/**
|
||||
* A callable that is declared as an extension.
|
||||
*
|
||||
* Either an extension method (`ExtensionMethod`), an extension operator
|
||||
* (`ExtensionOperator`) or an extension accessor (`ExtensionAccessor`).
|
||||
*/
|
||||
abstract class ExtensionCallableImpl extends Callable {
|
||||
/** Gets the type being extended by this method. */
|
||||
pragma[noinline]
|
||||
Type getExtendedType() { result = this.getDeclaringType().(ExtensionType).getExtendedType() }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ExtensionCallable" }
|
||||
}
|
||||
|
||||
/**
|
||||
* An extension method.
|
||||
*
|
||||
* Either a classic extension method (`ClassicExtensionMethod`) or an extension
|
||||
* type extension method (`ExtensionTypeExtensionMethod`).
|
||||
*/
|
||||
abstract class ExtensionMethodImpl extends ExtensionCallableImpl, Method {
|
||||
override string getAPrimaryQlClass() { result = "ExtensionMethod" }
|
||||
}
|
||||
@@ -492,6 +492,7 @@ case @type.kind of
|
||||
| 32 = @tuple_type
|
||||
| 33 = @function_pointer_type
|
||||
| 34 = @inline_array_type
|
||||
| 35 = @extension_type
|
||||
;
|
||||
|
||||
@simple_type = @bool_type | @char_type | @integral_type | @floating_point_type | @decimal_type;
|
||||
@@ -502,7 +503,7 @@ case @type.kind of
|
||||
@value_type = @simple_type | @enum_type | @struct_type | @nullable_type | @int_ptr_type
|
||||
| @uint_ptr_type | @tuple_type | @void_type | @inline_array_type;
|
||||
@ref_type = @class_type | @interface_type | @array_type | @delegate_type | @null_type
|
||||
| @dynamic_type;
|
||||
| @dynamic_type | @extension_type;
|
||||
@value_or_ref_type = @value_type | @ref_type;
|
||||
|
||||
typerefs(
|
||||
@@ -541,6 +542,10 @@ function_pointer_return_type(
|
||||
unique int function_pointer_id: @function_pointer_type ref,
|
||||
int return_type_id: @type_or_ref ref);
|
||||
|
||||
extension_receiver_type(
|
||||
unique int extension: @extension_type ref,
|
||||
int receiver_type_id: @type_or_ref ref);
|
||||
|
||||
extend(
|
||||
int sub: @type ref,
|
||||
int super: @type_or_ref ref);
|
||||
@@ -903,7 +908,7 @@ localvar_location(
|
||||
unique int id: @local_variable ref,
|
||||
int loc: @location ref);
|
||||
|
||||
@parameterizable = @callable | @delegate_type | @indexer | @function_pointer_type;
|
||||
@parameterizable = @callable | @delegate_type | @indexer | @function_pointer_type | @extension_type;
|
||||
|
||||
#keyset[name, parent_id]
|
||||
#keyset[index, parent_id]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
description: Add the relation `extension_receiver_type` and add the `extension_type` type kind.
|
||||
compatibility: full
|
||||
@@ -0,0 +1,502 @@
|
||||
models
|
||||
edges
|
||||
| extensions.cs:5:22:5:24 | obj : B | extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | provenance | |
|
||||
| extensions.cs:5:22:5:24 | obj : B | extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | provenance | |
|
||||
| extensions.cs:5:22:5:24 | obj : B | extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | provenance | |
|
||||
| extensions.cs:5:22:5:24 | obj : B | extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | provenance | |
|
||||
| extensions.cs:5:22:5:24 | obj : B | extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | provenance | |
|
||||
| extensions.cs:5:22:5:24 | obj : B | extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | provenance | |
|
||||
| extensions.cs:11:24:11:37 | call to method Source<B> : B | extensions.cs:108:18:108:26 | access to property Prop1 : B | provenance | |
|
||||
| extensions.cs:11:24:11:37 | call to method Source<B> : B | extensions.cs:108:18:108:26 | access to property Prop1 : B | provenance | |
|
||||
| extensions.cs:11:24:11:37 | call to method Source<B> : B | extensions.cs:111:18:111:44 | call to extension accessor get_Prop1 : B | provenance | |
|
||||
| extensions.cs:11:24:11:37 | call to method Source<B> : B | extensions.cs:111:18:111:44 | call to extension accessor get_Prop1 : B | provenance | |
|
||||
| extensions.cs:13:13:13:15 | value : B | extensions.cs:15:24:15:28 | access to parameter value | provenance | |
|
||||
| extensions.cs:13:13:13:15 | value : B | extensions.cs:15:24:15:28 | access to parameter value | provenance | |
|
||||
| extensions.cs:36:24:36:38 | call to method Source<B> : B | extensions.cs:194:18:194:35 | access to property StaticProp1 : B | provenance | |
|
||||
| extensions.cs:36:24:36:38 | call to method Source<B> : B | extensions.cs:194:18:194:35 | access to property StaticProp1 : B | provenance | |
|
||||
| extensions.cs:36:24:36:38 | call to method Source<B> : B | extensions.cs:197:18:197:47 | call to extension accessor get_StaticProp1 : B | provenance | |
|
||||
| extensions.cs:36:24:36:38 | call to method Source<B> : B | extensions.cs:197:18:197:47 | call to extension accessor get_StaticProp1 : B | provenance | |
|
||||
| extensions.cs:38:13:38:15 | value : B | extensions.cs:40:24:40:28 | access to parameter value | provenance | |
|
||||
| extensions.cs:38:13:38:15 | value : B | extensions.cs:40:24:40:28 | access to parameter value | provenance | |
|
||||
| extensions.cs:46:20:46:33 | call to method Source<B> : B | extensions.cs:127:18:127:25 | call to method M1 : B | provenance | |
|
||||
| extensions.cs:46:20:46:33 | call to method Source<B> : B | extensions.cs:127:18:127:25 | call to method M1 : B | provenance | |
|
||||
| extensions.cs:46:20:46:33 | call to method Source<B> : B | extensions.cs:130:18:130:37 | call to method M1 : B | provenance | |
|
||||
| extensions.cs:46:20:46:33 | call to method Source<B> : B | extensions.cs:130:18:130:37 | call to method M1 : B | provenance | |
|
||||
| extensions.cs:59:48:59:48 | a : B | extensions.cs:61:20:61:20 | access to parameter a | provenance | |
|
||||
| extensions.cs:59:48:59:48 | a : B | extensions.cs:61:20:61:20 | access to parameter a | provenance | |
|
||||
| extensions.cs:67:20:67:33 | call to method Source<B> : B | extensions.cs:185:18:185:24 | call to operator - : B | provenance | |
|
||||
| extensions.cs:67:20:67:33 | call to method Source<B> : B | extensions.cs:185:18:185:24 | call to operator - : B | provenance | |
|
||||
| extensions.cs:67:20:67:33 | call to method Source<B> : B | extensions.cs:188:18:188:52 | call to operator - : B | provenance | |
|
||||
| extensions.cs:67:20:67:33 | call to method Source<B> : B | extensions.cs:188:18:188:52 | call to operator - : B | provenance | |
|
||||
| extensions.cs:76:17:76:17 | b : B | extensions.cs:80:20:80:20 | access to extension synthetic parameter b : B | provenance | |
|
||||
| extensions.cs:76:17:76:17 | b : B | extensions.cs:80:20:80:20 | access to extension synthetic parameter b : B | provenance | |
|
||||
| extensions.cs:76:17:76:17 | b : B | extensions.cs:85:20:85:20 | access to extension synthetic parameter b | provenance | |
|
||||
| extensions.cs:76:17:76:17 | b : B | extensions.cs:85:20:85:20 | access to extension synthetic parameter b | provenance | |
|
||||
| extensions.cs:89:20:89:20 | t : B | extensions.cs:93:20:93:20 | access to extension synthetic parameter t | provenance | |
|
||||
| extensions.cs:89:20:89:20 | t : B | extensions.cs:93:20:93:20 | access to extension synthetic parameter t | provenance | |
|
||||
| extensions.cs:96:33:96:37 | other : B | extensions.cs:98:20:98:24 | access to parameter other : B | provenance | |
|
||||
| extensions.cs:96:33:96:37 | other : B | extensions.cs:98:20:98:24 | access to parameter other : B | provenance | |
|
||||
| extensions.cs:108:13:108:14 | access to local variable b1 : B | extensions.cs:109:14:109:15 | access to local variable b1 | provenance | |
|
||||
| extensions.cs:108:13:108:14 | access to local variable b1 : B | extensions.cs:109:14:109:15 | access to local variable b1 | provenance | |
|
||||
| extensions.cs:108:18:108:26 | access to property Prop1 : B | extensions.cs:108:13:108:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:108:18:108:26 | access to property Prop1 : B | extensions.cs:108:13:108:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:111:13:111:14 | access to local variable b2 : B | extensions.cs:112:14:112:15 | access to local variable b2 | provenance | |
|
||||
| extensions.cs:111:13:111:14 | access to local variable b2 : B | extensions.cs:112:14:112:15 | access to local variable b2 | provenance | |
|
||||
| extensions.cs:111:18:111:44 | call to extension accessor get_Prop1 : B | extensions.cs:111:13:111:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:111:18:111:44 | call to extension accessor get_Prop1 : B | extensions.cs:111:13:111:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:118:21:118:32 | call to method Source<B> : B | extensions.cs:13:13:13:15 | value : B | provenance | |
|
||||
| extensions.cs:118:21:118:32 | call to method Source<B> : B | extensions.cs:13:13:13:15 | value : B | provenance | |
|
||||
| extensions.cs:120:13:120:13 | access to local variable b : B | extensions.cs:121:37:121:37 | access to local variable b : B | provenance | |
|
||||
| extensions.cs:120:13:120:13 | access to local variable b : B | extensions.cs:121:37:121:37 | access to local variable b : B | provenance | |
|
||||
| extensions.cs:120:17:120:30 | call to method Source<B> : B | extensions.cs:120:13:120:13 | access to local variable b : B | provenance | |
|
||||
| extensions.cs:120:17:120:30 | call to method Source<B> : B | extensions.cs:120:13:120:13 | access to local variable b : B | provenance | |
|
||||
| extensions.cs:121:37:121:37 | access to local variable b : B | extensions.cs:13:13:13:15 | value : B | provenance | |
|
||||
| extensions.cs:121:37:121:37 | access to local variable b : B | extensions.cs:13:13:13:15 | value : B | provenance | |
|
||||
| extensions.cs:127:13:127:14 | access to local variable b1 : B | extensions.cs:128:14:128:15 | access to local variable b1 | provenance | |
|
||||
| extensions.cs:127:13:127:14 | access to local variable b1 : B | extensions.cs:128:14:128:15 | access to local variable b1 | provenance | |
|
||||
| extensions.cs:127:18:127:25 | call to method M1 : B | extensions.cs:127:13:127:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:127:18:127:25 | call to method M1 : B | extensions.cs:127:13:127:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:130:13:130:14 | access to local variable b2 : B | extensions.cs:131:14:131:15 | access to local variable b2 | provenance | |
|
||||
| extensions.cs:130:13:130:14 | access to local variable b2 : B | extensions.cs:131:14:131:15 | access to local variable b2 | provenance | |
|
||||
| extensions.cs:130:18:130:37 | call to method M1 : B | extensions.cs:130:13:130:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:130:18:130:37 | call to method M1 : B | extensions.cs:130:13:130:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:136:13:136:14 | access to local variable b1 : B | extensions.cs:137:9:137:10 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:136:13:136:14 | access to local variable b1 : B | extensions.cs:137:9:137:10 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:136:18:136:29 | call to method Source<B> : B | extensions.cs:136:13:136:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:136:18:136:29 | call to method Source<B> : B | extensions.cs:136:13:136:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:137:9:137:10 | access to local variable b1 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:137:9:137:10 | access to local variable b1 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:139:13:139:14 | access to local variable b2 : B | extensions.cs:140:25:140:26 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:139:13:139:14 | access to local variable b2 : B | extensions.cs:140:25:140:26 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:139:18:139:31 | call to method Source<B> : B | extensions.cs:139:13:139:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:139:18:139:31 | call to method Source<B> : B | extensions.cs:139:13:139:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:140:25:140:26 | access to local variable b2 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:140:25:140:26 | access to local variable b2 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:145:13:145:14 | access to local variable b1 : B | extensions.cs:146:18:146:19 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:145:13:145:14 | access to local variable b1 : B | extensions.cs:146:18:146:19 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:145:13:145:14 | access to local variable b1 : B | extensions.cs:149:34:149:35 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:145:13:145:14 | access to local variable b1 : B | extensions.cs:149:34:149:35 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:145:18:145:29 | call to method Source<B> : B | extensions.cs:145:13:145:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:145:18:145:29 | call to method Source<B> : B | extensions.cs:145:13:145:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:146:13:146:14 | access to local variable b2 : B | extensions.cs:147:14:147:15 | access to local variable b2 | provenance | |
|
||||
| extensions.cs:146:13:146:14 | access to local variable b2 : B | extensions.cs:147:14:147:15 | access to local variable b2 | provenance | |
|
||||
| extensions.cs:146:18:146:19 | access to local variable b1 : B | extensions.cs:76:17:76:17 | b : B | provenance | |
|
||||
| extensions.cs:146:18:146:19 | access to local variable b1 : B | extensions.cs:76:17:76:17 | b : B | provenance | |
|
||||
| extensions.cs:146:18:146:19 | access to local variable b1 : B | extensions.cs:146:18:146:24 | call to method B1 : B | provenance | |
|
||||
| extensions.cs:146:18:146:19 | access to local variable b1 : B | extensions.cs:146:18:146:24 | call to method B1 : B | provenance | |
|
||||
| extensions.cs:146:18:146:24 | call to method B1 : B | extensions.cs:146:13:146:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:146:18:146:24 | call to method B1 : B | extensions.cs:146:13:146:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:149:13:149:14 | access to local variable b3 : B | extensions.cs:150:14:150:15 | access to local variable b3 | provenance | |
|
||||
| extensions.cs:149:13:149:14 | access to local variable b3 : B | extensions.cs:150:14:150:15 | access to local variable b3 | provenance | |
|
||||
| extensions.cs:149:18:149:36 | call to method B1 : B | extensions.cs:149:13:149:14 | access to local variable b3 : B | provenance | |
|
||||
| extensions.cs:149:18:149:36 | call to method B1 : B | extensions.cs:149:13:149:14 | access to local variable b3 : B | provenance | |
|
||||
| extensions.cs:149:34:149:35 | access to local variable b1 : B | extensions.cs:76:17:76:17 | b : B | provenance | |
|
||||
| extensions.cs:149:34:149:35 | access to local variable b1 : B | extensions.cs:76:17:76:17 | b : B | provenance | |
|
||||
| extensions.cs:149:34:149:35 | access to local variable b1 : B | extensions.cs:149:18:149:36 | call to method B1 : B | provenance | |
|
||||
| extensions.cs:149:34:149:35 | access to local variable b1 : B | extensions.cs:149:18:149:36 | call to method B1 : B | provenance | |
|
||||
| extensions.cs:155:13:155:14 | access to local variable b1 : B | extensions.cs:156:18:156:19 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:155:13:155:14 | access to local variable b1 : B | extensions.cs:156:18:156:19 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:155:18:155:29 | call to method Source<B> : B | extensions.cs:155:13:155:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:155:18:155:29 | call to method Source<B> : B | extensions.cs:155:13:155:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:156:18:156:19 | access to local variable b1 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:156:18:156:19 | access to local variable b1 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:158:13:158:14 | access to local variable b3 : B | extensions.cs:159:41:159:42 | access to local variable b3 : B | provenance | |
|
||||
| extensions.cs:158:13:158:14 | access to local variable b3 : B | extensions.cs:159:41:159:42 | access to local variable b3 : B | provenance | |
|
||||
| extensions.cs:158:18:158:31 | call to method Source<B> : B | extensions.cs:158:13:158:14 | access to local variable b3 : B | provenance | |
|
||||
| extensions.cs:158:18:158:31 | call to method Source<B> : B | extensions.cs:158:13:158:14 | access to local variable b3 : B | provenance | |
|
||||
| extensions.cs:159:41:159:42 | access to local variable b3 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:159:41:159:42 | access to local variable b3 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:164:13:164:14 | access to local variable b1 : B | extensions.cs:165:9:165:10 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:164:13:164:14 | access to local variable b1 : B | extensions.cs:165:9:165:10 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:164:18:164:29 | call to method Source<B> : B | extensions.cs:164:13:164:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:164:18:164:29 | call to method Source<B> : B | extensions.cs:164:13:164:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:165:9:165:10 | access to local variable b1 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:165:9:165:10 | access to local variable b1 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:167:13:167:14 | access to local variable b2 : B | extensions.cs:168:32:168:33 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:167:13:167:14 | access to local variable b2 : B | extensions.cs:168:32:168:33 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:167:18:167:31 | call to method Source<B> : B | extensions.cs:167:13:167:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:167:18:167:31 | call to method Source<B> : B | extensions.cs:167:13:167:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:168:32:168:33 | access to local variable b2 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:168:32:168:33 | access to local variable b2 : B | extensions.cs:5:22:5:24 | obj : B | provenance | |
|
||||
| extensions.cs:173:13:173:14 | access to local variable b1 : B | extensions.cs:175:18:175:19 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:173:13:173:14 | access to local variable b1 : B | extensions.cs:175:18:175:19 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:173:18:173:29 | call to method Source<B> : B | extensions.cs:173:13:173:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:173:18:173:29 | call to method Source<B> : B | extensions.cs:173:13:173:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:175:18:175:19 | access to local variable b1 : B | extensions.cs:59:48:59:48 | a : B | provenance | |
|
||||
| extensions.cs:175:18:175:19 | access to local variable b1 : B | extensions.cs:59:48:59:48 | a : B | provenance | |
|
||||
| extensions.cs:177:13:177:14 | access to local variable b4 : B | extensions.cs:178:43:178:44 | access to local variable b4 : B | provenance | |
|
||||
| extensions.cs:177:13:177:14 | access to local variable b4 : B | extensions.cs:178:43:178:44 | access to local variable b4 : B | provenance | |
|
||||
| extensions.cs:177:18:177:31 | call to method Source<B> : B | extensions.cs:177:13:177:14 | access to local variable b4 : B | provenance | |
|
||||
| extensions.cs:177:18:177:31 | call to method Source<B> : B | extensions.cs:177:13:177:14 | access to local variable b4 : B | provenance | |
|
||||
| extensions.cs:178:43:178:44 | access to local variable b4 : B | extensions.cs:59:48:59:48 | a : B | provenance | |
|
||||
| extensions.cs:178:43:178:44 | access to local variable b4 : B | extensions.cs:59:48:59:48 | a : B | provenance | |
|
||||
| extensions.cs:185:13:185:14 | access to local variable b3 : B | extensions.cs:186:14:186:15 | access to local variable b3 | provenance | |
|
||||
| extensions.cs:185:13:185:14 | access to local variable b3 : B | extensions.cs:186:14:186:15 | access to local variable b3 | provenance | |
|
||||
| extensions.cs:185:18:185:24 | call to operator - : B | extensions.cs:185:13:185:14 | access to local variable b3 : B | provenance | |
|
||||
| extensions.cs:185:18:185:24 | call to operator - : B | extensions.cs:185:13:185:14 | access to local variable b3 : B | provenance | |
|
||||
| extensions.cs:188:13:188:14 | access to local variable b4 : B | extensions.cs:189:14:189:15 | access to local variable b4 | provenance | |
|
||||
| extensions.cs:188:13:188:14 | access to local variable b4 : B | extensions.cs:189:14:189:15 | access to local variable b4 | provenance | |
|
||||
| extensions.cs:188:18:188:52 | call to operator - : B | extensions.cs:188:13:188:14 | access to local variable b4 : B | provenance | |
|
||||
| extensions.cs:188:18:188:52 | call to operator - : B | extensions.cs:188:13:188:14 | access to local variable b4 : B | provenance | |
|
||||
| extensions.cs:194:13:194:14 | access to local variable b1 : B | extensions.cs:195:14:195:15 | access to local variable b1 | provenance | |
|
||||
| extensions.cs:194:13:194:14 | access to local variable b1 : B | extensions.cs:195:14:195:15 | access to local variable b1 | provenance | |
|
||||
| extensions.cs:194:18:194:35 | access to property StaticProp1 : B | extensions.cs:194:13:194:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:194:18:194:35 | access to property StaticProp1 : B | extensions.cs:194:13:194:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:197:13:197:14 | access to local variable b2 : B | extensions.cs:198:14:198:15 | access to local variable b2 | provenance | |
|
||||
| extensions.cs:197:13:197:14 | access to local variable b2 : B | extensions.cs:198:14:198:15 | access to local variable b2 | provenance | |
|
||||
| extensions.cs:197:18:197:47 | call to extension accessor get_StaticProp1 : B | extensions.cs:197:13:197:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:197:18:197:47 | call to extension accessor get_StaticProp1 : B | extensions.cs:197:13:197:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:203:13:203:14 | access to local variable b1 : B | extensions.cs:204:30:204:31 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:203:13:203:14 | access to local variable b1 : B | extensions.cs:204:30:204:31 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:203:18:203:30 | call to method Source<B> : B | extensions.cs:203:13:203:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:203:18:203:30 | call to method Source<B> : B | extensions.cs:203:13:203:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:204:30:204:31 | access to local variable b1 : B | extensions.cs:38:13:38:15 | value : B | provenance | |
|
||||
| extensions.cs:204:30:204:31 | access to local variable b1 : B | extensions.cs:38:13:38:15 | value : B | provenance | |
|
||||
| extensions.cs:206:13:206:14 | access to local variable b2 : B | extensions.cs:207:38:207:39 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:206:13:206:14 | access to local variable b2 : B | extensions.cs:207:38:207:39 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:206:18:206:31 | call to method Source<B> : B | extensions.cs:206:13:206:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:206:18:206:31 | call to method Source<B> : B | extensions.cs:206:13:206:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:207:38:207:39 | access to local variable b2 : B | extensions.cs:38:13:38:15 | value : B | provenance | |
|
||||
| extensions.cs:207:38:207:39 | access to local variable b2 : B | extensions.cs:38:13:38:15 | value : B | provenance | |
|
||||
| extensions.cs:212:13:212:14 | access to local variable b1 : B | extensions.cs:213:9:213:10 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:212:13:212:14 | access to local variable b1 : B | extensions.cs:213:9:213:10 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:212:18:212:30 | call to method Source<B> : B | extensions.cs:212:13:212:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:212:18:212:30 | call to method Source<B> : B | extensions.cs:212:13:212:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:213:9:213:10 | access to local variable b1 : B | extensions.cs:76:17:76:17 | b : B | provenance | |
|
||||
| extensions.cs:213:9:213:10 | access to local variable b1 : B | extensions.cs:76:17:76:17 | b : B | provenance | |
|
||||
| extensions.cs:215:13:215:14 | access to local variable b2 : B | extensions.cs:216:25:216:26 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:215:13:215:14 | access to local variable b2 : B | extensions.cs:216:25:216:26 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:215:18:215:31 | call to method Source<B> : B | extensions.cs:215:13:215:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:215:18:215:31 | call to method Source<B> : B | extensions.cs:215:13:215:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:216:25:216:26 | access to local variable b2 : B | extensions.cs:76:17:76:17 | b : B | provenance | |
|
||||
| extensions.cs:216:25:216:26 | access to local variable b2 : B | extensions.cs:76:17:76:17 | b : B | provenance | |
|
||||
| extensions.cs:221:13:221:14 | access to local variable b1 : B | extensions.cs:222:9:222:10 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:221:13:221:14 | access to local variable b1 : B | extensions.cs:222:9:222:10 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:221:18:221:30 | call to method Source<B> : B | extensions.cs:221:13:221:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:221:18:221:30 | call to method Source<B> : B | extensions.cs:221:13:221:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:222:9:222:10 | access to local variable b1 : B | extensions.cs:89:20:89:20 | t : B | provenance | |
|
||||
| extensions.cs:222:9:222:10 | access to local variable b1 : B | extensions.cs:89:20:89:20 | t : B | provenance | |
|
||||
| extensions.cs:224:13:224:14 | access to local variable b2 : B | extensions.cs:225:32:225:33 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:224:13:224:14 | access to local variable b2 : B | extensions.cs:225:32:225:33 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:224:18:224:31 | call to method Source<B> : B | extensions.cs:224:13:224:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:224:18:224:31 | call to method Source<B> : B | extensions.cs:224:13:224:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:225:32:225:33 | access to local variable b2 : B | extensions.cs:89:20:89:20 | t : B | provenance | |
|
||||
| extensions.cs:225:32:225:33 | access to local variable b2 : B | extensions.cs:89:20:89:20 | t : B | provenance | |
|
||||
| extensions.cs:231:13:231:14 | access to local variable b1 : B | extensions.cs:232:32:232:33 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:231:13:231:14 | access to local variable b1 : B | extensions.cs:232:32:232:33 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:231:13:231:14 | access to local variable b1 : B | extensions.cs:235:46:235:47 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:231:13:231:14 | access to local variable b1 : B | extensions.cs:235:46:235:47 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:231:18:231:30 | call to method Source<B> : B | extensions.cs:231:13:231:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:231:18:231:30 | call to method Source<B> : B | extensions.cs:231:13:231:14 | access to local variable b1 : B | provenance | |
|
||||
| extensions.cs:232:13:232:14 | access to local variable b2 : B | extensions.cs:233:14:233:15 | access to local variable b2 | provenance | |
|
||||
| extensions.cs:232:13:232:14 | access to local variable b2 : B | extensions.cs:233:14:233:15 | access to local variable b2 | provenance | |
|
||||
| extensions.cs:232:18:232:34 | call to method GenericM2<B> : B | extensions.cs:232:13:232:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:232:18:232:34 | call to method GenericM2<B> : B | extensions.cs:232:13:232:14 | access to local variable b2 : B | provenance | |
|
||||
| extensions.cs:232:32:232:33 | access to local variable b1 : B | extensions.cs:96:33:96:37 | other : B | provenance | |
|
||||
| extensions.cs:232:32:232:33 | access to local variable b1 : B | extensions.cs:96:33:96:37 | other : B | provenance | |
|
||||
| extensions.cs:232:32:232:33 | access to local variable b1 : B | extensions.cs:232:18:232:34 | call to method GenericM2<B> : B | provenance | |
|
||||
| extensions.cs:232:32:232:33 | access to local variable b1 : B | extensions.cs:232:18:232:34 | call to method GenericM2<B> : B | provenance | |
|
||||
| extensions.cs:235:13:235:14 | access to local variable b3 : B | extensions.cs:236:14:236:15 | access to local variable b3 | provenance | |
|
||||
| extensions.cs:235:13:235:14 | access to local variable b3 : B | extensions.cs:236:14:236:15 | access to local variable b3 | provenance | |
|
||||
| extensions.cs:235:18:235:48 | call to method GenericM2<B> : B | extensions.cs:235:13:235:14 | access to local variable b3 : B | provenance | |
|
||||
| extensions.cs:235:18:235:48 | call to method GenericM2<B> : B | extensions.cs:235:13:235:14 | access to local variable b3 : B | provenance | |
|
||||
| extensions.cs:235:46:235:47 | access to local variable b1 : B | extensions.cs:96:33:96:37 | other : B | provenance | |
|
||||
| extensions.cs:235:46:235:47 | access to local variable b1 : B | extensions.cs:96:33:96:37 | other : B | provenance | |
|
||||
| extensions.cs:235:46:235:47 | access to local variable b1 : B | extensions.cs:235:18:235:48 | call to method GenericM2<B> : B | provenance | |
|
||||
| extensions.cs:235:46:235:47 | access to local variable b1 : B | extensions.cs:235:18:235:48 | call to method GenericM2<B> : B | provenance | |
|
||||
nodes
|
||||
| extensions.cs:5:22:5:24 | obj : B | semmle.label | obj : B |
|
||||
| extensions.cs:5:22:5:24 | obj : B | semmle.label | obj : B |
|
||||
| extensions.cs:5:22:5:24 | obj : B | semmle.label | obj : B |
|
||||
| extensions.cs:5:22:5:24 | obj : B | semmle.label | obj : B |
|
||||
| extensions.cs:5:22:5:24 | obj : B | semmle.label | obj : B |
|
||||
| extensions.cs:5:22:5:24 | obj : B | semmle.label | obj : B |
|
||||
| extensions.cs:11:24:11:37 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:11:24:11:37 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:13:13:13:15 | value : B | semmle.label | value : B |
|
||||
| extensions.cs:13:13:13:15 | value : B | semmle.label | value : B |
|
||||
| extensions.cs:15:24:15:28 | access to parameter value | semmle.label | access to parameter value |
|
||||
| extensions.cs:15:24:15:28 | access to parameter value | semmle.label | access to parameter value |
|
||||
| extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | semmle.label | access to extension synthetic parameter obj |
|
||||
| extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | semmle.label | access to extension synthetic parameter obj |
|
||||
| extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | semmle.label | access to extension synthetic parameter obj |
|
||||
| extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | semmle.label | access to extension synthetic parameter obj |
|
||||
| extensions.cs:36:24:36:38 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:36:24:36:38 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:38:13:38:15 | value : B | semmle.label | value : B |
|
||||
| extensions.cs:38:13:38:15 | value : B | semmle.label | value : B |
|
||||
| extensions.cs:40:24:40:28 | access to parameter value | semmle.label | access to parameter value |
|
||||
| extensions.cs:40:24:40:28 | access to parameter value | semmle.label | access to parameter value |
|
||||
| extensions.cs:46:20:46:33 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:46:20:46:33 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | semmle.label | access to extension synthetic parameter obj |
|
||||
| extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | semmle.label | access to extension synthetic parameter obj |
|
||||
| extensions.cs:59:48:59:48 | a : B | semmle.label | a : B |
|
||||
| extensions.cs:59:48:59:48 | a : B | semmle.label | a : B |
|
||||
| extensions.cs:61:20:61:20 | access to parameter a | semmle.label | access to parameter a |
|
||||
| extensions.cs:61:20:61:20 | access to parameter a | semmle.label | access to parameter a |
|
||||
| extensions.cs:67:20:67:33 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:67:20:67:33 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:76:17:76:17 | b : B | semmle.label | b : B |
|
||||
| extensions.cs:76:17:76:17 | b : B | semmle.label | b : B |
|
||||
| extensions.cs:76:17:76:17 | b : B | semmle.label | b : B |
|
||||
| extensions.cs:76:17:76:17 | b : B | semmle.label | b : B |
|
||||
| extensions.cs:80:20:80:20 | access to extension synthetic parameter b : B | semmle.label | access to extension synthetic parameter b : B |
|
||||
| extensions.cs:80:20:80:20 | access to extension synthetic parameter b : B | semmle.label | access to extension synthetic parameter b : B |
|
||||
| extensions.cs:85:20:85:20 | access to extension synthetic parameter b | semmle.label | access to extension synthetic parameter b |
|
||||
| extensions.cs:85:20:85:20 | access to extension synthetic parameter b | semmle.label | access to extension synthetic parameter b |
|
||||
| extensions.cs:89:20:89:20 | t : B | semmle.label | t : B |
|
||||
| extensions.cs:89:20:89:20 | t : B | semmle.label | t : B |
|
||||
| extensions.cs:93:20:93:20 | access to extension synthetic parameter t | semmle.label | access to extension synthetic parameter t |
|
||||
| extensions.cs:93:20:93:20 | access to extension synthetic parameter t | semmle.label | access to extension synthetic parameter t |
|
||||
| extensions.cs:96:33:96:37 | other : B | semmle.label | other : B |
|
||||
| extensions.cs:96:33:96:37 | other : B | semmle.label | other : B |
|
||||
| extensions.cs:98:20:98:24 | access to parameter other : B | semmle.label | access to parameter other : B |
|
||||
| extensions.cs:98:20:98:24 | access to parameter other : B | semmle.label | access to parameter other : B |
|
||||
| extensions.cs:108:13:108:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:108:13:108:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:108:18:108:26 | access to property Prop1 : B | semmle.label | access to property Prop1 : B |
|
||||
| extensions.cs:108:18:108:26 | access to property Prop1 : B | semmle.label | access to property Prop1 : B |
|
||||
| extensions.cs:109:14:109:15 | access to local variable b1 | semmle.label | access to local variable b1 |
|
||||
| extensions.cs:109:14:109:15 | access to local variable b1 | semmle.label | access to local variable b1 |
|
||||
| extensions.cs:111:13:111:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:111:13:111:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:111:18:111:44 | call to extension accessor get_Prop1 : B | semmle.label | call to extension accessor get_Prop1 : B |
|
||||
| extensions.cs:111:18:111:44 | call to extension accessor get_Prop1 : B | semmle.label | call to extension accessor get_Prop1 : B |
|
||||
| extensions.cs:112:14:112:15 | access to local variable b2 | semmle.label | access to local variable b2 |
|
||||
| extensions.cs:112:14:112:15 | access to local variable b2 | semmle.label | access to local variable b2 |
|
||||
| extensions.cs:118:21:118:32 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:118:21:118:32 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:120:13:120:13 | access to local variable b : B | semmle.label | access to local variable b : B |
|
||||
| extensions.cs:120:13:120:13 | access to local variable b : B | semmle.label | access to local variable b : B |
|
||||
| extensions.cs:120:17:120:30 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:120:17:120:30 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:121:37:121:37 | access to local variable b : B | semmle.label | access to local variable b : B |
|
||||
| extensions.cs:121:37:121:37 | access to local variable b : B | semmle.label | access to local variable b : B |
|
||||
| extensions.cs:127:13:127:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:127:13:127:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:127:18:127:25 | call to method M1 : B | semmle.label | call to method M1 : B |
|
||||
| extensions.cs:127:18:127:25 | call to method M1 : B | semmle.label | call to method M1 : B |
|
||||
| extensions.cs:128:14:128:15 | access to local variable b1 | semmle.label | access to local variable b1 |
|
||||
| extensions.cs:128:14:128:15 | access to local variable b1 | semmle.label | access to local variable b1 |
|
||||
| extensions.cs:130:13:130:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:130:13:130:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:130:18:130:37 | call to method M1 : B | semmle.label | call to method M1 : B |
|
||||
| extensions.cs:130:18:130:37 | call to method M1 : B | semmle.label | call to method M1 : B |
|
||||
| extensions.cs:131:14:131:15 | access to local variable b2 | semmle.label | access to local variable b2 |
|
||||
| extensions.cs:131:14:131:15 | access to local variable b2 | semmle.label | access to local variable b2 |
|
||||
| extensions.cs:136:13:136:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:136:13:136:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:136:18:136:29 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:136:18:136:29 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:137:9:137:10 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:137:9:137:10 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:139:13:139:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:139:13:139:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:139:18:139:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:139:18:139:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:140:25:140:26 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:140:25:140:26 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:145:13:145:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:145:13:145:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:145:18:145:29 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:145:18:145:29 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:146:13:146:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:146:13:146:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:146:18:146:19 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:146:18:146:19 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:146:18:146:24 | call to method B1 : B | semmle.label | call to method B1 : B |
|
||||
| extensions.cs:146:18:146:24 | call to method B1 : B | semmle.label | call to method B1 : B |
|
||||
| extensions.cs:147:14:147:15 | access to local variable b2 | semmle.label | access to local variable b2 |
|
||||
| extensions.cs:147:14:147:15 | access to local variable b2 | semmle.label | access to local variable b2 |
|
||||
| extensions.cs:149:13:149:14 | access to local variable b3 : B | semmle.label | access to local variable b3 : B |
|
||||
| extensions.cs:149:13:149:14 | access to local variable b3 : B | semmle.label | access to local variable b3 : B |
|
||||
| extensions.cs:149:18:149:36 | call to method B1 : B | semmle.label | call to method B1 : B |
|
||||
| extensions.cs:149:18:149:36 | call to method B1 : B | semmle.label | call to method B1 : B |
|
||||
| extensions.cs:149:34:149:35 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:149:34:149:35 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:150:14:150:15 | access to local variable b3 | semmle.label | access to local variable b3 |
|
||||
| extensions.cs:150:14:150:15 | access to local variable b3 | semmle.label | access to local variable b3 |
|
||||
| extensions.cs:155:13:155:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:155:13:155:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:155:18:155:29 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:155:18:155:29 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:156:18:156:19 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:156:18:156:19 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:158:13:158:14 | access to local variable b3 : B | semmle.label | access to local variable b3 : B |
|
||||
| extensions.cs:158:13:158:14 | access to local variable b3 : B | semmle.label | access to local variable b3 : B |
|
||||
| extensions.cs:158:18:158:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:158:18:158:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:159:41:159:42 | access to local variable b3 : B | semmle.label | access to local variable b3 : B |
|
||||
| extensions.cs:159:41:159:42 | access to local variable b3 : B | semmle.label | access to local variable b3 : B |
|
||||
| extensions.cs:164:13:164:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:164:13:164:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:164:18:164:29 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:164:18:164:29 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:165:9:165:10 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:165:9:165:10 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:167:13:167:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:167:13:167:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:167:18:167:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:167:18:167:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:168:32:168:33 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:168:32:168:33 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:173:13:173:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:173:13:173:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:173:18:173:29 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:173:18:173:29 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:175:18:175:19 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:175:18:175:19 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:177:13:177:14 | access to local variable b4 : B | semmle.label | access to local variable b4 : B |
|
||||
| extensions.cs:177:13:177:14 | access to local variable b4 : B | semmle.label | access to local variable b4 : B |
|
||||
| extensions.cs:177:18:177:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:177:18:177:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:178:43:178:44 | access to local variable b4 : B | semmle.label | access to local variable b4 : B |
|
||||
| extensions.cs:178:43:178:44 | access to local variable b4 : B | semmle.label | access to local variable b4 : B |
|
||||
| extensions.cs:185:13:185:14 | access to local variable b3 : B | semmle.label | access to local variable b3 : B |
|
||||
| extensions.cs:185:13:185:14 | access to local variable b3 : B | semmle.label | access to local variable b3 : B |
|
||||
| extensions.cs:185:18:185:24 | call to operator - : B | semmle.label | call to operator - : B |
|
||||
| extensions.cs:185:18:185:24 | call to operator - : B | semmle.label | call to operator - : B |
|
||||
| extensions.cs:186:14:186:15 | access to local variable b3 | semmle.label | access to local variable b3 |
|
||||
| extensions.cs:186:14:186:15 | access to local variable b3 | semmle.label | access to local variable b3 |
|
||||
| extensions.cs:188:13:188:14 | access to local variable b4 : B | semmle.label | access to local variable b4 : B |
|
||||
| extensions.cs:188:13:188:14 | access to local variable b4 : B | semmle.label | access to local variable b4 : B |
|
||||
| extensions.cs:188:18:188:52 | call to operator - : B | semmle.label | call to operator - : B |
|
||||
| extensions.cs:188:18:188:52 | call to operator - : B | semmle.label | call to operator - : B |
|
||||
| extensions.cs:189:14:189:15 | access to local variable b4 | semmle.label | access to local variable b4 |
|
||||
| extensions.cs:189:14:189:15 | access to local variable b4 | semmle.label | access to local variable b4 |
|
||||
| extensions.cs:194:13:194:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:194:13:194:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:194:18:194:35 | access to property StaticProp1 : B | semmle.label | access to property StaticProp1 : B |
|
||||
| extensions.cs:194:18:194:35 | access to property StaticProp1 : B | semmle.label | access to property StaticProp1 : B |
|
||||
| extensions.cs:195:14:195:15 | access to local variable b1 | semmle.label | access to local variable b1 |
|
||||
| extensions.cs:195:14:195:15 | access to local variable b1 | semmle.label | access to local variable b1 |
|
||||
| extensions.cs:197:13:197:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:197:13:197:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:197:18:197:47 | call to extension accessor get_StaticProp1 : B | semmle.label | call to extension accessor get_StaticProp1 : B |
|
||||
| extensions.cs:197:18:197:47 | call to extension accessor get_StaticProp1 : B | semmle.label | call to extension accessor get_StaticProp1 : B |
|
||||
| extensions.cs:198:14:198:15 | access to local variable b2 | semmle.label | access to local variable b2 |
|
||||
| extensions.cs:198:14:198:15 | access to local variable b2 | semmle.label | access to local variable b2 |
|
||||
| extensions.cs:203:13:203:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:203:13:203:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:203:18:203:30 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:203:18:203:30 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:204:30:204:31 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:204:30:204:31 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:206:13:206:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:206:13:206:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:206:18:206:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:206:18:206:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:207:38:207:39 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:207:38:207:39 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:212:13:212:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:212:13:212:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:212:18:212:30 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:212:18:212:30 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:213:9:213:10 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:213:9:213:10 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:215:13:215:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:215:13:215:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:215:18:215:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:215:18:215:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:216:25:216:26 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:216:25:216:26 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:221:13:221:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:221:13:221:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:221:18:221:30 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:221:18:221:30 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:222:9:222:10 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:222:9:222:10 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:224:13:224:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:224:13:224:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:224:18:224:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:224:18:224:31 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:225:32:225:33 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:225:32:225:33 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:231:13:231:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:231:13:231:14 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:231:18:231:30 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:231:18:231:30 | call to method Source<B> : B | semmle.label | call to method Source<B> : B |
|
||||
| extensions.cs:232:13:232:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:232:13:232:14 | access to local variable b2 : B | semmle.label | access to local variable b2 : B |
|
||||
| extensions.cs:232:18:232:34 | call to method GenericM2<B> : B | semmle.label | call to method GenericM2<B> : B |
|
||||
| extensions.cs:232:18:232:34 | call to method GenericM2<B> : B | semmle.label | call to method GenericM2<B> : B |
|
||||
| extensions.cs:232:32:232:33 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:232:32:232:33 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:233:14:233:15 | access to local variable b2 | semmle.label | access to local variable b2 |
|
||||
| extensions.cs:233:14:233:15 | access to local variable b2 | semmle.label | access to local variable b2 |
|
||||
| extensions.cs:235:13:235:14 | access to local variable b3 : B | semmle.label | access to local variable b3 : B |
|
||||
| extensions.cs:235:13:235:14 | access to local variable b3 : B | semmle.label | access to local variable b3 : B |
|
||||
| extensions.cs:235:18:235:48 | call to method GenericM2<B> : B | semmle.label | call to method GenericM2<B> : B |
|
||||
| extensions.cs:235:18:235:48 | call to method GenericM2<B> : B | semmle.label | call to method GenericM2<B> : B |
|
||||
| extensions.cs:235:46:235:47 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:235:46:235:47 | access to local variable b1 : B | semmle.label | access to local variable b1 : B |
|
||||
| extensions.cs:236:14:236:15 | access to local variable b3 | semmle.label | access to local variable b3 |
|
||||
| extensions.cs:236:14:236:15 | access to local variable b3 | semmle.label | access to local variable b3 |
|
||||
subpaths
|
||||
| extensions.cs:146:18:146:19 | access to local variable b1 : B | extensions.cs:76:17:76:17 | b : B | extensions.cs:80:20:80:20 | access to extension synthetic parameter b : B | extensions.cs:146:18:146:24 | call to method B1 : B |
|
||||
| extensions.cs:146:18:146:19 | access to local variable b1 : B | extensions.cs:76:17:76:17 | b : B | extensions.cs:80:20:80:20 | access to extension synthetic parameter b : B | extensions.cs:146:18:146:24 | call to method B1 : B |
|
||||
| extensions.cs:149:34:149:35 | access to local variable b1 : B | extensions.cs:76:17:76:17 | b : B | extensions.cs:80:20:80:20 | access to extension synthetic parameter b : B | extensions.cs:149:18:149:36 | call to method B1 : B |
|
||||
| extensions.cs:149:34:149:35 | access to local variable b1 : B | extensions.cs:76:17:76:17 | b : B | extensions.cs:80:20:80:20 | access to extension synthetic parameter b : B | extensions.cs:149:18:149:36 | call to method B1 : B |
|
||||
| extensions.cs:232:32:232:33 | access to local variable b1 : B | extensions.cs:96:33:96:37 | other : B | extensions.cs:98:20:98:24 | access to parameter other : B | extensions.cs:232:18:232:34 | call to method GenericM2<B> : B |
|
||||
| extensions.cs:232:32:232:33 | access to local variable b1 : B | extensions.cs:96:33:96:37 | other : B | extensions.cs:98:20:98:24 | access to parameter other : B | extensions.cs:232:18:232:34 | call to method GenericM2<B> : B |
|
||||
| extensions.cs:235:46:235:47 | access to local variable b1 : B | extensions.cs:96:33:96:37 | other : B | extensions.cs:98:20:98:24 | access to parameter other : B | extensions.cs:235:18:235:48 | call to method GenericM2<B> : B |
|
||||
| extensions.cs:235:46:235:47 | access to local variable b1 : B | extensions.cs:96:33:96:37 | other : B | extensions.cs:98:20:98:24 | access to parameter other : B | extensions.cs:235:18:235:48 | call to method GenericM2<B> : B |
|
||||
testFailures
|
||||
#select
|
||||
| extensions.cs:15:24:15:28 | access to parameter value | extensions.cs:118:21:118:32 | call to method Source<B> : B | extensions.cs:15:24:15:28 | access to parameter value | $@ | extensions.cs:118:21:118:32 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:15:24:15:28 | access to parameter value | extensions.cs:118:21:118:32 | call to method Source<B> : B | extensions.cs:15:24:15:28 | access to parameter value | $@ | extensions.cs:118:21:118:32 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:15:24:15:28 | access to parameter value | extensions.cs:120:17:120:30 | call to method Source<B> : B | extensions.cs:15:24:15:28 | access to parameter value | $@ | extensions.cs:120:17:120:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:15:24:15:28 | access to parameter value | extensions.cs:120:17:120:30 | call to method Source<B> : B | extensions.cs:15:24:15:28 | access to parameter value | $@ | extensions.cs:120:17:120:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | extensions.cs:155:18:155:29 | call to method Source<B> : B | extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | $@ | extensions.cs:155:18:155:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | extensions.cs:155:18:155:29 | call to method Source<B> : B | extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | $@ | extensions.cs:155:18:155:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | extensions.cs:158:18:158:31 | call to method Source<B> : B | extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | $@ | extensions.cs:158:18:158:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | extensions.cs:158:18:158:31 | call to method Source<B> : B | extensions.cs:23:24:23:26 | access to extension synthetic parameter obj | $@ | extensions.cs:158:18:158:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | extensions.cs:164:18:164:29 | call to method Source<B> : B | extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | $@ | extensions.cs:164:18:164:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | extensions.cs:164:18:164:29 | call to method Source<B> : B | extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | $@ | extensions.cs:164:18:164:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | extensions.cs:167:18:167:31 | call to method Source<B> : B | extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | $@ | extensions.cs:167:18:167:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | extensions.cs:167:18:167:31 | call to method Source<B> : B | extensions.cs:28:24:28:26 | access to extension synthetic parameter obj | $@ | extensions.cs:167:18:167:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:40:24:40:28 | access to parameter value | extensions.cs:203:18:203:30 | call to method Source<B> : B | extensions.cs:40:24:40:28 | access to parameter value | $@ | extensions.cs:203:18:203:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:40:24:40:28 | access to parameter value | extensions.cs:203:18:203:30 | call to method Source<B> : B | extensions.cs:40:24:40:28 | access to parameter value | $@ | extensions.cs:203:18:203:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:40:24:40:28 | access to parameter value | extensions.cs:206:18:206:31 | call to method Source<B> : B | extensions.cs:40:24:40:28 | access to parameter value | $@ | extensions.cs:206:18:206:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:40:24:40:28 | access to parameter value | extensions.cs:206:18:206:31 | call to method Source<B> : B | extensions.cs:40:24:40:28 | access to parameter value | $@ | extensions.cs:206:18:206:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | extensions.cs:136:18:136:29 | call to method Source<B> : B | extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | $@ | extensions.cs:136:18:136:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | extensions.cs:136:18:136:29 | call to method Source<B> : B | extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | $@ | extensions.cs:136:18:136:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | extensions.cs:139:18:139:31 | call to method Source<B> : B | extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | $@ | extensions.cs:139:18:139:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | extensions.cs:139:18:139:31 | call to method Source<B> : B | extensions.cs:51:20:51:22 | access to extension synthetic parameter obj | $@ | extensions.cs:139:18:139:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:61:20:61:20 | access to parameter a | extensions.cs:173:18:173:29 | call to method Source<B> : B | extensions.cs:61:20:61:20 | access to parameter a | $@ | extensions.cs:173:18:173:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:61:20:61:20 | access to parameter a | extensions.cs:173:18:173:29 | call to method Source<B> : B | extensions.cs:61:20:61:20 | access to parameter a | $@ | extensions.cs:173:18:173:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:61:20:61:20 | access to parameter a | extensions.cs:177:18:177:31 | call to method Source<B> : B | extensions.cs:61:20:61:20 | access to parameter a | $@ | extensions.cs:177:18:177:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:61:20:61:20 | access to parameter a | extensions.cs:177:18:177:31 | call to method Source<B> : B | extensions.cs:61:20:61:20 | access to parameter a | $@ | extensions.cs:177:18:177:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:85:20:85:20 | access to extension synthetic parameter b | extensions.cs:212:18:212:30 | call to method Source<B> : B | extensions.cs:85:20:85:20 | access to extension synthetic parameter b | $@ | extensions.cs:212:18:212:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:85:20:85:20 | access to extension synthetic parameter b | extensions.cs:212:18:212:30 | call to method Source<B> : B | extensions.cs:85:20:85:20 | access to extension synthetic parameter b | $@ | extensions.cs:212:18:212:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:85:20:85:20 | access to extension synthetic parameter b | extensions.cs:215:18:215:31 | call to method Source<B> : B | extensions.cs:85:20:85:20 | access to extension synthetic parameter b | $@ | extensions.cs:215:18:215:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:85:20:85:20 | access to extension synthetic parameter b | extensions.cs:215:18:215:31 | call to method Source<B> : B | extensions.cs:85:20:85:20 | access to extension synthetic parameter b | $@ | extensions.cs:215:18:215:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:93:20:93:20 | access to extension synthetic parameter t | extensions.cs:221:18:221:30 | call to method Source<B> : B | extensions.cs:93:20:93:20 | access to extension synthetic parameter t | $@ | extensions.cs:221:18:221:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:93:20:93:20 | access to extension synthetic parameter t | extensions.cs:221:18:221:30 | call to method Source<B> : B | extensions.cs:93:20:93:20 | access to extension synthetic parameter t | $@ | extensions.cs:221:18:221:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:93:20:93:20 | access to extension synthetic parameter t | extensions.cs:224:18:224:31 | call to method Source<B> : B | extensions.cs:93:20:93:20 | access to extension synthetic parameter t | $@ | extensions.cs:224:18:224:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:93:20:93:20 | access to extension synthetic parameter t | extensions.cs:224:18:224:31 | call to method Source<B> : B | extensions.cs:93:20:93:20 | access to extension synthetic parameter t | $@ | extensions.cs:224:18:224:31 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:109:14:109:15 | access to local variable b1 | extensions.cs:11:24:11:37 | call to method Source<B> : B | extensions.cs:109:14:109:15 | access to local variable b1 | $@ | extensions.cs:11:24:11:37 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:109:14:109:15 | access to local variable b1 | extensions.cs:11:24:11:37 | call to method Source<B> : B | extensions.cs:109:14:109:15 | access to local variable b1 | $@ | extensions.cs:11:24:11:37 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:112:14:112:15 | access to local variable b2 | extensions.cs:11:24:11:37 | call to method Source<B> : B | extensions.cs:112:14:112:15 | access to local variable b2 | $@ | extensions.cs:11:24:11:37 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:112:14:112:15 | access to local variable b2 | extensions.cs:11:24:11:37 | call to method Source<B> : B | extensions.cs:112:14:112:15 | access to local variable b2 | $@ | extensions.cs:11:24:11:37 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:128:14:128:15 | access to local variable b1 | extensions.cs:46:20:46:33 | call to method Source<B> : B | extensions.cs:128:14:128:15 | access to local variable b1 | $@ | extensions.cs:46:20:46:33 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:128:14:128:15 | access to local variable b1 | extensions.cs:46:20:46:33 | call to method Source<B> : B | extensions.cs:128:14:128:15 | access to local variable b1 | $@ | extensions.cs:46:20:46:33 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:131:14:131:15 | access to local variable b2 | extensions.cs:46:20:46:33 | call to method Source<B> : B | extensions.cs:131:14:131:15 | access to local variable b2 | $@ | extensions.cs:46:20:46:33 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:131:14:131:15 | access to local variable b2 | extensions.cs:46:20:46:33 | call to method Source<B> : B | extensions.cs:131:14:131:15 | access to local variable b2 | $@ | extensions.cs:46:20:46:33 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:147:14:147:15 | access to local variable b2 | extensions.cs:145:18:145:29 | call to method Source<B> : B | extensions.cs:147:14:147:15 | access to local variable b2 | $@ | extensions.cs:145:18:145:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:147:14:147:15 | access to local variable b2 | extensions.cs:145:18:145:29 | call to method Source<B> : B | extensions.cs:147:14:147:15 | access to local variable b2 | $@ | extensions.cs:145:18:145:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:150:14:150:15 | access to local variable b3 | extensions.cs:145:18:145:29 | call to method Source<B> : B | extensions.cs:150:14:150:15 | access to local variable b3 | $@ | extensions.cs:145:18:145:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:150:14:150:15 | access to local variable b3 | extensions.cs:145:18:145:29 | call to method Source<B> : B | extensions.cs:150:14:150:15 | access to local variable b3 | $@ | extensions.cs:145:18:145:29 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:186:14:186:15 | access to local variable b3 | extensions.cs:67:20:67:33 | call to method Source<B> : B | extensions.cs:186:14:186:15 | access to local variable b3 | $@ | extensions.cs:67:20:67:33 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:186:14:186:15 | access to local variable b3 | extensions.cs:67:20:67:33 | call to method Source<B> : B | extensions.cs:186:14:186:15 | access to local variable b3 | $@ | extensions.cs:67:20:67:33 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:189:14:189:15 | access to local variable b4 | extensions.cs:67:20:67:33 | call to method Source<B> : B | extensions.cs:189:14:189:15 | access to local variable b4 | $@ | extensions.cs:67:20:67:33 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:189:14:189:15 | access to local variable b4 | extensions.cs:67:20:67:33 | call to method Source<B> : B | extensions.cs:189:14:189:15 | access to local variable b4 | $@ | extensions.cs:67:20:67:33 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:195:14:195:15 | access to local variable b1 | extensions.cs:36:24:36:38 | call to method Source<B> : B | extensions.cs:195:14:195:15 | access to local variable b1 | $@ | extensions.cs:36:24:36:38 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:195:14:195:15 | access to local variable b1 | extensions.cs:36:24:36:38 | call to method Source<B> : B | extensions.cs:195:14:195:15 | access to local variable b1 | $@ | extensions.cs:36:24:36:38 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:198:14:198:15 | access to local variable b2 | extensions.cs:36:24:36:38 | call to method Source<B> : B | extensions.cs:198:14:198:15 | access to local variable b2 | $@ | extensions.cs:36:24:36:38 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:198:14:198:15 | access to local variable b2 | extensions.cs:36:24:36:38 | call to method Source<B> : B | extensions.cs:198:14:198:15 | access to local variable b2 | $@ | extensions.cs:36:24:36:38 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:233:14:233:15 | access to local variable b2 | extensions.cs:231:18:231:30 | call to method Source<B> : B | extensions.cs:233:14:233:15 | access to local variable b2 | $@ | extensions.cs:231:18:231:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:233:14:233:15 | access to local variable b2 | extensions.cs:231:18:231:30 | call to method Source<B> : B | extensions.cs:233:14:233:15 | access to local variable b2 | $@ | extensions.cs:231:18:231:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:236:14:236:15 | access to local variable b3 | extensions.cs:231:18:231:30 | call to method Source<B> : B | extensions.cs:236:14:236:15 | access to local variable b3 | $@ | extensions.cs:231:18:231:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
| extensions.cs:236:14:236:15 | access to local variable b3 | extensions.cs:231:18:231:30 | call to method Source<B> : B | extensions.cs:236:14:236:15 | access to local variable b3 | $@ | extensions.cs:231:18:231:30 | call to method Source<B> : B | call to method Source<B> : B |
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @kind path-problem
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import utils.test.InlineFlowTest
|
||||
import DefaultFlowTest
|
||||
import PathGraph
|
||||
|
||||
from PathNode source, PathNode sink
|
||||
where flowPath(source, sink)
|
||||
select sink, source, sink, "$@", source, source.toString()
|
||||
243
csharp/ql/test/library-tests/dataflow/extensions/extensions.cs
Normal file
243
csharp/ql/test/library-tests/dataflow/extensions/extensions.cs
Normal file
@@ -0,0 +1,243 @@
|
||||
using System;
|
||||
|
||||
public static class MyExtensions
|
||||
{
|
||||
extension(object obj)
|
||||
{
|
||||
public B Prop1
|
||||
{
|
||||
get
|
||||
{
|
||||
return A.Source<B>(1);
|
||||
}
|
||||
set
|
||||
{
|
||||
A.Sink(value); // $ hasValueFlow=2 hasValueFlow=102
|
||||
}
|
||||
}
|
||||
|
||||
public B Prop2
|
||||
{
|
||||
get
|
||||
{
|
||||
A.Sink(obj); // $ hasValueFlow=6 hasValueFlow=106
|
||||
return new B();
|
||||
}
|
||||
set
|
||||
{
|
||||
A.Sink(obj); // $ hasValueFlow=7 hasValueFlow=107
|
||||
}
|
||||
}
|
||||
|
||||
public static B StaticProp1
|
||||
{
|
||||
get
|
||||
{
|
||||
return A.Source<B>(10);
|
||||
}
|
||||
set
|
||||
{
|
||||
A.Sink(value); // $ hasValueFlow=11 hasValueFlow=111
|
||||
}
|
||||
}
|
||||
|
||||
public B M1()
|
||||
{
|
||||
return A.Source<B>(3);
|
||||
}
|
||||
|
||||
public void M2()
|
||||
{
|
||||
A.Sink(obj); // $ hasValueFlow=4 hasValueFlow=104
|
||||
}
|
||||
|
||||
public static B M3(B b)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
public static object operator +(object a, object b)
|
||||
{
|
||||
A.Sink(a); // $ hasValueFlow=8 hasValueFlow=108
|
||||
return new object();
|
||||
}
|
||||
|
||||
public static object operator -(object a, object b)
|
||||
{
|
||||
return A.Source<B>(9);
|
||||
}
|
||||
|
||||
public T GenericMethod<T>(T t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
extension(B b)
|
||||
{
|
||||
public B B1()
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
public void B2()
|
||||
{
|
||||
A.Sink(b); // $ hasValueFlow=12 hasValueFlow=112
|
||||
}
|
||||
}
|
||||
|
||||
extension<T>(T t) where T : class
|
||||
{
|
||||
public void GenericM1()
|
||||
{
|
||||
A.Sink(t); // $ hasValueFlow=13 hasValueFlow=113
|
||||
}
|
||||
|
||||
public S GenericM2<S>(S other)
|
||||
{
|
||||
return other;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class A
|
||||
{
|
||||
public void Test1()
|
||||
{
|
||||
var obj = new object();
|
||||
var b1 = obj.Prop1;
|
||||
Sink(b1); // $ hasValueFlow=1
|
||||
|
||||
var b2 = MyExtensions.get_Prop1(obj);
|
||||
Sink(b2); // $ hasValueFlow=1
|
||||
}
|
||||
|
||||
public void Test2()
|
||||
{
|
||||
var obj = new object();
|
||||
obj.Prop1 = Source<B>(2);
|
||||
|
||||
var b = Source<B>(102);
|
||||
MyExtensions.set_Prop1(obj, b);
|
||||
}
|
||||
|
||||
public void Test3()
|
||||
{
|
||||
var obj = new object();
|
||||
var b1 = obj.M1();
|
||||
Sink(b1); // $ hasValueFlow=3
|
||||
|
||||
var b2 = MyExtensions.M1(obj);
|
||||
Sink(b2); // $ hasValueFlow=3
|
||||
}
|
||||
|
||||
public void Test4()
|
||||
{
|
||||
var b1 = Source<B>(4);
|
||||
b1.M2();
|
||||
|
||||
var b2 = Source<B>(104);
|
||||
MyExtensions.M2(b2);
|
||||
}
|
||||
|
||||
public void Test5()
|
||||
{
|
||||
var b1 = Source<B>(5);
|
||||
var b2 = b1.B1();
|
||||
Sink(b2); // $ hasValueFlow=5
|
||||
|
||||
var b3 = MyExtensions.B1(b1);
|
||||
Sink(b3); // $ hasValueFlow=5
|
||||
}
|
||||
|
||||
public void Test6()
|
||||
{
|
||||
var b1 = Source<B>(6);
|
||||
var b2 = b1.Prop2;
|
||||
|
||||
var b3 = Source<B>(106);
|
||||
var b4 = MyExtensions.get_Prop2(b3);
|
||||
}
|
||||
|
||||
public void Test7()
|
||||
{
|
||||
var b1 = Source<B>(7);
|
||||
b1.Prop2 = new B();
|
||||
|
||||
var b2 = Source<B>(107);
|
||||
MyExtensions.set_Prop2(b2, new B());
|
||||
}
|
||||
|
||||
public void Test8()
|
||||
{
|
||||
var b1 = Source<B>(8);
|
||||
var b2 = Source<B>(1);
|
||||
var b3 = b1 + b2;
|
||||
|
||||
var b4 = Source<B>(108);
|
||||
var b5 = MyExtensions.op_Addition(b4, b2);
|
||||
}
|
||||
|
||||
public void Test9()
|
||||
{
|
||||
var b1 = Source<B>(0);
|
||||
var b2 = Source<B>(1);
|
||||
var b3 = b1 - b2;
|
||||
Sink(b3); // $ hasValueFlow=9
|
||||
|
||||
var b4 = MyExtensions.op_Subtraction(b1, b2);
|
||||
Sink(b4); // $ hasValueFlow=9
|
||||
}
|
||||
|
||||
public void Test10()
|
||||
{
|
||||
var b1 = object.StaticProp1;
|
||||
Sink(b1); // $ hasValueFlow=10
|
||||
|
||||
var b2 = MyExtensions.get_StaticProp1();
|
||||
Sink(b2); // $ hasValueFlow=10
|
||||
}
|
||||
|
||||
public void Test11()
|
||||
{
|
||||
var b1 = Source<B>(11);
|
||||
object.StaticProp1 = b1;
|
||||
|
||||
var b2 = Source<B>(111);
|
||||
MyExtensions.set_StaticProp1(b2);
|
||||
}
|
||||
|
||||
public void Test12()
|
||||
{
|
||||
var b1 = Source<B>(12);
|
||||
b1.B2();
|
||||
|
||||
var b2 = Source<B>(112);
|
||||
MyExtensions.B2(b2);
|
||||
}
|
||||
|
||||
public void Test13()
|
||||
{
|
||||
var b1 = Source<B>(13);
|
||||
b1.GenericM1();
|
||||
|
||||
var b2 = Source<B>(113);
|
||||
MyExtensions.GenericM1(b2);
|
||||
}
|
||||
|
||||
public void Test14()
|
||||
{
|
||||
var obj = new object();
|
||||
var b1 = Source<B>(14);
|
||||
var b2 = obj.GenericM2(b1);
|
||||
Sink(b2); // $ hasValueFlow=14
|
||||
|
||||
var b3 = MyExtensions.GenericM2(obj, b1);
|
||||
Sink(b3); // $ hasValueFlow=14
|
||||
}
|
||||
|
||||
public static T Source<T>(object source) => throw null;
|
||||
public static void Sink(object o) { }
|
||||
}
|
||||
|
||||
public class B { }
|
||||
@@ -348,4 +348,98 @@ namespace My.Qltest
|
||||
static void Sink(object o) { }
|
||||
}
|
||||
|
||||
// Test extensions
|
||||
public static class TestExtensions
|
||||
{
|
||||
extension(object o)
|
||||
{
|
||||
public object Method1() => throw null;
|
||||
public static object StaticMethod1(object s) => throw null;
|
||||
public object Property1 { get { throw null; } set { throw null; } }
|
||||
}
|
||||
|
||||
extension<T>(T t) where T : class
|
||||
{
|
||||
public T GenericMethod1() => throw null;
|
||||
public static T GenericStaticMethod1(T t0) => throw null;
|
||||
public T GenericProperty1 { get { throw null; } set { throw null; } }
|
||||
}
|
||||
}
|
||||
|
||||
public class M
|
||||
{
|
||||
public void M1()
|
||||
{
|
||||
var obj = new object();
|
||||
var o1 = obj.Method1();
|
||||
Sink(o1);
|
||||
|
||||
var o2 = TestExtensions.Method1(obj);
|
||||
Sink(o2);
|
||||
}
|
||||
|
||||
public void M2()
|
||||
{
|
||||
var obj = new object();
|
||||
var o1 = object.StaticMethod1(obj);
|
||||
Sink(o1);
|
||||
|
||||
var o2 = TestExtensions.StaticMethod1(obj);
|
||||
Sink(o2);
|
||||
}
|
||||
|
||||
public void M3(object o)
|
||||
{
|
||||
var obj = new object();
|
||||
o.Property1 = obj;
|
||||
var o1 = o.Property1;
|
||||
Sink(o1);
|
||||
}
|
||||
|
||||
public void M4(object o)
|
||||
{
|
||||
var obj = new object();
|
||||
TestExtensions.set_Property1(o, obj);
|
||||
var o1 = TestExtensions.get_Property1(o);
|
||||
Sink(o1);
|
||||
}
|
||||
|
||||
public void M5()
|
||||
{
|
||||
var obj = new object();
|
||||
var o1 = obj.GenericMethod1();
|
||||
Sink(o1);
|
||||
|
||||
var o2 = TestExtensions.GenericMethod1(obj);
|
||||
Sink(o2);
|
||||
}
|
||||
|
||||
public void M6()
|
||||
{
|
||||
var obj = new object();
|
||||
var o1 = object.GenericStaticMethod1(obj);
|
||||
Sink(o1);
|
||||
|
||||
var o2 = TestExtensions.GenericStaticMethod1(obj);
|
||||
Sink(o2);
|
||||
}
|
||||
|
||||
public void M7(object o)
|
||||
{
|
||||
var obj = new object();
|
||||
o.GenericProperty1 = obj;
|
||||
var o1 = o.GenericProperty1;
|
||||
Sink(o1);
|
||||
}
|
||||
|
||||
public void M8(object o)
|
||||
{
|
||||
var obj = new object();
|
||||
TestExtensions.set_GenericProperty1(o, obj);
|
||||
var o1 = TestExtensions.get_GenericProperty1(o);
|
||||
Sink(o1);
|
||||
}
|
||||
|
||||
static void Sink(object o) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,14 @@ models
|
||||
| 31 | Summary: My.Qltest; Library; false; GetValue; (); ; Argument[this].SyntheticField[X]; ReturnValue; value; dfc-generated |
|
||||
| 32 | Summary: My.Qltest; Library; false; MixedFlowArgs; (System.Object,System.Object); ; Argument[1]; ReturnValue; value; manual |
|
||||
| 33 | Summary: My.Qltest; Library; false; SetValue; (System.Object); ; Argument[0]; Argument[this].SyntheticField[X]; value; dfc-generated |
|
||||
| 34 | Summary: My.Qltest; TestExtensions+extension(System.Object); false; Method1; (System.Object); ; Argument[0]; ReturnValue; value; manual |
|
||||
| 35 | Summary: My.Qltest; TestExtensions+extension(System.Object); false; StaticMethod1; (System.Object); ; Argument[0]; ReturnValue; value; manual |
|
||||
| 36 | Summary: My.Qltest; TestExtensions+extension(System.Object); false; get_Property1; (System.Object); ; Argument[0].SyntheticField[TestExtensions.Property1]; ReturnValue; value; manual |
|
||||
| 37 | Summary: My.Qltest; TestExtensions+extension(System.Object); false; set_Property1; (System.Object,System.Object); ; Argument[1]; Argument[0].SyntheticField[TestExtensions.Property1]; value; manual |
|
||||
| 38 | Summary: My.Qltest; TestExtensions+extension(T)<T>; false; GenericMethod1; (T); ; Argument[0]; ReturnValue; value; manual |
|
||||
| 39 | Summary: My.Qltest; TestExtensions+extension(T)<T>; false; GenericStaticMethod1; (T); ; Argument[0]; ReturnValue; value; manual |
|
||||
| 40 | Summary: My.Qltest; TestExtensions+extension(T)<T>; false; get_GenericProperty1; (T); ; Argument[0].SyntheticField[TestExtensions.GenericProperty1]; ReturnValue; value; manual |
|
||||
| 41 | Summary: My.Qltest; TestExtensions+extension(T)<T>; false; set_GenericProperty1; (T,T); ; Argument[1]; Argument[0].SyntheticField[TestExtensions.GenericProperty1]; value; manual |
|
||||
edges
|
||||
| ExternalFlow.cs:9:20:9:23 | access to local variable arg1 : Object | ExternalFlow.cs:10:29:10:32 | access to local variable arg1 : Object | provenance | |
|
||||
| ExternalFlow.cs:9:27:9:38 | object creation of type Object : Object | ExternalFlow.cs:9:20:9:23 | access to local variable arg1 : Object | provenance | |
|
||||
@@ -150,6 +158,73 @@ edges
|
||||
| ExternalFlow.cs:344:13:344:13 | [post] access to local variable l : Library [synthetic X] : Object | ExternalFlow.cs:345:18:345:18 | access to local variable l : Library [synthetic X] : Object | provenance | |
|
||||
| ExternalFlow.cs:344:24:344:24 | access to local variable o : Object | ExternalFlow.cs:344:13:344:13 | [post] access to local variable l : Library [synthetic X] : Object | provenance | MaD:33 |
|
||||
| ExternalFlow.cs:345:18:345:18 | access to local variable l : Library [synthetic X] : Object | ExternalFlow.cs:345:18:345:29 | call to method GetValue | provenance | MaD:31 |
|
||||
| ExternalFlow.cs:373:17:373:19 | access to local variable obj : Object | ExternalFlow.cs:374:22:374:24 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:373:17:373:19 | access to local variable obj : Object | ExternalFlow.cs:377:45:377:47 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:373:23:373:34 | object creation of type Object : Object | ExternalFlow.cs:373:17:373:19 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:374:17:374:18 | access to local variable o1 : Object | ExternalFlow.cs:375:18:375:19 | access to local variable o1 | provenance | |
|
||||
| ExternalFlow.cs:374:22:374:24 | access to local variable obj : Object | ExternalFlow.cs:374:22:374:34 | call to method Method1 : Object | provenance | MaD:34 |
|
||||
| ExternalFlow.cs:374:22:374:34 | call to method Method1 : Object | ExternalFlow.cs:374:17:374:18 | access to local variable o1 : Object | provenance | |
|
||||
| ExternalFlow.cs:377:17:377:18 | access to local variable o2 : Object | ExternalFlow.cs:378:18:378:19 | access to local variable o2 | provenance | |
|
||||
| ExternalFlow.cs:377:22:377:48 | call to method Method1 : Object | ExternalFlow.cs:377:17:377:18 | access to local variable o2 : Object | provenance | |
|
||||
| ExternalFlow.cs:377:45:377:47 | access to local variable obj : Object | ExternalFlow.cs:377:22:377:48 | call to method Method1 : Object | provenance | MaD:34 |
|
||||
| ExternalFlow.cs:383:17:383:19 | access to local variable obj : Object | ExternalFlow.cs:384:43:384:45 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:383:17:383:19 | access to local variable obj : Object | ExternalFlow.cs:387:51:387:53 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:383:23:383:34 | object creation of type Object : Object | ExternalFlow.cs:383:17:383:19 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:384:17:384:18 | access to local variable o1 : Object | ExternalFlow.cs:385:18:385:19 | access to local variable o1 | provenance | |
|
||||
| ExternalFlow.cs:384:22:384:46 | call to method StaticMethod1 : Object | ExternalFlow.cs:384:17:384:18 | access to local variable o1 : Object | provenance | |
|
||||
| ExternalFlow.cs:384:43:384:45 | access to local variable obj : Object | ExternalFlow.cs:384:22:384:46 | call to method StaticMethod1 : Object | provenance | MaD:35 |
|
||||
| ExternalFlow.cs:387:17:387:18 | access to local variable o2 : Object | ExternalFlow.cs:388:18:388:19 | access to local variable o2 | provenance | |
|
||||
| ExternalFlow.cs:387:22:387:54 | call to method StaticMethod1 : Object | ExternalFlow.cs:387:17:387:18 | access to local variable o2 : Object | provenance | |
|
||||
| ExternalFlow.cs:387:51:387:53 | access to local variable obj : Object | ExternalFlow.cs:387:22:387:54 | call to method StaticMethod1 : Object | provenance | MaD:35 |
|
||||
| ExternalFlow.cs:393:17:393:19 | access to local variable obj : Object | ExternalFlow.cs:394:27:394:29 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:393:23:393:34 | object creation of type Object : Object | ExternalFlow.cs:393:17:393:19 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:394:13:394:13 | [post] access to parameter o : Object [synthetic TestExtensions.Property1] : Object | ExternalFlow.cs:395:22:395:22 | access to parameter o : Object [synthetic TestExtensions.Property1] : Object | provenance | |
|
||||
| ExternalFlow.cs:394:27:394:29 | access to local variable obj : Object | ExternalFlow.cs:394:13:394:13 | [post] access to parameter o : Object [synthetic TestExtensions.Property1] : Object | provenance | MaD:37 |
|
||||
| ExternalFlow.cs:395:17:395:18 | access to local variable o1 : Object | ExternalFlow.cs:396:18:396:19 | access to local variable o1 | provenance | |
|
||||
| ExternalFlow.cs:395:22:395:22 | access to parameter o : Object [synthetic TestExtensions.Property1] : Object | ExternalFlow.cs:395:22:395:32 | access to property Property1 : Object | provenance | MaD:36 |
|
||||
| ExternalFlow.cs:395:22:395:32 | access to property Property1 : Object | ExternalFlow.cs:395:17:395:18 | access to local variable o1 : Object | provenance | |
|
||||
| ExternalFlow.cs:401:17:401:19 | access to local variable obj : Object | ExternalFlow.cs:402:45:402:47 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:401:23:401:34 | object creation of type Object : Object | ExternalFlow.cs:401:17:401:19 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:402:42:402:42 | [post] access to parameter o : Object [synthetic TestExtensions.Property1] : Object | ExternalFlow.cs:403:51:403:51 | access to parameter o : Object [synthetic TestExtensions.Property1] : Object | provenance | |
|
||||
| ExternalFlow.cs:402:45:402:47 | access to local variable obj : Object | ExternalFlow.cs:402:42:402:42 | [post] access to parameter o : Object [synthetic TestExtensions.Property1] : Object | provenance | MaD:37 |
|
||||
| ExternalFlow.cs:403:17:403:18 | access to local variable o1 : Object | ExternalFlow.cs:404:18:404:19 | access to local variable o1 | provenance | |
|
||||
| ExternalFlow.cs:403:22:403:52 | call to extension accessor get_Property1 : Object | ExternalFlow.cs:403:17:403:18 | access to local variable o1 : Object | provenance | |
|
||||
| ExternalFlow.cs:403:51:403:51 | access to parameter o : Object [synthetic TestExtensions.Property1] : Object | ExternalFlow.cs:403:22:403:52 | call to extension accessor get_Property1 : Object | provenance | MaD:36 |
|
||||
| ExternalFlow.cs:409:17:409:19 | access to local variable obj : Object | ExternalFlow.cs:410:22:410:24 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:409:17:409:19 | access to local variable obj : Object | ExternalFlow.cs:413:52:413:54 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:409:23:409:34 | object creation of type Object : Object | ExternalFlow.cs:409:17:409:19 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:410:17:410:18 | access to local variable o1 : Object | ExternalFlow.cs:411:18:411:19 | access to local variable o1 | provenance | |
|
||||
| ExternalFlow.cs:410:22:410:24 | access to local variable obj : Object | ExternalFlow.cs:410:22:410:41 | call to method GenericMethod1 : Object | provenance | MaD:38 |
|
||||
| ExternalFlow.cs:410:22:410:41 | call to method GenericMethod1 : Object | ExternalFlow.cs:410:17:410:18 | access to local variable o1 : Object | provenance | |
|
||||
| ExternalFlow.cs:413:17:413:18 | access to local variable o2 : Object | ExternalFlow.cs:414:18:414:19 | access to local variable o2 | provenance | |
|
||||
| ExternalFlow.cs:413:22:413:55 | call to method GenericMethod1 : Object | ExternalFlow.cs:413:17:413:18 | access to local variable o2 : Object | provenance | |
|
||||
| ExternalFlow.cs:413:52:413:54 | access to local variable obj : Object | ExternalFlow.cs:413:22:413:55 | call to method GenericMethod1 : Object | provenance | MaD:38 |
|
||||
| ExternalFlow.cs:419:17:419:19 | access to local variable obj : Object | ExternalFlow.cs:420:50:420:52 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:419:17:419:19 | access to local variable obj : Object | ExternalFlow.cs:423:58:423:60 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:419:23:419:34 | object creation of type Object : Object | ExternalFlow.cs:419:17:419:19 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:420:17:420:18 | access to local variable o1 : Object | ExternalFlow.cs:421:18:421:19 | access to local variable o1 | provenance | |
|
||||
| ExternalFlow.cs:420:22:420:53 | call to method GenericStaticMethod1 : Object | ExternalFlow.cs:420:17:420:18 | access to local variable o1 : Object | provenance | |
|
||||
| ExternalFlow.cs:420:50:420:52 | access to local variable obj : Object | ExternalFlow.cs:420:22:420:53 | call to method GenericStaticMethod1 : Object | provenance | MaD:39 |
|
||||
| ExternalFlow.cs:423:17:423:18 | access to local variable o2 : Object | ExternalFlow.cs:424:18:424:19 | access to local variable o2 | provenance | |
|
||||
| ExternalFlow.cs:423:22:423:61 | call to method GenericStaticMethod1 : Object | ExternalFlow.cs:423:17:423:18 | access to local variable o2 : Object | provenance | |
|
||||
| ExternalFlow.cs:423:58:423:60 | access to local variable obj : Object | ExternalFlow.cs:423:22:423:61 | call to method GenericStaticMethod1 : Object | provenance | MaD:39 |
|
||||
| ExternalFlow.cs:429:17:429:19 | access to local variable obj : Object | ExternalFlow.cs:430:34:430:36 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:429:23:429:34 | object creation of type Object : Object | ExternalFlow.cs:429:17:429:19 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:430:13:430:13 | [post] access to parameter o : Object [property GenericProperty1] : Object | ExternalFlow.cs:431:22:431:22 | access to parameter o : Object [property GenericProperty1] : Object | provenance | |
|
||||
| ExternalFlow.cs:430:13:430:13 | [post] access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | ExternalFlow.cs:431:22:431:22 | access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | provenance | |
|
||||
| ExternalFlow.cs:430:34:430:36 | access to local variable obj : Object | ExternalFlow.cs:430:13:430:13 | [post] access to parameter o : Object [property GenericProperty1] : Object | provenance | |
|
||||
| ExternalFlow.cs:430:34:430:36 | access to local variable obj : Object | ExternalFlow.cs:430:13:430:13 | [post] access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | provenance | MaD:41 |
|
||||
| ExternalFlow.cs:431:17:431:18 | access to local variable o1 : Object | ExternalFlow.cs:432:18:432:19 | access to local variable o1 | provenance | |
|
||||
| ExternalFlow.cs:431:22:431:22 | access to parameter o : Object [property GenericProperty1] : Object | ExternalFlow.cs:431:22:431:39 | access to property GenericProperty1 : Object | provenance | |
|
||||
| ExternalFlow.cs:431:22:431:22 | access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | ExternalFlow.cs:431:22:431:39 | access to property GenericProperty1 : Object | provenance | MaD:40 |
|
||||
| ExternalFlow.cs:431:22:431:39 | access to property GenericProperty1 : Object | ExternalFlow.cs:431:17:431:18 | access to local variable o1 : Object | provenance | |
|
||||
| ExternalFlow.cs:437:17:437:19 | access to local variable obj : Object | ExternalFlow.cs:438:52:438:54 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:437:23:437:34 | object creation of type Object : Object | ExternalFlow.cs:437:17:437:19 | access to local variable obj : Object | provenance | |
|
||||
| ExternalFlow.cs:438:49:438:49 | [post] access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | ExternalFlow.cs:439:58:439:58 | access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | provenance | |
|
||||
| ExternalFlow.cs:438:52:438:54 | access to local variable obj : Object | ExternalFlow.cs:438:49:438:49 | [post] access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | provenance | MaD:41 |
|
||||
| ExternalFlow.cs:439:17:439:18 | access to local variable o1 : Object | ExternalFlow.cs:440:18:440:19 | access to local variable o1 | provenance | |
|
||||
| ExternalFlow.cs:439:22:439:59 | call to extension accessor get_GenericProperty1 : Object | ExternalFlow.cs:439:17:439:18 | access to local variable o1 : Object | provenance | |
|
||||
| ExternalFlow.cs:439:58:439:58 | access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | ExternalFlow.cs:439:22:439:59 | call to extension accessor get_GenericProperty1 : Object | provenance | MaD:40 |
|
||||
nodes
|
||||
| ExternalFlow.cs:9:20:9:23 | access to local variable arg1 : Object | semmle.label | access to local variable arg1 : Object |
|
||||
| ExternalFlow.cs:9:27:9:38 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
|
||||
@@ -294,6 +369,80 @@ nodes
|
||||
| ExternalFlow.cs:344:24:344:24 | access to local variable o : Object | semmle.label | access to local variable o : Object |
|
||||
| ExternalFlow.cs:345:18:345:18 | access to local variable l : Library [synthetic X] : Object | semmle.label | access to local variable l : Library [synthetic X] : Object |
|
||||
| ExternalFlow.cs:345:18:345:29 | call to method GetValue | semmle.label | call to method GetValue |
|
||||
| ExternalFlow.cs:373:17:373:19 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:373:23:373:34 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:374:17:374:18 | access to local variable o1 : Object | semmle.label | access to local variable o1 : Object |
|
||||
| ExternalFlow.cs:374:22:374:24 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:374:22:374:34 | call to method Method1 : Object | semmle.label | call to method Method1 : Object |
|
||||
| ExternalFlow.cs:375:18:375:19 | access to local variable o1 | semmle.label | access to local variable o1 |
|
||||
| ExternalFlow.cs:377:17:377:18 | access to local variable o2 : Object | semmle.label | access to local variable o2 : Object |
|
||||
| ExternalFlow.cs:377:22:377:48 | call to method Method1 : Object | semmle.label | call to method Method1 : Object |
|
||||
| ExternalFlow.cs:377:45:377:47 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:378:18:378:19 | access to local variable o2 | semmle.label | access to local variable o2 |
|
||||
| ExternalFlow.cs:383:17:383:19 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:383:23:383:34 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:384:17:384:18 | access to local variable o1 : Object | semmle.label | access to local variable o1 : Object |
|
||||
| ExternalFlow.cs:384:22:384:46 | call to method StaticMethod1 : Object | semmle.label | call to method StaticMethod1 : Object |
|
||||
| ExternalFlow.cs:384:43:384:45 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:385:18:385:19 | access to local variable o1 | semmle.label | access to local variable o1 |
|
||||
| ExternalFlow.cs:387:17:387:18 | access to local variable o2 : Object | semmle.label | access to local variable o2 : Object |
|
||||
| ExternalFlow.cs:387:22:387:54 | call to method StaticMethod1 : Object | semmle.label | call to method StaticMethod1 : Object |
|
||||
| ExternalFlow.cs:387:51:387:53 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:388:18:388:19 | access to local variable o2 | semmle.label | access to local variable o2 |
|
||||
| ExternalFlow.cs:393:17:393:19 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:393:23:393:34 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:394:13:394:13 | [post] access to parameter o : Object [synthetic TestExtensions.Property1] : Object | semmle.label | [post] access to parameter o : Object [synthetic TestExtensions.Property1] : Object |
|
||||
| ExternalFlow.cs:394:27:394:29 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:395:17:395:18 | access to local variable o1 : Object | semmle.label | access to local variable o1 : Object |
|
||||
| ExternalFlow.cs:395:22:395:22 | access to parameter o : Object [synthetic TestExtensions.Property1] : Object | semmle.label | access to parameter o : Object [synthetic TestExtensions.Property1] : Object |
|
||||
| ExternalFlow.cs:395:22:395:32 | access to property Property1 : Object | semmle.label | access to property Property1 : Object |
|
||||
| ExternalFlow.cs:396:18:396:19 | access to local variable o1 | semmle.label | access to local variable o1 |
|
||||
| ExternalFlow.cs:401:17:401:19 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:401:23:401:34 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:402:42:402:42 | [post] access to parameter o : Object [synthetic TestExtensions.Property1] : Object | semmle.label | [post] access to parameter o : Object [synthetic TestExtensions.Property1] : Object |
|
||||
| ExternalFlow.cs:402:45:402:47 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:403:17:403:18 | access to local variable o1 : Object | semmle.label | access to local variable o1 : Object |
|
||||
| ExternalFlow.cs:403:22:403:52 | call to extension accessor get_Property1 : Object | semmle.label | call to extension accessor get_Property1 : Object |
|
||||
| ExternalFlow.cs:403:51:403:51 | access to parameter o : Object [synthetic TestExtensions.Property1] : Object | semmle.label | access to parameter o : Object [synthetic TestExtensions.Property1] : Object |
|
||||
| ExternalFlow.cs:404:18:404:19 | access to local variable o1 | semmle.label | access to local variable o1 |
|
||||
| ExternalFlow.cs:409:17:409:19 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:409:23:409:34 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:410:17:410:18 | access to local variable o1 : Object | semmle.label | access to local variable o1 : Object |
|
||||
| ExternalFlow.cs:410:22:410:24 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:410:22:410:41 | call to method GenericMethod1 : Object | semmle.label | call to method GenericMethod1 : Object |
|
||||
| ExternalFlow.cs:411:18:411:19 | access to local variable o1 | semmle.label | access to local variable o1 |
|
||||
| ExternalFlow.cs:413:17:413:18 | access to local variable o2 : Object | semmle.label | access to local variable o2 : Object |
|
||||
| ExternalFlow.cs:413:22:413:55 | call to method GenericMethod1 : Object | semmle.label | call to method GenericMethod1 : Object |
|
||||
| ExternalFlow.cs:413:52:413:54 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:414:18:414:19 | access to local variable o2 | semmle.label | access to local variable o2 |
|
||||
| ExternalFlow.cs:419:17:419:19 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:419:23:419:34 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:420:17:420:18 | access to local variable o1 : Object | semmle.label | access to local variable o1 : Object |
|
||||
| ExternalFlow.cs:420:22:420:53 | call to method GenericStaticMethod1 : Object | semmle.label | call to method GenericStaticMethod1 : Object |
|
||||
| ExternalFlow.cs:420:50:420:52 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:421:18:421:19 | access to local variable o1 | semmle.label | access to local variable o1 |
|
||||
| ExternalFlow.cs:423:17:423:18 | access to local variable o2 : Object | semmle.label | access to local variable o2 : Object |
|
||||
| ExternalFlow.cs:423:22:423:61 | call to method GenericStaticMethod1 : Object | semmle.label | call to method GenericStaticMethod1 : Object |
|
||||
| ExternalFlow.cs:423:58:423:60 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:424:18:424:19 | access to local variable o2 | semmle.label | access to local variable o2 |
|
||||
| ExternalFlow.cs:429:17:429:19 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:429:23:429:34 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:430:13:430:13 | [post] access to parameter o : Object [property GenericProperty1] : Object | semmle.label | [post] access to parameter o : Object [property GenericProperty1] : Object |
|
||||
| ExternalFlow.cs:430:13:430:13 | [post] access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | semmle.label | [post] access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object |
|
||||
| ExternalFlow.cs:430:34:430:36 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:431:17:431:18 | access to local variable o1 : Object | semmle.label | access to local variable o1 : Object |
|
||||
| ExternalFlow.cs:431:22:431:22 | access to parameter o : Object [property GenericProperty1] : Object | semmle.label | access to parameter o : Object [property GenericProperty1] : Object |
|
||||
| ExternalFlow.cs:431:22:431:22 | access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | semmle.label | access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object |
|
||||
| ExternalFlow.cs:431:22:431:39 | access to property GenericProperty1 : Object | semmle.label | access to property GenericProperty1 : Object |
|
||||
| ExternalFlow.cs:432:18:432:19 | access to local variable o1 | semmle.label | access to local variable o1 |
|
||||
| ExternalFlow.cs:437:17:437:19 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:437:23:437:34 | object creation of type Object : Object | semmle.label | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:438:49:438:49 | [post] access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | semmle.label | [post] access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object |
|
||||
| ExternalFlow.cs:438:52:438:54 | access to local variable obj : Object | semmle.label | access to local variable obj : Object |
|
||||
| ExternalFlow.cs:439:17:439:18 | access to local variable o1 : Object | semmle.label | access to local variable o1 : Object |
|
||||
| ExternalFlow.cs:439:22:439:59 | call to extension accessor get_GenericProperty1 : Object | semmle.label | call to extension accessor get_GenericProperty1 : Object |
|
||||
| ExternalFlow.cs:439:58:439:58 | access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object | semmle.label | access to parameter o : Object [synthetic TestExtensions.GenericProperty1] : Object |
|
||||
| ExternalFlow.cs:440:18:440:19 | access to local variable o1 | semmle.label | access to local variable o1 |
|
||||
subpaths
|
||||
| ExternalFlow.cs:84:29:84:32 | access to local variable objs : null [element] : Object | ExternalFlow.cs:84:35:84:35 | o : Object | ExternalFlow.cs:84:40:84:40 | access to parameter o : Object | ExternalFlow.cs:84:25:84:41 | call to method Map<Object,Object> : T[] [element] : Object |
|
||||
invalidModelRow
|
||||
@@ -328,3 +477,15 @@ invalidModelRow
|
||||
| ExternalFlow.cs:324:18:324:44 | call to method GetMyNestedSyntheticField | ExternalFlow.cs:322:21:322:32 | object creation of type Object : Object | ExternalFlow.cs:324:18:324:44 | call to method GetMyNestedSyntheticField | $@ | ExternalFlow.cs:322:21:322:32 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:331:18:331:45 | call to method GetMyFieldOnSyntheticField | ExternalFlow.cs:329:21:329:32 | object creation of type Object : Object | ExternalFlow.cs:331:18:331:45 | call to method GetMyFieldOnSyntheticField | $@ | ExternalFlow.cs:329:21:329:32 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:345:18:345:29 | call to method GetValue | ExternalFlow.cs:343:21:343:32 | object creation of type Object : Object | ExternalFlow.cs:345:18:345:29 | call to method GetValue | $@ | ExternalFlow.cs:343:21:343:32 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:375:18:375:19 | access to local variable o1 | ExternalFlow.cs:373:23:373:34 | object creation of type Object : Object | ExternalFlow.cs:375:18:375:19 | access to local variable o1 | $@ | ExternalFlow.cs:373:23:373:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:378:18:378:19 | access to local variable o2 | ExternalFlow.cs:373:23:373:34 | object creation of type Object : Object | ExternalFlow.cs:378:18:378:19 | access to local variable o2 | $@ | ExternalFlow.cs:373:23:373:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:385:18:385:19 | access to local variable o1 | ExternalFlow.cs:383:23:383:34 | object creation of type Object : Object | ExternalFlow.cs:385:18:385:19 | access to local variable o1 | $@ | ExternalFlow.cs:383:23:383:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:388:18:388:19 | access to local variable o2 | ExternalFlow.cs:383:23:383:34 | object creation of type Object : Object | ExternalFlow.cs:388:18:388:19 | access to local variable o2 | $@ | ExternalFlow.cs:383:23:383:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:396:18:396:19 | access to local variable o1 | ExternalFlow.cs:393:23:393:34 | object creation of type Object : Object | ExternalFlow.cs:396:18:396:19 | access to local variable o1 | $@ | ExternalFlow.cs:393:23:393:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:404:18:404:19 | access to local variable o1 | ExternalFlow.cs:401:23:401:34 | object creation of type Object : Object | ExternalFlow.cs:404:18:404:19 | access to local variable o1 | $@ | ExternalFlow.cs:401:23:401:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:411:18:411:19 | access to local variable o1 | ExternalFlow.cs:409:23:409:34 | object creation of type Object : Object | ExternalFlow.cs:411:18:411:19 | access to local variable o1 | $@ | ExternalFlow.cs:409:23:409:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:414:18:414:19 | access to local variable o2 | ExternalFlow.cs:409:23:409:34 | object creation of type Object : Object | ExternalFlow.cs:414:18:414:19 | access to local variable o2 | $@ | ExternalFlow.cs:409:23:409:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:421:18:421:19 | access to local variable o1 | ExternalFlow.cs:419:23:419:34 | object creation of type Object : Object | ExternalFlow.cs:421:18:421:19 | access to local variable o1 | $@ | ExternalFlow.cs:419:23:419:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:424:18:424:19 | access to local variable o2 | ExternalFlow.cs:419:23:419:34 | object creation of type Object : Object | ExternalFlow.cs:424:18:424:19 | access to local variable o2 | $@ | ExternalFlow.cs:419:23:419:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:432:18:432:19 | access to local variable o1 | ExternalFlow.cs:429:23:429:34 | object creation of type Object : Object | ExternalFlow.cs:432:18:432:19 | access to local variable o1 | $@ | ExternalFlow.cs:429:23:429:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
| ExternalFlow.cs:440:18:440:19 | access to local variable o1 | ExternalFlow.cs:437:23:437:34 | object creation of type Object : Object | ExternalFlow.cs:440:18:440:19 | access to local variable o1 | $@ | ExternalFlow.cs:437:23:437:34 | object creation of type Object : Object | object creation of type Object : Object |
|
||||
|
||||
@@ -45,6 +45,14 @@ extensions:
|
||||
- ["My.Qltest", "K", false, "GetMyFieldOnSyntheticField", "()", "", "Argument[this].SyntheticField[My.Qltest.K.MySyntheticField2].Field[My.Qltest.K.MyField]", "ReturnValue", "value", "manual"]
|
||||
- ["My.Qltest", "Library", false, "SetValue", "(System.Object)", "", "Argument[0]", "Argument[this].SyntheticField[X]", "value", "dfc-generated"]
|
||||
- ["My.Qltest", "Library", false, "GetValue", "()", "", "Argument[this].SyntheticField[X]", "ReturnValue", "value", "dfc-generated"]
|
||||
- ["My.Qltest", "TestExtensions+extension(System.Object)", false, "Method1", "(System.Object)", "", "Argument[0]", "ReturnValue", "value", "manual"]
|
||||
- ["My.Qltest", "TestExtensions+extension(System.Object)", false, "StaticMethod1", "(System.Object)", "", "Argument[0]", "ReturnValue", "value", "manual"]
|
||||
- ["My.Qltest", "TestExtensions+extension(System.Object)", false, "get_Property1", "(System.Object)", "", "Argument[0].SyntheticField[TestExtensions.Property1]", "ReturnValue", "value", "manual"]
|
||||
- ["My.Qltest", "TestExtensions+extension(System.Object)", false, "set_Property1", "(System.Object,System.Object)", "", "Argument[1]", "Argument[0].SyntheticField[TestExtensions.Property1]", "value", "manual"]
|
||||
- ["My.Qltest", "TestExtensions+extension(T)<T>", false, "GenericMethod1", "(T)", "", "Argument[0]", "ReturnValue", "value", "manual"]
|
||||
- ["My.Qltest", "TestExtensions+extension(T)<T>", false, "GenericStaticMethod1", "(T)", "", "Argument[0]", "ReturnValue", "value", "manual"]
|
||||
- ["My.Qltest", "TestExtensions+extension(T)<T>", false, "get_GenericProperty1", "(T)", "", "Argument[0].SyntheticField[TestExtensions.GenericProperty1]", "ReturnValue", "value", "manual"]
|
||||
- ["My.Qltest", "TestExtensions+extension(T)<T>", false, "set_GenericProperty1", "(T,T)", "", "Argument[1]", "Argument[0].SyntheticField[TestExtensions.GenericProperty1]", "value", "manual"]
|
||||
|
||||
- addsTo:
|
||||
pack: codeql/csharp-all
|
||||
|
||||
481
csharp/ql/test/library-tests/extension/PrintAst.expected
Normal file
481
csharp/ql/test/library-tests/extension/PrintAst.expected
Normal file
@@ -0,0 +1,481 @@
|
||||
extensionTypes.cs:
|
||||
# 4| [Class] MyExtensionTypes
|
||||
# 6| 4: [ExtensionType] extension(String)
|
||||
#-----| 2: (Parameters)
|
||||
# 6| 0: [Parameter] s
|
||||
# 6| -1: [TypeMention] string
|
||||
#-----| 0: (Attributes)
|
||||
# 6| 1: [DefaultAttribute] [NotNull(...)]
|
||||
# 6| 0: [TypeMention] NotNullAttribute
|
||||
# 8| 4: [ExtensionMethod] M11
|
||||
# 8| -1: [TypeMention] Void
|
||||
#-----| 2: (Parameters)
|
||||
# 6| 0: [Parameter] s
|
||||
# 6| -1: [TypeMention] string
|
||||
# 8| 4: [BlockStmt] {...}
|
||||
# 10| 5: [ExtensionType] extension(Int32)
|
||||
#-----| 2: (Parameters)
|
||||
# 10| 0: [Parameter] i1
|
||||
# 10| -1: [TypeMention] int
|
||||
# 12| 4: [ExtensionMethod] M21
|
||||
# 12| -1: [TypeMention] Void
|
||||
#-----| 2: (Parameters)
|
||||
# 10| 0: [Parameter] i1
|
||||
# 10| -1: [TypeMention] int
|
||||
# 12| 4: [BlockStmt] {...}
|
||||
# 14| 6: [ExtensionType] extension(Int32)
|
||||
#-----| 2: (Parameters)
|
||||
# 14| 0: [Parameter] i2
|
||||
# 14| -1: [TypeMention] int
|
||||
# 16| 4: [ExtensionMethod] M31
|
||||
# 16| -1: [TypeMention] Void
|
||||
#-----| 2: (Parameters)
|
||||
# 14| 0: [Parameter] i2
|
||||
# 14| -1: [TypeMention] int
|
||||
# 16| 4: [BlockStmt] {...}
|
||||
# 18| 7: [ExtensionType] extension(Int32)
|
||||
#-----| 2: (Parameters)
|
||||
# 18| 0: [Parameter] i3
|
||||
# 18| -1: [TypeMention] int
|
||||
# 20| 4: [ExtensionMethod] M41
|
||||
# 20| -1: [TypeMention] Void
|
||||
#-----| 2: (Parameters)
|
||||
# 18| 0: [Parameter] i3
|
||||
# 18| -1: [TypeMention] int
|
||||
# 20| 4: [BlockStmt] {...}
|
||||
# 22| 8: [ExtensionType] extension(String)
|
||||
#-----| 2: (Parameters)
|
||||
# 22| 0: [Parameter] s
|
||||
# 22| -1: [TypeMention] string
|
||||
# 24| 4: [ExtensionMethod] M51
|
||||
# 24| -1: [TypeMention] Void
|
||||
#-----| 2: (Parameters)
|
||||
# 22| 0: [Parameter] s
|
||||
# 22| -1: [TypeMention] string
|
||||
# 24| 4: [BlockStmt] {...}
|
||||
# 26| 9: [ExtensionType] extension(T1)`1
|
||||
#-----| 1: (Type parameters)
|
||||
# 26| 0: [TypeParameter] T1
|
||||
#-----| 2: (Parameters)
|
||||
# 26| 0: [Parameter] t1
|
||||
# 26| -1: [TypeMention] T1
|
||||
#-----| 0: (Attributes)
|
||||
# 26| 1: [DefaultAttribute] [NotNullWhen(...)]
|
||||
# 26| -1: [TypeMention] NotNullWhenAttribute
|
||||
# 26| 0: [BoolLiteral] true
|
||||
# 28| 4: [ExtensionMethod] M61`1
|
||||
# 28| -1: [TypeMention] Void
|
||||
#-----| 1: (Type parameters)
|
||||
# 28| 0: [TypeParameter] T2
|
||||
#-----| 2: (Parameters)
|
||||
# 26| 0: [Parameter] t1
|
||||
# 26| -1: [TypeMention] T1
|
||||
# 28| 1: [Parameter] o
|
||||
# 28| -1: [TypeMention] object
|
||||
# 28| 2: [Parameter] t2
|
||||
# 28| -1: [TypeMention] T2
|
||||
# 28| 4: [BlockStmt] {...}
|
||||
extensions.cs:
|
||||
# 4| [Class] MyExtensions
|
||||
# 6| 4: [ExtensionType] extension(String)
|
||||
#-----| 2: (Parameters)
|
||||
# 6| 0: [Parameter] s
|
||||
# 6| -1: [TypeMention] string
|
||||
# 8| 4: [Property] Prop1
|
||||
# 8| -1: [TypeMention] bool
|
||||
# 8| 3: [ExtensionCallable,Getter] get_Prop1
|
||||
#-----| 2: (Parameters)
|
||||
# 6| 0: [Parameter] s
|
||||
# 6| -1: [TypeMention] string
|
||||
# 8| 4: [GTExpr] ... > ...
|
||||
# 8| 0: [PropertyCall] access to property Length
|
||||
# 8| -1: [SyntheticExtensionParameterAccess] access to extension synthetic parameter s
|
||||
# 8| 1: [IntLiteral] 0
|
||||
# 9| 5: [Property] Prop2
|
||||
# 9| -1: [TypeMention] bool
|
||||
# 9| 3: [ExtensionCallable,Getter] get_Prop2
|
||||
#-----| 2: (Parameters)
|
||||
# 6| 0: [Parameter] s
|
||||
# 6| -1: [TypeMention] string
|
||||
# 9| 4: [BlockStmt] {...}
|
||||
# 9| 0: [ReturnStmt] return ...;
|
||||
# 9| 0: [BoolLiteral] true
|
||||
# 9| 4: [ExtensionCallable,Setter] set_Prop2
|
||||
#-----| 2: (Parameters)
|
||||
# 6| 0: [Parameter] s
|
||||
# 6| -1: [TypeMention] string
|
||||
# 9| 1: [Parameter] value
|
||||
# 9| 4: [BlockStmt] {...}
|
||||
# 10| 6: [Property] StaticProp1
|
||||
# 10| -1: [TypeMention] bool
|
||||
# 10| 3: [ExtensionCallable,Getter] get_StaticProp1
|
||||
# 10| 4: [BlockStmt] {...}
|
||||
# 10| 0: [ReturnStmt] return ...;
|
||||
# 10| 0: [BoolLiteral] false
|
||||
# 11| 7: [ExtensionMethod] M1
|
||||
# 11| -1: [TypeMention] bool
|
||||
#-----| 2: (Parameters)
|
||||
# 6| 0: [Parameter] s
|
||||
# 6| -1: [TypeMention] string
|
||||
# 11| 4: [IsExpr] ... is ...
|
||||
# 11| 0: [SyntheticExtensionParameterAccess] access to extension synthetic parameter s
|
||||
# 11| 1: [NotPatternExpr] not ...
|
||||
# 11| 0: [ConstantPatternExpr,NullLiteral] null
|
||||
# 12| 8: [ExtensionMethod] M2
|
||||
# 12| -1: [TypeMention] string
|
||||
#-----| 2: (Parameters)
|
||||
# 6| 0: [Parameter] s
|
||||
# 6| -1: [TypeMention] string
|
||||
# 12| 1: [Parameter] other
|
||||
# 12| -1: [TypeMention] string
|
||||
# 12| 4: [BlockStmt] {...}
|
||||
# 12| 0: [ReturnStmt] return ...;
|
||||
# 12| 0: [AddExpr] ... + ...
|
||||
# 12| 0: [SyntheticExtensionParameterAccess] access to extension synthetic parameter s
|
||||
# 12| 1: [ParameterAccess] access to parameter other
|
||||
# 13| 9: [ExtensionMethod] StaticM1
|
||||
# 13| -1: [TypeMention] int
|
||||
# 13| 4: [BlockStmt] {...}
|
||||
# 13| 0: [ReturnStmt] return ...;
|
||||
# 13| 0: [IntLiteral] 0
|
||||
# 14| 10: [ExtensionMethod] StaticM2
|
||||
# 14| -1: [TypeMention] int
|
||||
#-----| 2: (Parameters)
|
||||
# 14| 0: [Parameter] x
|
||||
# 14| -1: [TypeMention] string
|
||||
# 14| 4: [BlockStmt] {...}
|
||||
# 14| 0: [ReturnStmt] return ...;
|
||||
# 14| 0: [PropertyCall] access to property Length
|
||||
# 14| -1: [ParameterAccess] access to parameter x
|
||||
# 15| 11: [ExtensionCallable,MulOperator] *
|
||||
# 15| -1: [TypeMention] string
|
||||
#-----| 2: (Parameters)
|
||||
# 15| 0: [Parameter] a
|
||||
# 15| -1: [TypeMention] int
|
||||
# 15| 1: [Parameter] b
|
||||
# 15| -1: [TypeMention] string
|
||||
# 15| 4: [BlockStmt] {...}
|
||||
# 15| 0: [ReturnStmt] return ...;
|
||||
# 15| 0: [StringLiteralUtf16] ""
|
||||
# 16| 14: [ExtensionMethod] StringGenericM1`1
|
||||
# 16| -1: [TypeMention] T
|
||||
#-----| 1: (Type parameters)
|
||||
# 16| 0: [TypeParameter] T
|
||||
#-----| 2: (Parameters)
|
||||
# 6| 0: [Parameter] s
|
||||
# 6| -1: [TypeMention] string
|
||||
# 16| 1: [Parameter] t
|
||||
# 16| -1: [TypeMention] T
|
||||
# 16| 2: [Parameter] o
|
||||
# 16| -1: [TypeMention] object
|
||||
# 16| 4: [BlockStmt] {...}
|
||||
# 16| 0: [ReturnStmt] return ...;
|
||||
# 16| 0: [ParameterAccess] access to parameter t
|
||||
# 19| 5: [ExtensionType] extension(Object)
|
||||
# 21| 4: [ExtensionMethod] StaticObjectM1
|
||||
# 21| -1: [TypeMention] int
|
||||
# 21| 4: [BlockStmt] {...}
|
||||
# 21| 0: [ReturnStmt] return ...;
|
||||
# 21| 0: [IntLiteral] 0
|
||||
# 22| 5: [ExtensionMethod] StaticObjectM2
|
||||
# 22| -1: [TypeMention] int
|
||||
#-----| 2: (Parameters)
|
||||
# 22| 0: [Parameter] s
|
||||
# 22| -1: [TypeMention] string
|
||||
# 22| 4: [BlockStmt] {...}
|
||||
# 22| 0: [ReturnStmt] return ...;
|
||||
# 22| 0: [PropertyCall] access to property Length
|
||||
# 22| -1: [ParameterAccess] access to parameter s
|
||||
# 23| 6: [Property] StaticProp
|
||||
# 23| -1: [TypeMention] bool
|
||||
# 23| 3: [ExtensionCallable,Getter] get_StaticProp
|
||||
# 23| 4: [BoolLiteral] true
|
||||
# 26| 8: [ExtensionType] extension(T)`1
|
||||
#-----| 1: (Type parameters)
|
||||
# 26| 0: [TypeParameter] T
|
||||
#-----| 2: (Parameters)
|
||||
# 26| 0: [Parameter] t
|
||||
# 26| -1: [TypeMention] T
|
||||
# 28| 4: [Property] GenericProp1
|
||||
# 28| -1: [TypeMention] bool
|
||||
# 28| 3: [ExtensionCallable,Getter] get_GenericProp1
|
||||
#-----| 2: (Parameters)
|
||||
# 26| 0: [Parameter] t
|
||||
# 26| -1: [TypeMention] T
|
||||
# 28| 4: [IsExpr] ... is ...
|
||||
# 28| 0: [SyntheticExtensionParameterAccess] access to extension synthetic parameter t
|
||||
# 28| 1: [NotPatternExpr] not ...
|
||||
# 28| 0: [ConstantPatternExpr,NullLiteral] null
|
||||
# 29| 5: [Property] GenericProp2
|
||||
# 29| -1: [TypeMention] bool
|
||||
# 29| 3: [ExtensionCallable,Getter] get_GenericProp2
|
||||
#-----| 2: (Parameters)
|
||||
# 26| 0: [Parameter] t
|
||||
# 26| -1: [TypeMention] T
|
||||
# 29| 4: [BlockStmt] {...}
|
||||
# 29| 0: [ReturnStmt] return ...;
|
||||
# 29| 0: [BoolLiteral] true
|
||||
# 29| 4: [ExtensionCallable,Setter] set_GenericProp2
|
||||
#-----| 2: (Parameters)
|
||||
# 26| 0: [Parameter] t
|
||||
# 26| -1: [TypeMention] T
|
||||
# 29| 1: [Parameter] value
|
||||
# 29| 4: [BlockStmt] {...}
|
||||
# 30| 6: [ExtensionMethod] GenericM1
|
||||
# 30| -1: [TypeMention] bool
|
||||
#-----| 2: (Parameters)
|
||||
# 26| 0: [Parameter] t
|
||||
# 26| -1: [TypeMention] T
|
||||
# 30| 4: [IsExpr] ... is ...
|
||||
# 30| 0: [SyntheticExtensionParameterAccess] access to extension synthetic parameter t
|
||||
# 30| 1: [NotPatternExpr] not ...
|
||||
# 30| 0: [ConstantPatternExpr,NullLiteral] null
|
||||
# 31| 7: [ExtensionMethod] GenericM2`1
|
||||
# 31| -1: [TypeMention] Void
|
||||
#-----| 1: (Type parameters)
|
||||
# 31| 0: [TypeParameter] S
|
||||
#-----| 2: (Parameters)
|
||||
# 26| 0: [Parameter] t
|
||||
# 26| -1: [TypeMention] T
|
||||
# 31| 1: [Parameter] other
|
||||
# 31| -1: [TypeMention] S
|
||||
# 31| 4: [BlockStmt] {...}
|
||||
# 32| 8: [ExtensionMethod] GenericStaticM1
|
||||
# 32| -1: [TypeMention] Void
|
||||
#-----| 2: (Parameters)
|
||||
# 26| 0: [Parameter] t
|
||||
# 26| -1: [TypeMention] T
|
||||
# 32| 4: [BlockStmt] {...}
|
||||
# 33| 9: [ExtensionMethod] GenericStaticM2`1
|
||||
# 33| -1: [TypeMention] Void
|
||||
#-----| 1: (Type parameters)
|
||||
# 33| 0: [TypeParameter] S
|
||||
#-----| 2: (Parameters)
|
||||
# 33| 0: [Parameter] other
|
||||
# 33| -1: [TypeMention] S
|
||||
# 33| 4: [BlockStmt] {...}
|
||||
# 34| 10: [AddOperator,ExtensionCallable] +
|
||||
# 34| -1: [TypeMention] T
|
||||
#-----| 2: (Parameters)
|
||||
# 34| 0: [Parameter] a
|
||||
# 34| -1: [TypeMention] T
|
||||
# 34| 1: [Parameter] b
|
||||
# 34| -1: [TypeMention] T
|
||||
# 34| 4: [BlockStmt] {...}
|
||||
# 34| 0: [ReturnStmt] return ...;
|
||||
# 34| 0: [NullLiteral] null
|
||||
# 38| [Class] ClassicExtensions
|
||||
# 40| 4: [ExtensionMethod] M3
|
||||
# 40| -1: [TypeMention] bool
|
||||
#-----| 2: (Parameters)
|
||||
# 40| 0: [Parameter] s
|
||||
# 40| -1: [TypeMention] string
|
||||
# 40| 4: [IsExpr] ... is ...
|
||||
# 40| 0: [ParameterAccess] access to parameter s
|
||||
# 40| 1: [NotPatternExpr] not ...
|
||||
# 40| 0: [ConstantPatternExpr,NullLiteral] null
|
||||
# 43| [Class] C
|
||||
# 45| 6: [Method] CallingExtensions
|
||||
# 45| -1: [TypeMention] Void
|
||||
# 46| 4: [BlockStmt] {...}
|
||||
# 47| 0: [LocalVariableDeclStmt] ... ...;
|
||||
# 47| 0: [LocalVariableDeclAndInitExpr] String s = ...
|
||||
# 47| -1: [TypeMention] string
|
||||
# 47| 0: [LocalVariableAccess] access to local variable s
|
||||
# 47| 1: [StringLiteralUtf16] "Hello World."
|
||||
# 50| 1: [LocalVariableDeclStmt] ... ...;
|
||||
# 50| 0: [LocalVariableDeclAndInitExpr] Boolean x11 = ...
|
||||
# 50| -1: [TypeMention] bool
|
||||
# 50| 0: [LocalVariableAccess] access to local variable x11
|
||||
# 50| 1: [ExtensionPropertyCall] access to property Prop1
|
||||
# 50| -1: [LocalVariableAccess] access to local variable s
|
||||
# 51| 2: [LocalVariableDeclStmt] ... ...;
|
||||
# 51| 0: [LocalVariableDeclAndInitExpr] Boolean x12 = ...
|
||||
# 51| -1: [TypeMention] bool
|
||||
# 51| 0: [LocalVariableAccess] access to local variable x12
|
||||
# 51| 1: [ExtensionPropertyCall] access to property Prop2
|
||||
# 51| -1: [LocalVariableAccess] access to local variable s
|
||||
# 52| 3: [ExprStmt] ...;
|
||||
# 52| 0: [AssignExpr] ... = ...
|
||||
# 52| 0: [ExtensionPropertyCall] access to property Prop2
|
||||
# 52| -1: [LocalVariableAccess] access to local variable s
|
||||
# 52| 1: [BoolLiteral] true
|
||||
# 53| 4: [LocalVariableDeclStmt] ... ...;
|
||||
# 53| 0: [LocalVariableDeclAndInitExpr] Boolean x13 = ...
|
||||
# 53| -1: [TypeMention] bool
|
||||
# 53| 0: [LocalVariableAccess] access to local variable x13
|
||||
# 53| 1: [ExtensionPropertyCall] access to property StaticProp1
|
||||
# 53| -1: [TypeAccess] access to type String
|
||||
# 53| 0: [TypeMention] string
|
||||
# 54| 5: [LocalVariableDeclStmt] ... ...;
|
||||
# 54| 0: [LocalVariableDeclAndInitExpr] Boolean x14 = ...
|
||||
# 54| -1: [TypeMention] bool
|
||||
# 54| 0: [LocalVariableAccess] access to local variable x14
|
||||
# 54| 1: [ExtensionPropertyCall] access to property StaticProp
|
||||
# 54| -1: [TypeAccess] access to type Object
|
||||
# 54| 0: [TypeMention] object
|
||||
# 57| 6: [LocalVariableDeclStmt] ... ...;
|
||||
# 57| 0: [LocalVariableDeclAndInitExpr] Boolean x21 = ...
|
||||
# 57| -1: [TypeMention] bool
|
||||
# 57| 0: [LocalVariableAccess] access to local variable x21
|
||||
# 57| 1: [MethodCall] call to method M1
|
||||
# 57| -1: [LocalVariableAccess] access to local variable s
|
||||
# 58| 7: [LocalVariableDeclStmt] ... ...;
|
||||
# 58| 0: [LocalVariableDeclAndInitExpr] String x22 = ...
|
||||
# 58| -1: [TypeMention] string
|
||||
# 58| 0: [LocalVariableAccess] access to local variable x22
|
||||
# 58| 1: [MethodCall] call to method M2
|
||||
# 58| -1: [LocalVariableAccess] access to local variable s
|
||||
# 58| 0: [StringLiteralUtf16] "!!!"
|
||||
# 59| 8: [LocalVariableDeclStmt] ... ...;
|
||||
# 59| 0: [LocalVariableDeclAndInitExpr] Int32 x23 = ...
|
||||
# 59| -1: [TypeMention] int
|
||||
# 59| 0: [LocalVariableAccess] access to local variable x23
|
||||
# 59| 1: [MethodCall] call to method StaticM1
|
||||
# 59| -1: [TypeAccess] access to type String
|
||||
# 59| 0: [TypeMention] string
|
||||
# 60| 9: [LocalVariableDeclStmt] ... ...;
|
||||
# 60| 0: [LocalVariableDeclAndInitExpr] Int32 x24 = ...
|
||||
# 60| -1: [TypeMention] int
|
||||
# 60| 0: [LocalVariableAccess] access to local variable x24
|
||||
# 60| 1: [MethodCall] call to method StaticM2
|
||||
# 60| -1: [TypeAccess] access to type String
|
||||
# 60| 0: [TypeMention] string
|
||||
# 60| 0: [LocalVariableAccess] access to local variable s
|
||||
# 61| 10: [LocalVariableDeclStmt] ... ...;
|
||||
# 61| 0: [LocalVariableDeclAndInitExpr] Int32 x25 = ...
|
||||
# 61| -1: [TypeMention] int
|
||||
# 61| 0: [LocalVariableAccess] access to local variable x25
|
||||
# 61| 1: [MethodCall] call to method StaticObjectM1
|
||||
# 61| -1: [TypeAccess] access to type Object
|
||||
# 61| 0: [TypeMention] object
|
||||
# 62| 11: [LocalVariableDeclStmt] ... ...;
|
||||
# 62| 0: [LocalVariableDeclAndInitExpr] Int32 x26 = ...
|
||||
# 62| -1: [TypeMention] int
|
||||
# 62| 0: [LocalVariableAccess] access to local variable x26
|
||||
# 62| 1: [MethodCall] call to method StaticObjectM2
|
||||
# 62| -1: [TypeAccess] access to type Object
|
||||
# 62| 0: [TypeMention] object
|
||||
# 62| 0: [LocalVariableAccess] access to local variable s
|
||||
# 65| 12: [LocalVariableDeclStmt] ... ...;
|
||||
# 65| 0: [LocalVariableDeclAndInitExpr] String x30 = ...
|
||||
# 65| -1: [TypeMention] string
|
||||
# 65| 0: [LocalVariableAccess] access to local variable x30
|
||||
# 65| 1: [ExtensionOperatorCall] call to operator *
|
||||
# 65| 0: [IntLiteral] 3
|
||||
# 65| 1: [LocalVariableAccess] access to local variable s
|
||||
# 68| 13: [LocalVariableDeclStmt] ... ...;
|
||||
# 68| 0: [LocalVariableDeclAndInitExpr] Boolean y = ...
|
||||
# 68| -1: [TypeMention] bool
|
||||
# 68| 0: [LocalVariableAccess] access to local variable y
|
||||
# 68| 1: [MethodCall] call to method M3
|
||||
# 68| -1: [LocalVariableAccess] access to local variable s
|
||||
# 71| 14: [ExprStmt] ...;
|
||||
# 71| 0: [MethodCall] call to method M1
|
||||
# 71| -1: [TypeAccess] access to type MyExtensions
|
||||
# 71| 0: [TypeMention] MyExtensions
|
||||
# 71| 0: [LocalVariableAccess] access to local variable s
|
||||
# 72| 15: [ExprStmt] ...;
|
||||
# 72| 0: [MethodCall] call to method M2
|
||||
# 72| -1: [TypeAccess] access to type MyExtensions
|
||||
# 72| 0: [TypeMention] MyExtensions
|
||||
# 72| 0: [LocalVariableAccess] access to local variable s
|
||||
# 72| 1: [StringLiteralUtf16] "!!!"
|
||||
# 73| 16: [ExprStmt] ...;
|
||||
# 73| 0: [MethodCall] call to method StaticM1
|
||||
# 73| -1: [TypeAccess] access to type MyExtensions
|
||||
# 73| 0: [TypeMention] MyExtensions
|
||||
# 74| 17: [ExprStmt] ...;
|
||||
# 74| 0: [MethodCall] call to method StaticM2
|
||||
# 74| -1: [TypeAccess] access to type MyExtensions
|
||||
# 74| 0: [TypeMention] MyExtensions
|
||||
# 74| 0: [LocalVariableAccess] access to local variable s
|
||||
# 75| 18: [ExprStmt] ...;
|
||||
# 75| 0: [MethodCall] call to method StaticObjectM1
|
||||
# 75| -1: [TypeAccess] access to type MyExtensions
|
||||
# 75| 0: [TypeMention] MyExtensions
|
||||
# 76| 19: [ExprStmt] ...;
|
||||
# 76| 0: [MethodCall] call to method StaticObjectM2
|
||||
# 76| -1: [TypeAccess] access to type MyExtensions
|
||||
# 76| 0: [TypeMention] MyExtensions
|
||||
# 76| 0: [LocalVariableAccess] access to local variable s
|
||||
# 79| 20: [ExprStmt] ...;
|
||||
# 79| 0: [ExtensionOperatorCall] call to operator *
|
||||
# 79| -1: [TypeAccess] access to type MyExtensions
|
||||
# 79| 0: [TypeMention] MyExtensions
|
||||
# 79| 0: [IntLiteral] 3
|
||||
# 79| 1: [LocalVariableAccess] access to local variable s
|
||||
# 82| 21: [ExprStmt] ...;
|
||||
# 82| 0: [MethodCall] call to extension accessor get_Prop1
|
||||
# 82| -1: [TypeAccess] access to type MyExtensions
|
||||
# 82| 0: [TypeMention] MyExtensions
|
||||
# 82| 0: [LocalVariableAccess] access to local variable s
|
||||
# 83| 22: [ExprStmt] ...;
|
||||
# 83| 0: [MethodCall] call to extension accessor get_Prop2
|
||||
# 83| -1: [TypeAccess] access to type MyExtensions
|
||||
# 83| 0: [TypeMention] MyExtensions
|
||||
# 83| 0: [LocalVariableAccess] access to local variable s
|
||||
# 84| 23: [ExprStmt] ...;
|
||||
# 84| 0: [MethodCall] call to extension accessor set_Prop2
|
||||
# 84| -1: [TypeAccess] access to type MyExtensions
|
||||
# 84| 0: [TypeMention] MyExtensions
|
||||
# 84| 0: [LocalVariableAccess] access to local variable s
|
||||
# 84| 1: [BoolLiteral] false
|
||||
# 85| 24: [ExprStmt] ...;
|
||||
# 85| 0: [MethodCall] call to extension accessor get_StaticProp
|
||||
# 85| -1: [TypeAccess] access to type MyExtensions
|
||||
# 85| 0: [TypeMention] MyExtensions
|
||||
# 88| 7: [Method] CallingGenericExtensions
|
||||
# 88| -1: [TypeMention] Void
|
||||
# 89| 4: [BlockStmt] {...}
|
||||
# 90| 0: [LocalVariableDeclStmt] ... ...;
|
||||
# 90| 0: [LocalVariableDeclAndInitExpr] String s = ...
|
||||
# 90| -1: [TypeMention] string
|
||||
# 90| 0: [LocalVariableAccess] access to local variable s
|
||||
# 90| 1: [StringLiteralUtf16] "Hello Generic World."
|
||||
# 91| 1: [LocalVariableDeclStmt] ... ...;
|
||||
# 91| 0: [LocalVariableDeclAndInitExpr] Object o = ...
|
||||
# 91| -1: [TypeMention] object
|
||||
# 91| 0: [LocalVariableAccess] access to local variable o
|
||||
# 91| 1: [ObjectCreation] object creation of type Object
|
||||
# 91| 0: [TypeMention] object
|
||||
# 94| 2: [ExprStmt] ...;
|
||||
# 94| 0: [MethodCall] call to method GenericM1
|
||||
# 94| -1: [LocalVariableAccess] access to local variable o
|
||||
# 95| 3: [ExprStmt] ...;
|
||||
# 95| 0: [MethodCall] call to method GenericM1
|
||||
# 95| -1: [LocalVariableAccess] access to local variable s
|
||||
# 98| 4: [ExprStmt] ...;
|
||||
# 98| 0: [MethodCall] call to method GenericM1
|
||||
# 98| -1: [TypeAccess] access to type MyExtensions
|
||||
# 98| 0: [TypeMention] MyExtensions
|
||||
# 98| 0: [LocalVariableAccess] access to local variable o
|
||||
# 99| 5: [ExprStmt] ...;
|
||||
# 99| 0: [MethodCall] call to method GenericM1
|
||||
# 99| -1: [TypeAccess] access to type MyExtensions
|
||||
# 99| 0: [TypeMention] MyExtensions
|
||||
# 99| 0: [LocalVariableAccess] access to local variable s
|
||||
# 101| 6: [ExprStmt] ...;
|
||||
# 101| 0: [MethodCall] call to method GenericM2<Int32>
|
||||
# 101| -1: [LocalVariableAccess] access to local variable o
|
||||
# 101| 0: [IntLiteral] 42
|
||||
# 102| 7: [ExprStmt] ...;
|
||||
# 102| 0: [MethodCall] call to method GenericM2<Int32>
|
||||
# 102| -1: [TypeAccess] access to type MyExtensions
|
||||
# 102| 0: [TypeMention] MyExtensions
|
||||
# 102| 0: [LocalVariableAccess] access to local variable o
|
||||
# 102| 1: [IntLiteral] 42
|
||||
# 104| 8: [ExprStmt] ...;
|
||||
# 104| 0: [MethodCall] call to method StringGenericM1<Int32>
|
||||
# 104| -1: [LocalVariableAccess] access to local variable s
|
||||
# 104| 0: [IntLiteral] 7
|
||||
# 104| 1: [ObjectCreation] object creation of type Object
|
||||
# 104| 0: [TypeMention] object
|
||||
# 105| 9: [ExprStmt] ...;
|
||||
# 105| 0: [MethodCall] call to method StringGenericM1<String>
|
||||
# 105| -1: [TypeAccess] access to type MyExtensions
|
||||
# 105| 0: [TypeMention] MyExtensions
|
||||
# 105| 0: [LocalVariableAccess] access to local variable s
|
||||
# 105| 1: [StringLiteralUtf16] "test"
|
||||
# 105| 2: [ObjectCreation] object creation of type Object
|
||||
# 105| 0: [TypeMention] object
|
||||
1
csharp/ql/test/library-tests/extension/PrintAst.qlref
Normal file
1
csharp/ql/test/library-tests/extension/PrintAst.qlref
Normal file
@@ -0,0 +1 @@
|
||||
shared/PrintAst.ql
|
||||
30
csharp/ql/test/library-tests/extension/extensionTypes.cs
Normal file
30
csharp/ql/test/library-tests/extension/extensionTypes.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
public static class MyExtensionTypes
|
||||
{
|
||||
extension([NotNull] string s)
|
||||
{
|
||||
public void M11() { }
|
||||
}
|
||||
extension(ref readonly int i1)
|
||||
{
|
||||
public void M21() { }
|
||||
}
|
||||
extension(in int i2)
|
||||
{
|
||||
public void M31() { }
|
||||
}
|
||||
extension(ref int i3)
|
||||
{
|
||||
public void M41() { }
|
||||
}
|
||||
extension(string? s)
|
||||
{
|
||||
public void M51() { }
|
||||
}
|
||||
extension<T1>([NotNullWhen(true)] T1 t1) where T1 : class
|
||||
{
|
||||
public void M61<T2>(object o, T2 t2) { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
extensionTypeReceiverParameter
|
||||
| extensionTypes.cs:6:5:9:5 | extension(String) | extensionTypes.cs:6:32:6:32 | s |
|
||||
| extensionTypes.cs:10:5:13:5 | extension(Int32) | extensionTypes.cs:10:32:10:33 | i1 |
|
||||
| extensionTypes.cs:14:5:17:5 | extension(Int32) | extensionTypes.cs:14:22:14:23 | i2 |
|
||||
| extensionTypes.cs:18:5:21:5 | extension(Int32) | extensionTypes.cs:18:23:18:24 | i3 |
|
||||
| extensionTypes.cs:22:5:25:5 | extension(String) | extensionTypes.cs:22:23:22:23 | s |
|
||||
| extensionTypes.cs:26:5:29:5 | extension(T1)`1 | extensionTypes.cs:26:42:26:43 | t1 |
|
||||
| extensions.cs:6:5:17:5 | extension(String) | extensions.cs:6:22:6:22 | s |
|
||||
| extensions.cs:26:5:35:5 | extension(Object)<Object> | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:26:5:35:5 | extension(String)<String> | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:26:5:35:5 | extension(T)`1 | extensions.cs:26:20:26:20 | t |
|
||||
extensionTypeExtendedType
|
||||
| extensionTypes.cs:6:5:9:5 | extension(String) | string |
|
||||
| extensionTypes.cs:10:5:13:5 | extension(Int32) | int |
|
||||
| extensionTypes.cs:14:5:17:5 | extension(Int32) | int |
|
||||
| extensionTypes.cs:18:5:21:5 | extension(Int32) | int |
|
||||
| extensionTypes.cs:22:5:25:5 | extension(String) | string |
|
||||
| extensionTypes.cs:26:5:29:5 | extension(T1)`1 | T1 |
|
||||
| extensions.cs:6:5:17:5 | extension(String) | string |
|
||||
| extensions.cs:19:5:24:5 | extension(Object) | object |
|
||||
| extensions.cs:26:5:35:5 | extension(Object)<Object> | object |
|
||||
| extensions.cs:26:5:35:5 | extension(String)<String> | string |
|
||||
| extensions.cs:26:5:35:5 | extension(T)`1 | T |
|
||||
extensionTypeReceiverParameterAttribute
|
||||
| extensionTypes.cs:6:5:9:5 | extension(String) | extensionTypes.cs:6:32:6:32 | s | extensionTypes.cs:6:16:6:22 | [NotNull(...)] |
|
||||
| extensionTypes.cs:26:5:29:5 | extension(T1)`1 | extensionTypes.cs:26:42:26:43 | t1 | extensionTypes.cs:26:20:26:30 | [NotNullWhen(...)] |
|
||||
extensionTypeReceiverParameterModifier
|
||||
| extensionTypes.cs:10:5:13:5 | extension(Int32) | extensionTypes.cs:10:32:10:33 | i1 | ref readonly |
|
||||
| extensionTypes.cs:14:5:17:5 | extension(Int32) | extensionTypes.cs:14:22:14:23 | i2 | in |
|
||||
| extensionTypes.cs:18:5:21:5 | extension(Int32) | extensionTypes.cs:18:23:18:24 | i3 | ref |
|
||||
extensionTypeParameterConstraints
|
||||
| extensionTypes.cs:26:5:29:5 | extension(T1)`1 | extensionTypes.cs:26:15:26:16 | T1 | file://:0:0:0:0 | where T1: ... |
|
||||
| extensions.cs:26:5:35:5 | extension(T)`1 | extensions.cs:26:15:26:15 | T | file://:0:0:0:0 | where T: ... |
|
||||
syntheticParameterModifier
|
||||
| extensionTypes.cs:10:5:13:5 | extension(Int32) | extensionTypes.cs:12:21:12:23 | M21 | extensionTypes.cs:10:32:10:33 | i1 | ref readonly |
|
||||
| extensionTypes.cs:14:5:17:5 | extension(Int32) | extensionTypes.cs:16:21:16:23 | M31 | extensionTypes.cs:14:22:14:23 | i2 | in |
|
||||
| extensionTypes.cs:18:5:21:5 | extension(Int32) | extensionTypes.cs:20:21:20:23 | M41 | extensionTypes.cs:18:23:18:24 | i3 | ref |
|
||||
56
csharp/ql/test/library-tests/extension/extensionTypes.ql
Normal file
56
csharp/ql/test/library-tests/extension/extensionTypes.ql
Normal file
@@ -0,0 +1,56 @@
|
||||
import csharp
|
||||
|
||||
private predicate inTestFile(ExtensionType et) {
|
||||
et.getFile().getBaseName() = ["extensions.cs", "extensionTypes.cs"]
|
||||
}
|
||||
|
||||
private string getModifier(Parameter p) {
|
||||
p.isIn() and result = "in"
|
||||
or
|
||||
p.isRef() and result = "ref"
|
||||
or
|
||||
p.isReadonlyRef() and result = "ref readonly"
|
||||
}
|
||||
|
||||
query predicate extensionTypeReceiverParameter(ExtensionType et, Parameter p) {
|
||||
inTestFile(et) and
|
||||
p = et.getReceiverParameter()
|
||||
}
|
||||
|
||||
query predicate extensionTypeExtendedType(ExtensionType et, string t) {
|
||||
inTestFile(et) and
|
||||
t = et.getExtendedType().toStringWithTypes()
|
||||
}
|
||||
|
||||
query predicate extensionTypeReceiverParameterAttribute(ExtensionType et, Parameter p, Attribute a) {
|
||||
inTestFile(et) and
|
||||
et.getReceiverParameter() = p and
|
||||
p.getAnAttribute() = a
|
||||
}
|
||||
|
||||
query predicate extensionTypeReceiverParameterModifier(
|
||||
ExtensionType et, Parameter p, string modifier
|
||||
) {
|
||||
inTestFile(et) and
|
||||
et.getReceiverParameter() = p and
|
||||
modifier = getModifier(p)
|
||||
}
|
||||
|
||||
query predicate extensionTypeParameterConstraints(
|
||||
UnboundGeneric ug, TypeParameter tp, TypeParameterConstraints c
|
||||
) {
|
||||
inTestFile(ug) and
|
||||
ug instanceof ExtensionType and
|
||||
tp = ug.getATypeParameter() and
|
||||
tp.getConstraints() = c
|
||||
}
|
||||
|
||||
query predicate syntheticParameterModifier(
|
||||
ExtensionType et, ExtensionMethod em, Parameter p, string modifier
|
||||
) {
|
||||
inTestFile(et) and
|
||||
em.getDeclaringType() = et and
|
||||
p = em.getParameter(0) and
|
||||
not em.isStatic() and
|
||||
modifier = getModifier(p)
|
||||
}
|
||||
107
csharp/ql/test/library-tests/extension/extensions.cs
Normal file
107
csharp/ql/test/library-tests/extension/extensions.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public static class MyExtensions
|
||||
{
|
||||
extension(string s)
|
||||
{
|
||||
public bool Prop1 => s.Length > 0;
|
||||
public bool Prop2 { get { return true; } set { } }
|
||||
public static bool StaticProp1 { get { return false; } }
|
||||
public bool M1() => s is not null;
|
||||
public string M2(string other) { return s + other; }
|
||||
public static int StaticM1() { return 0; }
|
||||
public static int StaticM2(string x) { return x.Length; }
|
||||
public static string operator *(int a, string b) { return ""; }
|
||||
public T StringGenericM1<T>(T t, object o) { return t; }
|
||||
}
|
||||
|
||||
extension(object)
|
||||
{
|
||||
public static int StaticObjectM1() { return 0; }
|
||||
public static int StaticObjectM2(string s) { return s.Length; }
|
||||
public static bool StaticProp => true;
|
||||
}
|
||||
|
||||
extension<T>(T t) where T : class
|
||||
{
|
||||
public bool GenericProp1 => t is not null;
|
||||
public bool GenericProp2 { get { return true; } set { } }
|
||||
public bool GenericM1() => t is not null;
|
||||
public void GenericM2<S>(S other) { }
|
||||
public void GenericStaticM1() { }
|
||||
public static void GenericStaticM2<S>(S other) { }
|
||||
public static T operator +(T a, T b) { return null; }
|
||||
}
|
||||
}
|
||||
|
||||
public static class ClassicExtensions
|
||||
{
|
||||
public static bool M3(this string s) => s is not null;
|
||||
}
|
||||
|
||||
public class C
|
||||
{
|
||||
public static void CallingExtensions()
|
||||
{
|
||||
var s = "Hello World.";
|
||||
|
||||
// Calling the extensions properties
|
||||
var x11 = s.Prop1;
|
||||
var x12 = s.Prop2;
|
||||
s.Prop2 = true;
|
||||
var x13 = string.StaticProp1;
|
||||
var x14 = object.StaticProp;
|
||||
|
||||
// Calling the extensions methods.
|
||||
var x21 = s.M1();
|
||||
var x22 = s.M2("!!!");
|
||||
var x23 = string.StaticM1();
|
||||
var x24 = string.StaticM2(s);
|
||||
var x25 = object.StaticObjectM1();
|
||||
var x26 = object.StaticObjectM2(s);
|
||||
|
||||
// Calling the extension operator.
|
||||
var x30 = 3 * s;
|
||||
|
||||
// Calling the classic extension method.
|
||||
var y = s.M3();
|
||||
|
||||
// Calling the compiler generated static extension methods.
|
||||
MyExtensions.M1(s);
|
||||
MyExtensions.M2(s, "!!!");
|
||||
MyExtensions.StaticM1();
|
||||
MyExtensions.StaticM2(s);
|
||||
MyExtensions.StaticObjectM1();
|
||||
MyExtensions.StaticObjectM2(s);
|
||||
|
||||
// Calling the compiler generated operator method.
|
||||
MyExtensions.op_Multiply(3, s);
|
||||
|
||||
// Calling the compiler generated methods used by the extension property accessors.
|
||||
MyExtensions.get_Prop1(s);
|
||||
MyExtensions.get_Prop2(s);
|
||||
MyExtensions.set_Prop2(s, false);
|
||||
MyExtensions.get_StaticProp();
|
||||
}
|
||||
|
||||
public static void CallingGenericExtensions()
|
||||
{
|
||||
var s = "Hello Generic World.";
|
||||
var o = new object();
|
||||
|
||||
// Calling generic extension method
|
||||
o.GenericM1();
|
||||
s.GenericM1();
|
||||
|
||||
// Calling the compiler generated static extension methods.
|
||||
MyExtensions.GenericM1(o);
|
||||
MyExtensions.GenericM1(s);
|
||||
|
||||
o.GenericM2(42);
|
||||
MyExtensions.GenericM2(o, 42);
|
||||
|
||||
s.StringGenericM1<int>(7, new object());
|
||||
MyExtensions.StringGenericM1<string>(s, "test", new object());
|
||||
}
|
||||
}
|
||||
111
csharp/ql/test/library-tests/extension/extensions.expected
Normal file
111
csharp/ql/test/library-tests/extension/extensions.expected
Normal file
@@ -0,0 +1,111 @@
|
||||
extensionMethodCallArgument
|
||||
| extensions.cs:57:19:57:24 | call to method M1 | extensions.cs:11:21:11:22 | M1 | extensions.cs:6:22:6:22 | s | 0 | extensions.cs:57:19:57:19 | access to local variable s |
|
||||
| extensions.cs:58:19:58:29 | call to method M2 | extensions.cs:12:23:12:24 | M2 | extensions.cs:6:22:6:22 | s | 0 | extensions.cs:58:19:58:19 | access to local variable s |
|
||||
| extensions.cs:58:19:58:29 | call to method M2 | extensions.cs:12:23:12:24 | M2 | extensions.cs:12:33:12:37 | other | 1 | extensions.cs:58:24:58:28 | "!!!" |
|
||||
| extensions.cs:60:19:60:36 | call to method StaticM2 | extensions.cs:14:27:14:34 | StaticM2 | extensions.cs:14:43:14:43 | x | 0 | extensions.cs:60:35:60:35 | access to local variable s |
|
||||
| extensions.cs:62:19:62:42 | call to method StaticObjectM2 | extensions.cs:22:27:22:40 | StaticObjectM2 | extensions.cs:22:49:22:49 | s | 0 | extensions.cs:62:41:62:41 | access to local variable s |
|
||||
| extensions.cs:68:17:68:22 | call to method M3 | extensions.cs:40:24:40:25 | M3 | extensions.cs:40:39:40:39 | s | 0 | extensions.cs:68:17:68:17 | access to local variable s |
|
||||
| extensions.cs:71:9:71:26 | call to method M1 | extensions.cs:11:21:11:22 | M1 | extensions.cs:6:22:6:22 | s | 0 | extensions.cs:71:25:71:25 | access to local variable s |
|
||||
| extensions.cs:72:9:72:33 | call to method M2 | extensions.cs:12:23:12:24 | M2 | extensions.cs:6:22:6:22 | s | 0 | extensions.cs:72:25:72:25 | access to local variable s |
|
||||
| extensions.cs:72:9:72:33 | call to method M2 | extensions.cs:12:23:12:24 | M2 | extensions.cs:12:33:12:37 | other | 1 | extensions.cs:72:28:72:32 | "!!!" |
|
||||
| extensions.cs:74:9:74:32 | call to method StaticM2 | extensions.cs:14:27:14:34 | StaticM2 | extensions.cs:14:43:14:43 | x | 0 | extensions.cs:74:31:74:31 | access to local variable s |
|
||||
| extensions.cs:76:9:76:38 | call to method StaticObjectM2 | extensions.cs:22:27:22:40 | StaticObjectM2 | extensions.cs:22:49:22:49 | s | 0 | extensions.cs:76:37:76:37 | access to local variable s |
|
||||
| extensions.cs:94:9:94:21 | call to method GenericM1 | extensions.cs:30:21:30:29 | GenericM1 | extensions.cs:26:20:26:20 | t | 0 | extensions.cs:94:9:94:9 | access to local variable o |
|
||||
| extensions.cs:95:9:95:21 | call to method GenericM1 | extensions.cs:30:21:30:29 | GenericM1 | extensions.cs:26:20:26:20 | t | 0 | extensions.cs:95:9:95:9 | access to local variable s |
|
||||
| extensions.cs:98:9:98:33 | call to method GenericM1 | extensions.cs:30:21:30:29 | GenericM1 | extensions.cs:26:20:26:20 | t | 0 | extensions.cs:98:32:98:32 | access to local variable o |
|
||||
| extensions.cs:99:9:99:33 | call to method GenericM1 | extensions.cs:30:21:30:29 | GenericM1 | extensions.cs:26:20:26:20 | t | 0 | extensions.cs:99:32:99:32 | access to local variable s |
|
||||
| extensions.cs:101:9:101:23 | call to method GenericM2<Int32> | extensions.cs:31:21:31:32 | GenericM2<Int32> | extensions.cs:26:20:26:20 | t | 0 | extensions.cs:101:9:101:9 | access to local variable o |
|
||||
| extensions.cs:101:9:101:23 | call to method GenericM2<Int32> | extensions.cs:31:21:31:32 | GenericM2<Int32> | extensions.cs:31:36:31:40 | other | 1 | extensions.cs:101:21:101:22 | 42 |
|
||||
| extensions.cs:102:9:102:37 | call to method GenericM2<Int32> | extensions.cs:31:21:31:32 | GenericM2<Int32> | extensions.cs:26:20:26:20 | t | 0 | extensions.cs:102:32:102:32 | access to local variable o |
|
||||
| extensions.cs:102:9:102:37 | call to method GenericM2<Int32> | extensions.cs:31:21:31:32 | GenericM2<Int32> | extensions.cs:31:36:31:40 | other | 1 | extensions.cs:102:35:102:36 | 42 |
|
||||
| extensions.cs:104:9:104:47 | call to method StringGenericM1<Int32> | extensions.cs:16:18:16:35 | StringGenericM1<Int32> | extensions.cs:6:22:6:22 | s | 0 | extensions.cs:104:9:104:9 | access to local variable s |
|
||||
| extensions.cs:104:9:104:47 | call to method StringGenericM1<Int32> | extensions.cs:16:18:16:35 | StringGenericM1<Int32> | extensions.cs:16:39:16:39 | t | 1 | extensions.cs:104:32:104:32 | 7 |
|
||||
| extensions.cs:104:9:104:47 | call to method StringGenericM1<Int32> | extensions.cs:16:18:16:35 | StringGenericM1<Int32> | extensions.cs:16:49:16:49 | o | 2 | extensions.cs:104:35:104:46 | object creation of type Object |
|
||||
| extensions.cs:105:9:105:69 | call to method StringGenericM1<String> | extensions.cs:16:18:16:35 | StringGenericM1<String> | extensions.cs:6:22:6:22 | s | 0 | extensions.cs:105:46:105:46 | access to local variable s |
|
||||
| extensions.cs:105:9:105:69 | call to method StringGenericM1<String> | extensions.cs:16:18:16:35 | StringGenericM1<String> | extensions.cs:16:39:16:39 | t | 1 | extensions.cs:105:49:105:54 | "test" |
|
||||
| extensions.cs:105:9:105:69 | call to method StringGenericM1<String> | extensions.cs:16:18:16:35 | StringGenericM1<String> | extensions.cs:16:49:16:49 | o | 2 | extensions.cs:105:57:105:68 | object creation of type Object |
|
||||
extensionMethodCalls
|
||||
| extensions.cs:57:19:57:24 | call to method M1 | extensions.cs:11:21:11:22 | M1 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).M1 |
|
||||
| extensions.cs:58:19:58:29 | call to method M2 | extensions.cs:12:23:12:24 | M2 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).M2 |
|
||||
| extensions.cs:59:19:59:35 | call to method StaticM1 | extensions.cs:13:27:13:34 | StaticM1 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).StaticM1 |
|
||||
| extensions.cs:60:19:60:36 | call to method StaticM2 | extensions.cs:14:27:14:34 | StaticM2 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).StaticM2 |
|
||||
| extensions.cs:61:19:61:41 | call to method StaticObjectM1 | extensions.cs:21:27:21:40 | StaticObjectM1 | extensions.cs:19:5:24:5 | extension(Object) | MyExtensions+extension(System.Object).StaticObjectM1 |
|
||||
| extensions.cs:62:19:62:42 | call to method StaticObjectM2 | extensions.cs:22:27:22:40 | StaticObjectM2 | extensions.cs:19:5:24:5 | extension(Object) | MyExtensions+extension(System.Object).StaticObjectM2 |
|
||||
| extensions.cs:68:17:68:22 | call to method M3 | extensions.cs:40:24:40:25 | M3 | extensions.cs:38:21:38:37 | ClassicExtensions | ClassicExtensions.M3 |
|
||||
| extensions.cs:71:9:71:26 | call to method M1 | extensions.cs:11:21:11:22 | M1 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).M1 |
|
||||
| extensions.cs:72:9:72:33 | call to method M2 | extensions.cs:12:23:12:24 | M2 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).M2 |
|
||||
| extensions.cs:73:9:73:31 | call to method StaticM1 | extensions.cs:13:27:13:34 | StaticM1 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).StaticM1 |
|
||||
| extensions.cs:74:9:74:32 | call to method StaticM2 | extensions.cs:14:27:14:34 | StaticM2 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).StaticM2 |
|
||||
| extensions.cs:75:9:75:37 | call to method StaticObjectM1 | extensions.cs:21:27:21:40 | StaticObjectM1 | extensions.cs:19:5:24:5 | extension(Object) | MyExtensions+extension(System.Object).StaticObjectM1 |
|
||||
| extensions.cs:76:9:76:38 | call to method StaticObjectM2 | extensions.cs:22:27:22:40 | StaticObjectM2 | extensions.cs:19:5:24:5 | extension(Object) | MyExtensions+extension(System.Object).StaticObjectM2 |
|
||||
| extensions.cs:94:9:94:21 | call to method GenericM1 | extensions.cs:30:21:30:29 | GenericM1 | extensions.cs:26:5:35:5 | extension(Object)<Object> | MyExtensions+extension(System.Object)<System.Object>.GenericM1 |
|
||||
| extensions.cs:95:9:95:21 | call to method GenericM1 | extensions.cs:30:21:30:29 | GenericM1 | extensions.cs:26:5:35:5 | extension(String)<String> | MyExtensions+extension(System.String)<System.String>.GenericM1 |
|
||||
| extensions.cs:98:9:98:33 | call to method GenericM1 | extensions.cs:30:21:30:29 | GenericM1 | extensions.cs:26:5:35:5 | extension(Object)<Object> | MyExtensions+extension(System.Object)<System.Object>.GenericM1 |
|
||||
| extensions.cs:99:9:99:33 | call to method GenericM1 | extensions.cs:30:21:30:29 | GenericM1 | extensions.cs:26:5:35:5 | extension(String)<String> | MyExtensions+extension(System.String)<System.String>.GenericM1 |
|
||||
| extensions.cs:101:9:101:23 | call to method GenericM2<Int32> | extensions.cs:31:21:31:32 | GenericM2<Int32> | extensions.cs:26:5:35:5 | extension(Object)<Object> | MyExtensions+extension(System.Object)<System.Object>.GenericM2<Int32> |
|
||||
| extensions.cs:102:9:102:37 | call to method GenericM2<Int32> | extensions.cs:31:21:31:32 | GenericM2<Int32> | extensions.cs:26:5:35:5 | extension(Object)<Object> | MyExtensions+extension(System.Object)<System.Object>.GenericM2<Int32> |
|
||||
| extensions.cs:104:9:104:47 | call to method StringGenericM1<Int32> | extensions.cs:16:18:16:35 | StringGenericM1<Int32> | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).StringGenericM1<Int32> |
|
||||
| extensions.cs:105:9:105:69 | call to method StringGenericM1<String> | extensions.cs:16:18:16:35 | StringGenericM1<String> | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).StringGenericM1<String> |
|
||||
extensionParameter
|
||||
| extensions.cs:11:21:11:22 | M1 | extensions.cs:6:22:6:22 | s | 0 | string | extensions.cs:6:22:6:22 | s |
|
||||
| extensions.cs:12:23:12:24 | M2 | extensions.cs:6:22:6:22 | s | 0 | string | extensions.cs:6:22:6:22 | s |
|
||||
| extensions.cs:12:23:12:24 | M2 | extensions.cs:12:33:12:37 | other | 1 | string | extensions.cs:12:33:12:37 | other |
|
||||
| extensions.cs:14:27:14:34 | StaticM2 | extensions.cs:14:43:14:43 | x | 0 | string | extensions.cs:14:43:14:43 | x |
|
||||
| extensions.cs:16:18:16:35 | StringGenericM1<Int32> | extensions.cs:6:22:6:22 | s | 0 | string | extensions.cs:6:22:6:22 | s |
|
||||
| extensions.cs:16:18:16:35 | StringGenericM1<Int32> | extensions.cs:16:39:16:39 | t | 1 | int | extensions.cs:16:39:16:39 | t |
|
||||
| extensions.cs:16:18:16:35 | StringGenericM1<Int32> | extensions.cs:16:49:16:49 | o | 2 | object | extensions.cs:16:49:16:49 | o |
|
||||
| extensions.cs:16:18:16:35 | StringGenericM1<String> | extensions.cs:6:22:6:22 | s | 0 | string | extensions.cs:6:22:6:22 | s |
|
||||
| extensions.cs:16:18:16:35 | StringGenericM1<String> | extensions.cs:16:39:16:39 | t | 1 | string | extensions.cs:16:39:16:39 | t |
|
||||
| extensions.cs:16:18:16:35 | StringGenericM1<String> | extensions.cs:16:49:16:49 | o | 2 | object | extensions.cs:16:49:16:49 | o |
|
||||
| extensions.cs:16:18:16:35 | StringGenericM1`1 | extensions.cs:6:22:6:22 | s | 0 | string | extensions.cs:6:22:6:22 | s |
|
||||
| extensions.cs:16:18:16:35 | StringGenericM1`1 | extensions.cs:16:39:16:39 | t | 1 | T | extensions.cs:16:39:16:39 | t |
|
||||
| extensions.cs:16:18:16:35 | StringGenericM1`1 | extensions.cs:16:49:16:49 | o | 2 | object | extensions.cs:16:49:16:49 | o |
|
||||
| extensions.cs:22:27:22:40 | StaticObjectM2 | extensions.cs:22:49:22:49 | s | 0 | string | extensions.cs:22:49:22:49 | s |
|
||||
| extensions.cs:30:21:30:29 | GenericM1 | extensions.cs:26:20:26:20 | t | 0 | T | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:30:21:30:29 | GenericM1 | extensions.cs:26:20:26:20 | t | 0 | object | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:30:21:30:29 | GenericM1 | extensions.cs:26:20:26:20 | t | 0 | string | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:31:21:31:32 | GenericM2<Int32> | extensions.cs:26:20:26:20 | t | 0 | object | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:31:21:31:32 | GenericM2<Int32> | extensions.cs:31:36:31:40 | other | 1 | int | extensions.cs:31:36:31:40 | other |
|
||||
| extensions.cs:31:21:31:32 | GenericM2`1 | extensions.cs:26:20:26:20 | t | 0 | T | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:31:21:31:32 | GenericM2`1 | extensions.cs:26:20:26:20 | t | 0 | object | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:31:21:31:32 | GenericM2`1 | extensions.cs:26:20:26:20 | t | 0 | string | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:31:21:31:32 | GenericM2`1 | extensions.cs:31:36:31:40 | other | 1 | S | extensions.cs:31:36:31:40 | other |
|
||||
| extensions.cs:31:21:31:32 | GenericM2`1 | extensions.cs:31:36:31:40 | other | 1 | S | extensions.cs:31:36:31:40 | other |
|
||||
| extensions.cs:31:21:31:32 | GenericM2`1 | extensions.cs:31:36:31:40 | other | 1 | S | extensions.cs:31:36:31:40 | other |
|
||||
| extensions.cs:32:21:32:35 | GenericStaticM1 | extensions.cs:26:20:26:20 | t | 0 | T | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:32:21:32:35 | GenericStaticM1 | extensions.cs:26:20:26:20 | t | 0 | object | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:32:21:32:35 | GenericStaticM1 | extensions.cs:26:20:26:20 | t | 0 | string | extensions.cs:26:20:26:20 | t |
|
||||
| extensions.cs:33:28:33:45 | GenericStaticM2`1 | extensions.cs:33:49:33:53 | other | 0 | S | extensions.cs:33:49:33:53 | other |
|
||||
| extensions.cs:33:28:33:45 | GenericStaticM2`1 | extensions.cs:33:49:33:53 | other | 0 | S | extensions.cs:33:49:33:53 | other |
|
||||
| extensions.cs:33:28:33:45 | GenericStaticM2`1 | extensions.cs:33:49:33:53 | other | 0 | S | extensions.cs:33:49:33:53 | other |
|
||||
| extensions.cs:40:24:40:25 | M3 | extensions.cs:40:39:40:39 | s | 0 | string | extensions.cs:40:39:40:39 | s |
|
||||
extensionOperatorCallArgument
|
||||
| extensions.cs:15:39:15:39 | * | extensions.cs:65:19:65:23 | call to operator * | extensions.cs:15:45:15:45 | a | 0 | extensions.cs:65:19:65:19 | 3 |
|
||||
| extensions.cs:15:39:15:39 | * | extensions.cs:65:19:65:23 | call to operator * | extensions.cs:15:55:15:55 | b | 1 | extensions.cs:65:23:65:23 | access to local variable s |
|
||||
| extensions.cs:15:39:15:39 | * | extensions.cs:79:9:79:38 | call to operator * | extensions.cs:15:45:15:45 | a | 0 | extensions.cs:79:34:79:34 | 3 |
|
||||
| extensions.cs:15:39:15:39 | * | extensions.cs:79:9:79:38 | call to operator * | extensions.cs:15:55:15:55 | b | 1 | extensions.cs:79:37:79:37 | access to local variable s |
|
||||
extensionOperatorCalls
|
||||
| extensions.cs:65:19:65:23 | call to operator * | extensions.cs:15:39:15:39 | * | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).op_Multiply |
|
||||
| extensions.cs:79:9:79:38 | call to operator * | extensions.cs:15:39:15:39 | * | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).op_Multiply |
|
||||
extensionProperty
|
||||
| extensions.cs:8:21:8:25 | Prop1 | extensions.cs:6:5:17:5 | extension(String) |
|
||||
| extensions.cs:9:21:9:25 | Prop2 | extensions.cs:6:5:17:5 | extension(String) |
|
||||
| extensions.cs:10:28:10:38 | StaticProp1 | extensions.cs:6:5:17:5 | extension(String) |
|
||||
| extensions.cs:23:28:23:37 | StaticProp | extensions.cs:19:5:24:5 | extension(Object) |
|
||||
| extensions.cs:28:21:28:32 | GenericProp1 | extensions.cs:26:5:35:5 | extension(Object)<Object> |
|
||||
| extensions.cs:28:21:28:32 | GenericProp1 | extensions.cs:26:5:35:5 | extension(String)<String> |
|
||||
| extensions.cs:28:21:28:32 | GenericProp1 | extensions.cs:26:5:35:5 | extension(T)`1 |
|
||||
| extensions.cs:29:21:29:32 | GenericProp2 | extensions.cs:26:5:35:5 | extension(Object)<Object> |
|
||||
| extensions.cs:29:21:29:32 | GenericProp2 | extensions.cs:26:5:35:5 | extension(String)<String> |
|
||||
| extensions.cs:29:21:29:32 | GenericProp2 | extensions.cs:26:5:35:5 | extension(T)`1 |
|
||||
extensionPropertyCall
|
||||
| extensions.cs:50:19:50:25 | access to property Prop1 | extensions.cs:8:21:8:25 | Prop1 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).Prop1 |
|
||||
| extensions.cs:51:19:51:25 | access to property Prop2 | extensions.cs:9:21:9:25 | Prop2 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).Prop2 |
|
||||
| extensions.cs:52:9:52:15 | access to property Prop2 | extensions.cs:9:21:9:25 | Prop2 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).Prop2 |
|
||||
| extensions.cs:53:19:53:36 | access to property StaticProp1 | extensions.cs:10:28:10:38 | StaticProp1 | extensions.cs:6:5:17:5 | extension(String) | MyExtensions+extension(System.String).StaticProp1 |
|
||||
| extensions.cs:54:19:54:35 | access to property StaticProp | extensions.cs:23:28:23:37 | StaticProp | extensions.cs:19:5:24:5 | extension(Object) | MyExtensions+extension(System.Object).StaticProp |
|
||||
extensionAccessorCall
|
||||
| extensions.cs:82:9:82:33 | call to extension accessor get_Prop1 | extensions.cs:8:30:8:41 | get_Prop1 | extensions.cs:8:21:8:25 | Prop1 | MyExtensions+extension(System.String).get_Prop1 |
|
||||
| extensions.cs:83:9:83:33 | call to extension accessor get_Prop2 | extensions.cs:9:29:9:31 | get_Prop2 | extensions.cs:9:21:9:25 | Prop2 | MyExtensions+extension(System.String).get_Prop2 |
|
||||
| extensions.cs:84:9:84:40 | call to extension accessor set_Prop2 | extensions.cs:9:50:9:52 | set_Prop2 | extensions.cs:9:21:9:25 | Prop2 | MyExtensions+extension(System.String).set_Prop2 |
|
||||
| extensions.cs:85:9:85:37 | call to extension accessor get_StaticProp | extensions.cs:23:42:23:45 | get_StaticProp | extensions.cs:23:28:23:37 | StaticProp | MyExtensions+extension(System.Object).get_StaticProp |
|
||||
69
csharp/ql/test/library-tests/extension/extensions.ql
Normal file
69
csharp/ql/test/library-tests/extension/extensions.ql
Normal file
@@ -0,0 +1,69 @@
|
||||
import csharp
|
||||
|
||||
query predicate extensionMethodCallArgument(
|
||||
ExtensionMethodCall emc, ExtensionMethod em, Parameter p, int i, Expr e
|
||||
) {
|
||||
em.getFile().getBaseName() = "extensions.cs" and
|
||||
emc.getTarget() = em and
|
||||
em.getParameter(i) = p and
|
||||
emc.getArgument(i) = e
|
||||
}
|
||||
|
||||
query predicate extensionMethodCalls(
|
||||
ExtensionMethodCall emc, ExtensionMethod em, Type t, string type
|
||||
) {
|
||||
em.getFile().getBaseName() = "extensions.cs" and
|
||||
emc.getTarget() = em and
|
||||
em.getDeclaringType() = t and
|
||||
em.getFullyQualifiedNameDebug() = type
|
||||
}
|
||||
|
||||
query predicate extensionParameter(
|
||||
ExtensionMethod em, Parameter p, int i, string type, Parameter unbound
|
||||
) {
|
||||
em.getFile().getBaseName() = "extensions.cs" and
|
||||
p = em.getParameter(i) and
|
||||
type = p.getType().toStringWithTypes() and
|
||||
unbound = p.getUnboundDeclaration()
|
||||
}
|
||||
|
||||
query predicate extensionOperatorCallArgument(
|
||||
ExtensionOperator op, ExtensionOperatorCall opc, Parameter p, int pos, Expr e
|
||||
) {
|
||||
opc.getTarget() = op and
|
||||
op.getFile().getBaseName() = "extensions.cs" and
|
||||
p = op.getParameter(pos) and
|
||||
e = opc.getArgument(pos)
|
||||
}
|
||||
|
||||
query predicate extensionOperatorCalls(
|
||||
ExtensionOperatorCall opc, ExtensionOperator op, Type t, string type
|
||||
) {
|
||||
op.getFile().getBaseName() = "extensions.cs" and
|
||||
opc.getTarget() = op and
|
||||
op.getDeclaringType() = t and
|
||||
op.getFullyQualifiedNameDebug() = type
|
||||
}
|
||||
|
||||
query predicate extensionProperty(ExtensionProperty p, Type t) {
|
||||
p.getFile().getBaseName() = "extensions.cs" and
|
||||
p.getDeclaringType() = t
|
||||
}
|
||||
|
||||
query predicate extensionPropertyCall(
|
||||
ExtensionPropertyCall pc, ExtensionProperty p, Type t, string type
|
||||
) {
|
||||
p.getFile().getBaseName() = "extensions.cs" and
|
||||
pc.getProperty() = p and
|
||||
p.getDeclaringType() = t and
|
||||
p.getFullyQualifiedNameDebug() = type
|
||||
}
|
||||
|
||||
query predicate extensionAccessorCall(
|
||||
MethodCall m, ExtensionAccessor a, ExtensionProperty p, string type
|
||||
) {
|
||||
p.getFile().getBaseName() = "extensions.cs" and
|
||||
(a.(Getter).getDeclaration() = p or a.(Setter).getDeclaration() = p) and
|
||||
m.getTargetAccessor() = a and
|
||||
a.getFullyQualifiedNameDebug() = type
|
||||
}
|
||||
2
csharp/ql/test/library-tests/extension/options
Normal file
2
csharp/ql/test/library-tests/extension/options
Normal file
@@ -0,0 +1,2 @@
|
||||
semmle-extractor-options: /nostdlib /noconfig
|
||||
semmle-extractor-options: --load-sources-from-project:${testdir}/../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
|
||||
Reference in New Issue
Block a user