Module Expr

Provides all expression classes.

All expressions have the common base class Expr.

Import path

semmle.code.csharp.exprs.Expr

Imports

Access

Provides all access expression classes.

ArithmeticOperation

Provides all arithmetic operation classes.

Assignment

Provides all assignment classes.

BitwiseOperation

Provides all bitwise operation classes.

Call

Provides all call classes.

Callable

Provides Callable classes, which are things that can be called such as methods and operators.

ComparisonOperation

Provides all comparison operation classes.

ControlFlowElement

Provides the class ControlFlowElement.

Creation

Provides expression classes for creating various types of object.

Dynamic

Provides all dynamic expression classes.

Literal

Provides all literal classes.

Location

Provides the Location class to give a location for each program element.

LogicalOperation

Provides all logical operation classes.

Stmt

Provides all statement classes.

Type

Provides classes for types.

Classes

AddressOfExpr

An address-of expression, for example &n on line 4 in

AsExpr

An as expression, for example x as string.

AwaitExpr

An await expression, for example await AsyncMethodThatReturnsTask().

BinaryOperation

A binary operation. Either a binary arithemtic operation (BinaryArithmeticOperation), a binary bitwise operation (BinaryBitwiseOperation), a comparison operation (ComparisonOperation), or a binary logical operation (BinaryLogicalOperation).

Cast

A cast. Either an as expression (AsExpr) or a cast expression (CastExpr).

CastExpr

A cast expression, for example (string) x.

CheckedExpr

A checked expression, for example checked(2147483647 + ten).

DefaultValueExpr

A default expression, for example default or default(string).

DiscardExpr

A discard expression, for example _ in

ExplicitCast

An explicit cast. For example, the explicit cast from object to string on line 2 in

Expr

An expression. Either an access (Access), a call (Call), an object or collection initializer (ObjectOrCollectionInitializer), a delegate creation (DelegateCreation), an array initializer (ArrayInitializer), an array creation (ArrayCreation), an anonymous function (AnonymousFunctionExpr), a local variable declaration (LocalVariableDeclExpr), an operation (Operation), a parenthesized expression (ParenthesizedExpr), a checked expression (CheckedExpr), an unchecked expression (UncheckedExpr), an is expression (IsExpr), an as expression (AsExpr), a cast (CastExpr), a typeof expression (TypeofExpr), a default expression (DefaultValueExpr), an await expression (AwaitExpr), a nameof expression (NameOfExpr), an interpolated string (InterpolatedStringExpr), a qualifiable expression (QualifiableExpr), or a literal (Literal).

ImplicitCast

An implicit cast. For example, the implicit cast from string to object on line 3 in

InterpolatedStringExpr

An interpolated string, for example $"Hello, {name}!" on line 2 in

IsConstantExpr

An is constant expression, for example x is 5.

IsExpr

An is expression. Either an is type expression (IsTypeExpr) or an is constant expression (IsConstantExpr).

IsPatternExpr

An is pattern expression, for example x is string s.

IsTypeExpr

An is type expression, for example, x is string or x is string s.

LateBindableExpr

An expression whose target may be late bound when using dynamic subexpressions. Either a method call (MethodCall), an operator call (OperatorCall), a constructor call (ObjectCreation), a dynamic member access (DynamicMemberAccess), or a dynamic element access (DynamicElementAccess).

LocalConstantDeclExpr

A local constant declaration, for example const int i = 0.

LocalVariableDeclExpr

A local variable declaration, for example var i = 0.

NameOfExpr

A nameof expression, for example nameof(s) on line 3 in

Operation

An operation. Either an assignment (Assignment), a unary operation (UnaryOperation), a binary operation (BinaryOperation), or a ternary operation (TernaryOperation).

ParenthesizedExpr

A parenthesized expression, for example (2 + 3) in

PointerIndirectionExpr

A pointer indirection operation, for example *pn on line 7, pa->M() on line 13, and cp[1] on line 18 in

QualifiableExpr

An expression that may have a qualifier. Either a member access (MemberAccess), an element access (ElementAccess), a method call (MethodCall) or a property access (PropertyAccess), or an accessor call (AccessorCall).

RefExpr

A reference expression, for example ref a[i] on line 2 in

SizeofExpr

A sizeof expression, for example sizeof(int).

TernaryOperation

A ternary operation, that is, a ternary conditional operation (ConditionalExpr).

ThrowElement

A throw element. Either a throw expression (ThrowExpr) or a throw statement (ThrowStmt).

ThrowExpr

A throw expression, for example throw new ArgumentException("i") in return i != 0 ? 1 / i : throw new ArgumentException("i");

TupleExpr

An expression representing a tuple, for example (1, 2) on line 2 or (var x, var y) on line 5 in

TypeofExpr

A typeof expression, for example typeof(string).

UnaryOperation

A unary operation. Either a unary arithemtic operation (UnaryArithmeticOperation), a unary bitwise operation (UnaryBitwiseOperation), a sizeof operation (SizeofExpr), a pointer indirection operation (PointerIndirectionExpr), an address-of operation (AddressOfExpr), or a unary logical operation (UnaryLogicalOperation).

UncheckedExpr

An unchecked expression, for example unchecked(ConstantMax + 10).