Extend C# control flow elements with type mentions

This commit is contained in:
copilot-swe-agent[bot]
2026-06-22 13:17:44 +00:00
committed by GitHub
parent d7ec468e2e
commit f3c85c0ff7
2 changed files with 6 additions and 5 deletions

View File

@@ -6,6 +6,7 @@ import Generics
import Location
import Namespace
import Property
import semmle.code.csharp.controlflow.ControlFlowElement
private import Conversion
private import semmle.code.csharp.metrics.Coupling
private import TypeRef
@@ -1286,7 +1287,7 @@ class TupleType extends ValueType, @tuple_type {
* A type mention, that is, any mention of a type in a source code file.
* For example, `int` is mentioned in `int M() { return 1; }`.
*/
class TypeMention extends @type_mention {
class TypeMention extends ControlFlowElement, @type_mention {
Type type;
@type_mention_parent parent;
@@ -1319,13 +1320,13 @@ class TypeMention extends @type_mention {
* }
* ```
*/
TypeMention getParent() { result = parent }
override TypeMention getParent() { result = parent }
/** Gets a textual representation of this type mention. */
string toString() { result = type.toString() }
override string toString() { result = type.toString() }
/** Gets the location of this type mention. */
Location getLocation() { type_mention_location(this, result) }
override Location getALocation() { type_mention_location(this, result) }
}
/**

View File

@@ -219,7 +219,7 @@ overlayChangedFiles(
/** ELEMENTS **/
@element = @declaration | @stmt | @expr | @modifier | @attribute | @namespace_declaration
| @using_directive | @type_parameter_constraints | @externalDataElement
| @using_directive | @type_parameter_constraints | @type_mention | @externalDataElement
| @xmllocatable | @asp_element | @namespace | @preprocessor_directive;
@declaration = @callable | @generic | @assignable | @namespace;