dmd.dcast

Semantic analysis for cast-expressions.

Members

Functions

arrayTypeCompatibleWithoutCasting
bool arrayTypeCompatibleWithoutCasting(Type t1, Type t2)

See if both types are arrays that can be compared for equality without any casting. Return true if so. This is to enable comparing things like an immutable array with a mutable one.

castTo
Expression castTo(Expression e, Scope* sc, Type t, Type att)

Do an explicit cast. Assume that the expression e does not have any indirections. (Parameter 'att' is used to stop 'alias this' recursion)

cimplicitConvTo
MATCH cimplicitConvTo(Expression e, Type t)

Same as implicitConvTo(); except follow C11 rules, which are quite a bit more permissive than D. C11 6.3 and 6.5.16.1

fix16997
void fix16997(Scope* sc, UnaExp ue)

This provides a transition from the non-promoting behavior of unary + - ~ to the C-like integral promotion behavior.

getIntRange
IntRange getIntRange(Expression e)
implicitCastTo
Expression implicitCastTo(Expression e, Scope* sc, Type t)

Attempt to implicitly cast the expression into type t.

implicitConvTo
MATCH implicitConvTo(Expression e, Type t)

Checks whether or not an expression can be implicitly converted to type t.

inferType
Expression inferType(Expression e, Type t, int flag)

Set type inference target t Target type flag 1: don't put an error when inference fails

integralPromotions
Expression integralPromotions(Expression e, Scope* sc)

Do integral promotions (convertchk). Don't convert <array of> to <pointer to>

scaleFactor
Expression scaleFactor(BinExp be, Scope* sc)

Scale addition/subtraction to/from pointer.

specialNoreturnCast
Expression specialNoreturnCast(Expression toBeCasted, Type to)

A helper function to "cast" from expressions of type noreturn to any other type - noreturn is implicitly convertible to any other type. However, the dmd backend does not like a naive cast from a noreturn expression (particularly an assert(0)) so this function generates:

toStaticArrayType
Type toStaticArrayType(SliceExp e)
typeCombine
Expression typeCombine(BinExp be, Scope* sc)

Bring leaves to common type.

typeMerge
Type typeMerge(Scope* sc, EXP op, Expression pe1, Expression pe2)

Merge types of e1 and e2 into a common subset

Meta