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
a local clone.
dmd.funcsem
Does semantic analysis for functions.
Specification Functions
Authors:
License:
Source funcsem.d
Documentation https://dlang.org/phobos/dmd_funcsem.html
- void
funcDeclarationSemantic
(Scope*sc
, FuncDeclarationfuncdecl
); - Main semantic routine for functions.
- bool
functionSemantic
(FuncDeclarationfd
); - Resolve forward reference of function signature - parameter types, return type, and attributes.Parameters:
FuncDeclaration fd
function declaration Returns:false if any errors exist in the signature. - bool
functionSemantic3
(FuncDeclarationfd
); - Resolve forward reference of function body. Returns false if any errors exist in the body.
- void
declareThis
(FuncDeclarationfd
, Scope*sc
); - Creates and returns the hidden parameters for this function declaration.Hidden parameters include the this parameter of a class, struct or nested function and the selector parameter for Objective-C methods.
- bool
checkForwardRef
(FuncDeclarationfd
, const ref Locloc
); - Check that this function type is properly resolved. If not, report "forward reference error" and return true.
- int
findVtblIndex
(FuncDeclarationfd
, Dsymbol[]vtbl
); - Find index of function in vtbl[0..length] that this function overrides. Prefer an exact match to a covariant one.Parameters:
FuncDeclaration fd
function Dsymbol[] vtbl
vtable to use Returns:-1 didn't find one -2 can't determine because of forward references - BaseClass*
overrideInterface
(FuncDeclarationfd
); - If function is a function in a base class, return that base class.Parameters:
FuncDeclaration fd
function Returns:base class if overriding, null if not - enum
FuncResolveFlag
: ubyte; - Flag used by resolveFuncCall.
standard
- issue error messages, solve the call.
quiet
- do not issue error message on no match, just return null.
overloadOnly
- only resolve overloads, i.e. do not issue error on ambiguous
ufcs
- matches and need explicit this.trying to resolve UFCS call
- FuncDeclaration
resolveFuncCall
(const ref Locloc
, Scope*sc
, Dsymbols
, Objects*tiargs
, Typetthis
, ArgumentListargumentList
, FuncResolveFlagflags
); - Given a symbol that could be either a FuncDeclaration or a function template, resolve it to a function symbol.Parameters:
Loc loc
instantiation location Scope* sc
instantiation scope Dsymbol s
instantiation symbol Objects* tiargs
initial list of template arguments Type tthis
if !NULL, the this argument type ArgumentList argumentList
arguments to function FuncResolveFlag flags
see FuncResolveFlag. Returns:if match is found, then function symbol, else null - Expression
addInvariant
(AggregateDeclarationad
, VarDeclarationvthis
); - Generate Expression to call the invariant.
Input ad aggregate with the invariant vthis variable with 'this'
Returns:void expression that calls the invariant - void
buildResultVar
(FuncDeclarationfd
, Scope*sc
, Typetret
); - Declare result variable lazily.
Copyright © 1999-2024 by the D Language Foundation | Page generated by
Ddoc on (no date time)