dmd.dinterpret

The entry point for CTFE.

Specification: ($LINK2 https://dlang.org/spec/function.html#interpretation, Compile Time Function Execution (CTFE))

Authors

Walter Bright

Source: dinterpret.d

  • Declaration

    Expression ctfeInterpret(Expression e);

    Entry point for CTFE. A compile-time result is required. Give an error if not possible.

    Discussion

    e must be semantically valid expression. In other words, it should not contain any ErrorExps in it. But, CTFE interpretation will cross over functions and may invoke a function that contains ErrorStatement in its body. If that, the "CTFE failed because of previous errors" error is raised.

  • Declaration

    T ctfeEmplaceExp(T : Expression, Args...)(Args args);

    Allocate an Expression in the ctfe region.

    Parameters

    T

    type of Expression to allocate

    Args args

    arguments to Expression's constructor

    Return Value

    allocated Expression

  • Declaration

    void incArrayAllocs();

  • Declaration

    CallExp isRuntimeHook(Expression e, Identifier id);

    Checks if the given expresion is a call to the runtime hook id.

    Parameters

    Expression e

    the expression to check

    Identifier id

    the identifier of the runtime hook

    Return Value

    e cast to CallExp if it's the hook, null otherwise