dmd.func

Defines a function declaration.

Includes: - function/delegate literals - function aliases - (static/shared) constructors/destructors/post-blits - invariant - unittest

Members

Classes

CtorDeclaration
class CtorDeclaration
DtorDeclaration
class DtorDeclaration
FuncAliasDeclaration
class FuncAliasDeclaration

Used as a way to import a set of functions from another scope into this one.

FuncDeclaration
class FuncDeclaration
FuncLiteralDeclaration
class FuncLiteralDeclaration
InvariantDeclaration
class InvariantDeclaration
NewDeclaration
class NewDeclaration
PostBlitDeclaration
class PostBlitDeclaration
SharedStaticCtorDeclaration
class SharedStaticCtorDeclaration
SharedStaticDtorDeclaration
class SharedStaticDtorDeclaration
StaticCtorDeclaration
class StaticCtorDeclaration
StaticDtorDeclaration
class StaticDtorDeclaration
UnitTestDeclaration
class UnitTestDeclaration

Enums

FuncResolveFlag
enum FuncResolveFlag

Flag used by resolveFuncCall.

ILS
enum ILS

Inline Status

Functions

MODMatchToBuffer
auto MODMatchToBuffer(OutBuffer* buf, ubyte lhsMod, ubyte rhsMod)

Checks for mismatching modifiers between lhsMod and rhsMod and prints the mismatching modifiers to buf.

addInvariant
Expression addInvariant(AggregateDeclaration ad, VarDeclaration vthis)

Generate Expression to call the invariant. Input: ad aggregate with the invariant vthis variable with 'this'

errorSupplementalInferredAttr
void errorSupplementalInferredAttr(FuncDeclaration fd, int maxDepth, bool deprecation, STC stc)

Print the reason why fd was inferred @system as a supplemental error

getIndirection
Type getIndirection(Type t)

Returns an indirect type one step from t.

isRootTraitsCompilesScope
bool isRootTraitsCompilesScope(Scope* sc)

When a traits(compiles) is used on a function literal call we need to take into account if the body of the function violates any attributes, however, we must not affect the attribute inference on the outer function. The attributes of the function literal still need to be inferred, therefore we need a way to check for the scope that the traits compiles introduces.

overloadApply
int overloadApply(Dsymbol fstart, int delegate(Dsymbol) dg, Scope* sc)

Visit each overloaded function/template in turn, and call dg(s) on it. Exit when no more, or dg(s) returns nonzero.

resolveFuncCall
FuncDeclaration resolveFuncCall(Loc loc, Scope* sc, Dsymbol s, Objects* tiargs, Type tthis, ArgumentList argumentList, FuncResolveFlag flags)

Given a symbol that could be either a FuncDeclaration or a function template, resolve it to a function symbol.

setUnsafe
bool setUnsafe(Scope* sc, bool gag, Loc loc, const(char)* fmt, RootObject arg0, RootObject arg1, RootObject arg2)

A statement / expression in this scope is not @safe, so mark the enclosing function as @system

setUnsafePreview
bool setUnsafePreview(Scope* sc, FeatureState fs, bool gag, Loc loc, const(char)* msg, RootObject arg0, RootObject arg1, RootObject arg2)

Like setUnsafe, but for safety errors still behind preview switches

Structs

AttributeViolation
struct AttributeViolation

Stores a reason why a function failed to infer a function attribute like @safe or pure

Ensure
struct Ensure

Tuple of result identifier (possibly null) and statement. This is used to store out contracts: out(id){ ensure }

Meta