View source code
Display the source code in dmd/func.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Module dmd.func

Defines a function declaration.

Includes

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

Documentation

https://dlang.org/phobos/dmd_func.html

Coverage

https://codecov.io/gh/dlang/dmd/src/master/src/dmd/func.d

Functions

NameDescription
addInvariant(ad, vthis) Generate Expression to call the invariant.
errorSupplementalInferredAttr(fd, maxDepth, deprecation, stc) Print the reason why fd was inferred @system as a supplemental error
getIndirection(t) Returns an indirect type one step from t.
isRootTraitsCompilesScope(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.
MODMatchToBuffer(buf, lhsMod, rhsMod) Checks for mismatching modifiers between lhsMod and rhsMod and prints the mismatching modifiers to buf.
overloadApply(fstart, dg, sc) Visit each overloaded function/template in turn, and call dg(s) on it. Exit when no more, or dg(s) returns nonzero.
resolveFuncCall(loc, sc, s, tiargs, tthis, argumentList, flags) Given a symbol that could be either a FuncDeclaration or a function template, resolve it to a function symbol.
setUnsafe(sc, gag, loc, fmt, arg0, arg1, arg2) A statement / expression in this scope is not @safe, so mark the enclosing function as @system
setUnsafePreview(sc, fs, gag, loc, msg, arg0, arg1, arg2) Like setUnsafe, but for safety errors still behind preview switches

Classes

NameDescription
CtorDeclaration
DtorDeclaration
FuncAliasDeclaration Used as a way to import a set of functions from another scope into this one.
FuncDeclaration
FuncLiteralDeclaration
InvariantDeclaration
NewDeclaration
PostBlitDeclaration
SharedStaticCtorDeclaration
SharedStaticDtorDeclaration
StaticCtorDeclaration
StaticDtorDeclaration
UnitTestDeclaration

Structs

NameDescription
AttributeViolation Stores a reason why a function failed to infer a function attribute like @safe or pure
Ensure Tuple of result identifier (possibly null) and statement. This is used to store out contracts: out(id){ ensure }

Enums

NameDescription
FuncResolveFlag Flag used by resolveFuncCall.
ILS Inline Status

Authors

Walter Bright

License

Boost License 1.0