Files
codeql/csharp/ql/lib/semmle/code/dotnet/Variable.qll
Andrew Eisenberg c9f1c98390 Packaging: C# refactoring
Split c# pack into `codeql/csharp-all` and `codeql/csharp-queries`.
2021-08-19 14:09:35 -07:00

35 lines
1.1 KiB
Plaintext

/** Provides classes for .Net variables, such as fields and parameters. */
import Declaration
import Callable
/** A .Net variable. */
class Variable extends Declaration, @dotnet_variable {
/** Gets the type of this variable. */
Type getType() { none() }
}
/** A .Net field. */
class Field extends Variable, Member, @dotnet_field { }
/** A parameter to a .Net callable, property or function pointer type. */
class Parameter extends Variable, @dotnet_parameter {
/** Gets the raw position of this parameter, including the `this` parameter at index 0. */
final int getRawPosition() { this = getDeclaringElement().getRawParameter(result) }
/** Gets the position of this parameter, excluding the `this` parameter. */
int getPosition() { this = getDeclaringElement().getParameter(result) }
/** Gets the callable defining this parameter. */
Callable getCallable() { result = this.getDeclaringElement() }
/** Gets the declaring `Parameterizable`. */
Parameterizable getDeclaringElement() { none() }
/** Holds if this is an `out` parameter. */
predicate isOut() { none() }
/** Holds if this is a `ref` parameter. */
predicate isRef() { none() }
}