dmd.optimize

Perform constant folding.

Members

Functions

Expression_optimize
Expression Expression_optimize(Expression e, int result, bool keepLvalue)

Constant fold an Expression.

expandVar
Expression expandVar(int result, VarDeclaration v)

If variable has a const initializer, return that initializer.

setLengthVarIfKnown
void setLengthVarIfKnown(VarDeclaration lengthVar, Expression arr)

It is possible for constant folding to change an array expression of unknown length, into one where the length is known. If the expression 'arr' is a literal, set lengthVar to be its length.

setLengthVarIfKnown
void setLengthVarIfKnown(VarDeclaration lengthVar, Type type)

Same as above, but determines the length from 'type'.

Meta