Skip to content

Commit a6f95c5

Browse files
committed
C#: Remove deprecated predicates.
1 parent 982208c commit a6f95c5

File tree

6 files changed

+0
-215
lines changed

6 files changed

+0
-215
lines changed

csharp/ql/lib/semmle/code/csharp/Callable.qll

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -21,70 +21,6 @@ private import TypeRef
2121
* (`LocalFunction`).
2222
*/
2323
class Callable extends Parameterizable, ExprOrStmtParent, @callable {
24-
pragma[noinline]
25-
deprecated private string getDeclaringTypeLabel() { result = this.getDeclaringType().getLabel() }
26-
27-
pragma[noinline]
28-
deprecated private string getParameterTypeLabelNonGeneric(int p) {
29-
not this instanceof Generic and
30-
result = this.getParameter(p).getType().getLabel()
31-
}
32-
33-
language[monotonicAggregates]
34-
pragma[nomagic]
35-
deprecated private string getMethodParamListNonGeneric() {
36-
result =
37-
concat(int p |
38-
p in [0 .. this.getNumberOfParameters() - 1]
39-
|
40-
this.getParameterTypeLabelNonGeneric(p), "," order by p
41-
)
42-
}
43-
44-
pragma[noinline]
45-
deprecated private string getParameterTypeLabelGeneric(int p) {
46-
this instanceof Generic and
47-
result = this.getParameter(p).getType().getLabel()
48-
}
49-
50-
language[monotonicAggregates]
51-
pragma[nomagic]
52-
deprecated private string getMethodParamListGeneric() {
53-
result =
54-
concat(int p |
55-
p in [0 .. this.getNumberOfParameters() - 1]
56-
|
57-
this.getParameterTypeLabelGeneric(p), "," order by p
58-
)
59-
}
60-
61-
pragma[noinline]
62-
deprecated private string getLabelNonGeneric() {
63-
not this instanceof Generic and
64-
result =
65-
this.getReturnTypeLabel() + " " + this.getDeclaringTypeLabel() + "." +
66-
this.getUndecoratedName() + "(" + this.getMethodParamListNonGeneric() + ")"
67-
}
68-
69-
pragma[noinline]
70-
deprecated private string getLabelGeneric() {
71-
result =
72-
this.getReturnTypeLabel() + " " + this.getDeclaringTypeLabel() + "." +
73-
this.getUndecoratedName() + getGenericsLabel(this) + "(" + this.getMethodParamListGeneric() +
74-
")"
75-
}
76-
77-
deprecated final override string getLabel() {
78-
result = this.getLabelNonGeneric() or
79-
result = this.getLabelGeneric()
80-
}
81-
82-
deprecated private string getReturnTypeLabel() {
83-
result = this.getReturnType().getLabel()
84-
or
85-
not exists(this.getReturnType()) and result = "System.Void"
86-
}
87-
8824
/** Gets the return type of this callable. */
8925
Type getReturnType() { none() }
9026

csharp/ql/lib/semmle/code/csharp/Element.qll

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ class Element extends @element {
2727
/** Holds if this element is from an assembly. */
2828
predicate fromLibrary() { this.getFile().fromLibrary() }
2929

30-
/**
31-
* Gets the "language" of this program element, as defined by the extension of the filename.
32-
* For example, C# has language "cs", and Visual Basic has language "vb".
33-
*/
34-
deprecated final string getLanguage() { result = this.getLocation().getFile().getExtension() }
35-
3630
/**
3731
* Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.
3832
*
@@ -159,29 +153,5 @@ class NamedElement extends Element, @named_element {
159153
qualifier = "" and name = this.getName()
160154
}
161155

162-
/** Gets a unique string label for this element. */
163-
cached
164-
deprecated string getLabel() { none() }
165-
166-
/** Holds if `other` has the same metadata handle in the same assembly. */
167-
deprecated predicate matchesHandle(NamedElement other) {
168-
exists(Assembly asm, int handle |
169-
metadata_handle(this, asm, handle) and
170-
metadata_handle(other, asm, handle)
171-
)
172-
}
173-
174-
/**
175-
* Holds if this element was compiled from source code that is also present in the
176-
* database. That is, this element corresponds to another element from source.
177-
*/
178-
deprecated predicate compiledFromSource() {
179-
not this.fromSource() and
180-
exists(NamedElement other | other != this |
181-
this.matchesHandle(other) and
182-
other.fromSource()
183-
)
184-
}
185-
186156
override string toString() { result = this.getName() }
187157
}

csharp/ql/lib/semmle/code/csharp/Generics.qll

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -103,33 +103,6 @@ class ConstructedGeneric extends Generic {
103103
final int getNumberOfTypeArguments() { result = count(int i | exists(this.getTypeArgument(i))) }
104104
}
105105

106-
/**
107-
* INTERNAL: Do not use.
108-
*
109-
* Constructs the label suffix for a generic method or type.
110-
*/
111-
deprecated string getGenericsLabel(Generic g) {
112-
result = "`" + g.(UnboundGeneric).getNumberOfTypeParameters()
113-
or
114-
result = "<" + typeArgs(g) + ">"
115-
}
116-
117-
pragma[noinline]
118-
deprecated private string getTypeArgumentLabel(ConstructedGeneric generic, int p) {
119-
result = generic.getTypeArgument(p).getLabel()
120-
}
121-
122-
language[monotonicAggregates]
123-
pragma[nomagic]
124-
deprecated private string typeArgs(ConstructedGeneric generic) {
125-
result =
126-
concat(int p |
127-
p in [0 .. generic.getNumberOfTypeArguments() - 1]
128-
|
129-
getTypeArgumentLabel(generic, p), ","
130-
)
131-
}
132-
133106
/** Gets the type arguments as a comma-separated string. */
134107
language[monotonicAggregates]
135108
private string getTypeArgumentsToString(ConstructedGeneric cg) {
@@ -264,8 +237,6 @@ class TypeParameter extends Type, @type_parameter {
264237
/** Gets the index of this type parameter. For example the index of `U` in `Func<T,U>` is 1. */
265238
override int getIndex() { type_parameters(this, result, _, _) }
266239

267-
deprecated final override string getLabel() { result = "!" + this.getIndex() }
268-
269240
override string getUndecoratedName() { result = "!" + this.getIndex() }
270241

271242
/** Gets the generic that defines this type parameter. */

csharp/ql/lib/semmle/code/csharp/Type.qll

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,6 @@ class ValueOrRefType extends Type, Attributable, @value_or_ref_type {
7676
/** Gets a nested child type, if any. */
7777
NestedType getAChildType() { nested_types(result, this, _) }
7878

79-
deprecated private string getPrefixWithTypes() {
80-
result = this.getDeclaringType().getLabel() + "."
81-
or
82-
if this.getDeclaringNamespace().isGlobalNamespace()
83-
then result = ""
84-
else result = this.getDeclaringNamespace().getFullName() + "."
85-
}
86-
87-
pragma[noinline]
88-
deprecated private string getLabelNonGeneric() {
89-
not this instanceof Generic and
90-
result = this.getPrefixWithTypes() + this.getUndecoratedName()
91-
}
92-
93-
pragma[noinline]
94-
deprecated private string getLabelGeneric() {
95-
result = this.getPrefixWithTypes() + this.getUndecoratedName() + getGenericsLabel(this)
96-
}
97-
98-
deprecated override string getLabel() {
99-
result = this.getLabelNonGeneric() or
100-
result = this.getLabelGeneric()
101-
}
102-
10379
/**
10480
* Gets the source namespace declaration in which this type is declared, if any.
10581
* This only holds for non-nested types.
@@ -996,8 +972,6 @@ class FunctionPointerType extends Type, Parameterizable, @function_pointer_type
996972
AnnotatedType getAnnotatedReturnType() { result.appliesTo(this) }
997973

998974
override string getAPrimaryQlClass() { result = "FunctionPointerType" }
999-
1000-
deprecated override string getLabel() { result = this.getName() }
1001975
}
1002976

1003977
/**
@@ -1116,8 +1090,6 @@ class ArrayType extends RefType, @array_type {
11161090
array_element_type(this, _, _, getTypeRef(result))
11171091
}
11181092

1119-
deprecated final override string getLabel() { result = this.getElementType().getLabel() + "[]" }
1120-
11211093
/** Holds if this array type has the same shape (dimension and rank) as `that` array type. */
11221094
predicate hasSameShapeAs(ArrayType that) {
11231095
this.getDimension() = that.getDimension() and
@@ -1180,8 +1152,6 @@ class PointerType extends Type, @pointer_type {
11801152

11811153
final override string getName() { types(this, _, result) }
11821154

1183-
deprecated final override string getLabel() { result = this.getReferentType().getLabel() + "*" }
1184-
11851155
final override string getUndecoratedName() {
11861156
result = this.getReferentType().getUndecoratedName()
11871157
}
@@ -1271,8 +1241,6 @@ class TupleType extends ValueType, @tuple_type {
12711241
")"
12721242
}
12731243

1274-
deprecated override string getLabel() { result = this.getUnderlyingType().getLabel() }
1275-
12761244
override Type getChild(int i) { result = this.getUnderlyingType().getChild(i) }
12771245

12781246
override string getAPrimaryQlClass() { result = "TupleType" }

csharp/ql/test/library-tests/members/GetLabel.expected

Lines changed: 0 additions & 55 deletions
This file was deleted.

csharp/ql/test/library-tests/members/GetLabel.ql

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)