mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
C#: Extract anonymous types explicitly
This commit is contained in:
@@ -87,6 +87,11 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
foreach (var l in Locations)
|
||||
trapFile.type_location(this, l);
|
||||
}
|
||||
|
||||
if (symbol.IsAnonymousType)
|
||||
{
|
||||
trapFile.anonymous_types(this);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Lazy<Type[]> typeArgumentsLazy;
|
||||
|
||||
@@ -271,6 +271,11 @@ namespace Semmle.Extraction.CSharp
|
||||
trapFile.WriteTuple("extend", type, super);
|
||||
}
|
||||
|
||||
internal static void anonymous_types(this TextWriter trapFile, Type type)
|
||||
{
|
||||
trapFile.WriteTuple("anonymous_types", type);
|
||||
}
|
||||
|
||||
internal static void field_location(this TextWriter trapFile, Field field, Location location)
|
||||
{
|
||||
trapFile.WriteTuple("field_location", field, location);
|
||||
|
||||
@@ -746,7 +746,7 @@ class Class extends RefType, @class_type {
|
||||
* ```
|
||||
*/
|
||||
class AnonymousClass extends Class {
|
||||
AnonymousClass() { this.getName().matches("<%") }
|
||||
AnonymousClass() { anonymous_types(this) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -413,6 +413,9 @@ extend(
|
||||
unique int sub: @type ref,
|
||||
int super: @type_or_ref ref);
|
||||
|
||||
anonymous_types(
|
||||
unique int id: @type ref);
|
||||
|
||||
@interface_or_ref = @interface_type | @typeref;
|
||||
|
||||
implement(
|
||||
|
||||
Reference in New Issue
Block a user