View source code
Display the source code in dmd/funcsem.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.funcsem

Does semantic analysis for functions.

Specification

Functions

Documentation

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

Coverage

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

Functions

NameDescription
addInvariant(ad, vthis) Generate Expression to call the invariant.
buildEnsureRequire(thisfd) Rewrite contracts as statements.
buildResultVar(fd, sc, tret) Declare result variable lazily.
canInferAttributes(fd, sc) Decide if attributes for this function can be inferred from examining the function body.
checkForwardRef(fd, loc) Check that this function type is properly resolved. If not, report "forward reference error" and return true.
checkNestedReference(fd, sc, loc) In the current function, we are calling 'this' function. 1. Check to see if the current function can call 'this' function, issue error if not. 2. If the current function is not the parent of 'this' function, then add the current function to the list of siblings of 'this' function. 3. If the current function is a literal, and it's accessing an uplevel scope, then mark it as a delegate. Returns true if error occurs.
declareThis(fd, sc) Creates and returns the hidden parameters for this function declaration.
findVtblIndex(fd, vtbl) Find index of function in vtbl[0..length] that this function overrides. Prefer an exact match to a covariant one.
funcDeclarationSemantic(sc, funcdecl) Main semantic routine for functions.
functionSemantic(fd) Resolve forward reference of function signature - parameter types, return type, and attributes.
functionSemantic3(fd) Resolve forward reference of function body. Returns false if any errors exist in the body.
getLevelAndCheck(fd, loc, sc, target, decl) Determine lexical level difference from fd to nested function target. Issue error if fd cannot call target.
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.
mergeFensure(fd, sf, oid, params) Merge into this function the 'out' contracts of all it overrides. 'out's are AND'd together, i.e. all of them need to pass.
mergeFrequire(fd, sf, params) Merge into this function the 'in' contracts of all it overrides. 'in's are OR'd together, i.e. only one of them needs to pass.
mergeFrequireInclusivePreview(fd, sf, params) Merge into this function the 'in' contracts of all it overrides.
modifyReturns(fld, sc, tret) Modify all expression type of return statements to tret.
overloadExactMatch(thisfd, t) Find function in overload list that exactly matches t.
overloadModMatch(thisfd, loc, tthis, hasOverloads) Find function in overload list that matches to the 'this' modifier. There's four result types.
overrideInterface(fd) If function is a function in a base class, return that base class.
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

Enums

NameDescription
FuncResolveFlag Flag used by resolveFuncCall.

Authors

Walter Bright

License

Boost License 1.0