C#: Add missing QlDoc for various predicates

This commit is contained in:
Tamas Vajk
2020-08-26 11:18:40 +02:00
parent ce68e458e0
commit 4be15af06a
6 changed files with 15 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ class ReadRefAccess extends ReadAccess, ReadRef { }
/** An instruction that writes a variable. */
class WriteAccess extends VariableAccess, @cil_write_access {
/** Gets the `Expr` whose value is used in this variable write. */
Expr getExpr() { none() }
}

View File

@@ -437,6 +437,9 @@ class Operator extends Callable, Member, Attributable, @operator {
override string getName() { operators(this, _, result, _, _, _) }
/**
* Gets the metadata name of the operator, such as `op_implicit` or `op_RightShift`.
*/
string getFunctionName() { none() }
override ValueOrRefType getDeclaringType() { operators(this, _, _, result, _, _) }

View File

@@ -514,6 +514,11 @@ predicate convNullableType(ValueOrRefType fromType, NullableType toType) {
)
}
/**
* Holds if `fromType` is `NullType`, and `toType` is a type that can represent
* the `null` value, such as a reference type, `Nullable<T>` or a type parameter
* with contraints that restrict it to a reference type.
*/
// This is a deliberate, small Cartesian product, so we have manually lifted it to force the
// evaluator to evaluate it in its entirety, rather than trying to optimize it in context.
pragma[noinline]

View File

@@ -26,6 +26,7 @@ class RuntimeMethod extends RuntimeCallable {
this instanceof CIL::Method
}
/** Holds if the method is `static`. */
predicate isStatic() { this.(Method).isStatic() or this.(CIL::Method).isStatic() }
}

View File

@@ -1011,6 +1011,7 @@ class RangeExpr extends Expr, @range_expr {
/** An index expression, for example `^1` meaning "1 from the end". */
class IndexExpr extends Expr, @index_expr {
/** Gets the sub expression of this `IndexExpr`. */
Expr getExpr() { result.getParent() = this }
override string toString() { result = "^..." }

View File

@@ -222,6 +222,10 @@ predicate shareFieldOrProperty(ValueOrRefType t, Method m1, Method m2) {
)
}
/**
* Holds if `Method` `m` is declared in `ValueOrRefType` `t`, and if there's a
* `FieldAccess` or `PropertyAccess` in `m` that accesses `Declaration` `d`.
*/
predicate methodUsesFieldOrProperty(ValueOrRefType t, Method m, Declaration d) {
m.getDeclaringType() = t and
(