InvariantDeclaration

Constructors

this
this(Loc loc, Loc endloc, StorageClass stc, Identifier id, Statement fbody)
Undocumented in source.

Members

Functions

accept
void accept(Visitor v)
Undocumented in source. Be warned that the author may not have intended to support it.
addPostInvariant
bool addPostInvariant()
Undocumented in source. Be warned that the author may not have intended to support it.
addPreInvariant
bool addPreInvariant()
Undocumented in source. Be warned that the author may not have intended to support it.
isInvariantDeclaration
inout(InvariantDeclaration) isInvariantDeclaration()
Undocumented in source. Be warned that the author may not have intended to support it.
isVirtual
bool isVirtual()
Undocumented in source. Be warned that the author may not have intended to support it.
syntaxCopy
InvariantDeclaration syntaxCopy(Dsymbol s)
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From FuncDeclaration

frequires
Statements* frequires;

in contracts

fensures
Ensures* fensures;

out contracts

frequire
Statement frequire;

lowered in contract

fensure
Statement fensure;

lowered out contract

fbody
Statement fbody;

function body

foverrides
FuncDeclarations foverrides;

functions this function overrides

fdrequire
FuncDeclaration fdrequire;

function that does the in contract

fdensure
FuncDeclaration fdensure;

function that does the out contract

fdrequireParams
Expressions* fdrequireParams;

argument list for __require

fdensureParams
Expressions* fdensureParams;

argument list for __ensure

mangleString
const(char)* mangleString;

mangled symbol created from mangleExact()

vresult
VarDeclaration vresult;

result variable for out contracts

returnLabel
LabelDsymbol returnLabel;

where the return goes

localsymtab
DsymbolTable localsymtab;
Undocumented in source.
vthis
VarDeclaration vthis;

'this' parameter (member and nested)

isThis2
bool isThis2;

has a dual-context 'this' parameter

v_arguments
VarDeclaration v_arguments;

'_arguments' parameter

v_argptr
VarDeclaration v_argptr;

'_argptr' variable

parameters
VarDeclarations* parameters;

Array of VarDeclaration's for parameters

labtab
DsymbolTable labtab;

statement label symbol table

overnext
Dsymbol overnext;

next in overload list

overnext0
FuncDeclaration overnext0;

next in overload list (only used during IFTI)

endloc
Loc endloc;

location of closing curly bracket

vtblIndex
int vtblIndex;

for member functions, index into vtbl[]

naked
bool naked;

true if naked

generated
bool generated;

true if function was generated by the compiler rather than

hasAlwaysInlines
bool hasAlwaysInlines;

supplied by the user +//// contains references to functions that must be inline

isCrtCtorDtor
ubyte isCrtCtorDtor;

has attribute pragma(crt_constructor(1)/crt_destructor(2))

inlineStatusStmt
ILS inlineStatusStmt;

not set before the glue layer

inlineStatusExp
ILS inlineStatusExp;
Undocumented in source.
inlining
PINLINE inlining;
Undocumented in source.
inlineNest
int inlineNest;

!=0 if nested inline

eh_none
bool eh_none;

true if no exception unwinding is needed

semantic3Errors
bool semantic3Errors;

true if errors in semantic3 this function's frame ptr

fes
ForeachStatement fes;

if foreach body, this is the foreach

interfaceVirtual
BaseClass* interfaceVirtual;

if virtual, but only appears in base interface vtbl[]

introducing
bool introducing;

true if 'introducing' function

tintro
Type tintro;

if !=NULL, then this is the type of the 'introducing' function this one is overriding

inferRetType
bool inferRetType;

true if return type is to be inferred

storage_class2
StorageClass storage_class2;

storage class for template onemember's

hasReturnExp
int hasReturnExp;

1 if there's a return exp; statement 2 if there's a throw statement 4 if there's an assert(0) 8 if there's inline asm 16 if there are multiple return statements

nrvo_can
bool nrvo_can;

true means we can do NRVO

nrvo_var
VarDeclaration nrvo_var;

variable to replace with shidden

shidden
Symbol* shidden;

hidden pointer passed to function

returns
ReturnStatements* returns;
Undocumented in source.
gotos
GotoStatements* gotos;

Gotos with forward references

builtin
BUILTIN builtin;

set if this is a known, builtin function we can evaluate at compile time

tookAddressOf
int tookAddressOf;

set if someone took the address of this function

requiresClosure
bool requiresClosure;
Undocumented in source.
closureVars
VarDeclarations closureVars;

local variables in this function which are referenced by nested functions (They'll get put into the "closure" for this function.)

outerVars
VarDeclarations outerVars;

Outer variables which are referenced by this nested function (the inverse of closureVars)

siblingCallers
FuncDeclarations siblingCallers;

Sibling nested functions which called this one

inlinedNestedCallees
FuncDeclarations* inlinedNestedCallees;
Undocumented in source.
flags
uint flags;

FUNCFLAG.xxxxx

objc
ObjcFuncDeclaration objc;

Data for a function declaration that is needed for the Objective-C integration.

canInferAttributesOverride
bool delegate(FuncDeclaration func, Scope* scope_, bool delegate(Scope*) defaultCanInferAttributes) canInferAttributesOverride;
Undocumented in source.
create
FuncDeclaration create(Loc loc, Loc endloc, Identifier id, StorageClass storage_class, Type type)
Undocumented in source. Be warned that the author may not have intended to support it.
syntaxCopy
FuncDeclaration syntaxCopy(Dsymbol s)
Undocumented in source. Be warned that the author may not have intended to support it.
functionSemantic
bool functionSemantic()

Resolve forward reference of function signature - parameter types, return type, and attributes.

functionSemantic3
bool functionSemantic3()

Resolve forward reference of function body. Returns false if any errors exist in the body.

checkForwardRef
bool checkForwardRef(Loc loc)

Check that this function type is properly resolved. If not, report "forward reference error" and return true.

declareThis
void declareThis(Scope* sc)

Creates and returns the hidden parameters for this function declaration.

equals
bool equals(RootObject o)
Undocumented in source. Be warned that the author may not have intended to support it.
overrides
int overrides(FuncDeclaration fd)

Determine if 'this' overrides fd. Return !=0 if it does.

findVtblIndex
int findVtblIndex(Dsymbols* vtbl, int dim)

Find index of function in vtbl[0..dim] that this function overrides. Prefer an exact match to a covariant one.

overrideInterface
BaseClass* overrideInterface()

If function a function in a base class, return that base class.

overloadInsert
bool overloadInsert(Dsymbol s)

Overload this FuncDeclaration with the new one f. Return true if successful; i.e. no conflict.

overloadExactMatch
FuncDeclaration overloadExactMatch(Type t)

Find function in overload list that exactly matches t.

overloadModMatch
FuncDeclaration overloadModMatch(Loc loc, Type tthis, bool hasOverloads)

Find function in overload list that matches to the 'this' modifier. There's four result types.

findTemplateDeclRoot
TemplateDeclaration findTemplateDeclRoot()

find function template root in overload list

inUnittest
bool inUnittest()

Returns true if function was declared directly or indirectly in a unittest block

leastAsSpecialized
MATCH leastAsSpecialized(FuncDeclaration g)

Determine partial specialization order of 'this' vs g. This is very similar to TemplateDeclaration::leastAsSpecialized().

searchLabel
LabelDsymbol searchLabel(Identifier ident)

Labels are in a separate scope, one per function.

getLevel
int getLevel(FuncDeclaration fd, int intypeof)

Determine lexical level difference from this to nested function fd.

getLevelAndCheck
int getLevelAndCheck(Loc loc, Scope* sc, FuncDeclaration fd, Declaration decl)

Determine lexical level difference from this to nested function fd. Issue error if this cannot call fd.

LevelError
enum LevelError;
Undocumented in source.
toPrettyChars
const(char)* toPrettyChars(bool QualifyTypes)
Undocumented in source. Be warned that the author may not have intended to support it.
toFullSignature
const(char)* toFullSignature()

for diagnostics, e.g. 'int foo(int x, int y) pure'

isMain
bool isMain()
Undocumented in source. Be warned that the author may not have intended to support it.
isCMain
bool isCMain()
Undocumented in source. Be warned that the author may not have intended to support it.
isWinMain
bool isWinMain()
Undocumented in source. Be warned that the author may not have intended to support it.
isDllMain
bool isDllMain()
Undocumented in source. Be warned that the author may not have intended to support it.
isRtInit
bool isRtInit()
Undocumented in source. Be warned that the author may not have intended to support it.
isExport
bool isExport()
Undocumented in source. Be warned that the author may not have intended to support it.
isImportedSymbol
bool isImportedSymbol()
Undocumented in source. Be warned that the author may not have intended to support it.
isCodeseg
bool isCodeseg()
Undocumented in source. Be warned that the author may not have intended to support it.
isOverloadable
bool isOverloadable()
Undocumented in source. Be warned that the author may not have intended to support it.
isAbstract
bool isAbstract()

Override so it can work even if semantic() hasn't yet been run.

canInferAttributes
bool canInferAttributes(Scope* sc)

Decide if attributes for this function can be inferred from examining the function body.

canInferAttributesImpl
bool canInferAttributesImpl(Scope* sc)
Undocumented in source. Be warned that the author may not have intended to support it.
initInferAttributes
void initInferAttributes()

Initialize for inferring the attributes of this function.

isPure
PURE isPure()
Undocumented in source. Be warned that the author may not have intended to support it.
isPureBypassingInference
PURE isPureBypassingInference()
Undocumented in source. Be warned that the author may not have intended to support it.
setImpure
bool setImpure()

The function is doing something impure, so mark it as impure. If there's a purity error, return true.

isSafe
bool isSafe()
Undocumented in source. Be warned that the author may not have intended to support it.
isSafeBypassingInference
bool isSafeBypassingInference()
Undocumented in source. Be warned that the author may not have intended to support it.
isTrusted
bool isTrusted()
Undocumented in source. Be warned that the author may not have intended to support it.
setUnsafe
bool setUnsafe()

The function is doing something unsafe, so mark it as unsafe. If there's a safe error, return true.

isNogc
bool isNogc()
Undocumented in source. Be warned that the author may not have intended to support it.
isNogcBypassingInference
bool isNogcBypassingInference()
Undocumented in source. Be warned that the author may not have intended to support it.
setGC
bool setGC()

The function is doing something that may allocate with the GC, so mark it as not nogc (not no-how).

printGCUsage
void printGCUsage(Loc loc, const(char)* warn)
Undocumented in source. Be warned that the author may not have intended to support it.
isReturnIsolated
bool isReturnIsolated()

See if pointers from function parameters, mutable globals, or uplevel functions could leak into return value.

isTypeIsolated
bool isTypeIsolated(Type t)
bool isTypeIsolated(Type t, StringTable!Type parentTypes)

See if pointers from function parameters, mutable globals, or uplevel functions could leak into type t.

isNested
bool isNested()

Determine if function needs a static frame pointer.

isThis
inout(AggregateDeclaration) isThis()

Determine if function is a non-static member function that has an implicit 'this' expression.

needThis
bool needThis()
Undocumented in source. Be warned that the author may not have intended to support it.
isVirtualMethod
bool isVirtualMethod()
Undocumented in source. Be warned that the author may not have intended to support it.
isVirtual
bool isVirtual()
Undocumented in source. Be warned that the author may not have intended to support it.
isFinalFunc
bool isFinalFunc()
Undocumented in source. Be warned that the author may not have intended to support it.
addPreInvariant
bool addPreInvariant()
Undocumented in source. Be warned that the author may not have intended to support it.
addPostInvariant
bool addPostInvariant()
Undocumented in source. Be warned that the author may not have intended to support it.
kind
const(char)* kind()
Undocumented in source. Be warned that the author may not have intended to support it.
isUnique
bool isUnique()
checkNestedReference
bool checkNestedReference(Scope* sc, Loc 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.

needsClosure
bool needsClosure()

Look at all the variables in this function that are referenced by nested functions, and determine if a closure needs to be created for them.

checkClosure
bool checkClosure()

Check that the function contains any closure. If it's @nogc, report suitable errors. This is mostly consistent with FuncDeclaration::needsClosure().

hasNestedFrameRefs
bool hasNestedFrameRefs()

Determine if function's variables are referenced by a function nested within it.

buildResultVar
void buildResultVar(Scope* sc, Type tret)

Declare result variable lazily.

mergeFrequire
Statement mergeFrequire(Statement sf, Expressions* 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
Statement mergeFrequireInclusivePreview(Statement sf, Expressions* params)

Merge into this function the 'in' contracts of all it overrides.

needsFensure
bool needsFensure(FuncDeclaration fd)

Determine whether an 'out' contract is declared inside the given function or any of its overrides.

buildEnsureRequire
void buildEnsureRequire()

Rewrite contracts as statements.

mergeFensure
Statement mergeFensure(Statement sf, Identifier oid, Expressions* 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.

getParameterList
ParameterList getParameterList()
genCfunc
FuncDeclaration genCfunc(Parameters* fparams, Type treturn, const(char)* name, StorageClass stc)

Generate a FuncDeclaration for a runtime library function.

genCfunc
FuncDeclaration genCfunc(Parameters* fparams, Type treturn, Identifier id, StorageClass stc)
Undocumented in source. Be warned that the author may not have intended to support it.
checkDmain
void checkDmain()

Check parameters and return type of D main() function. Issue error messages.

checkNRVO
bool checkNRVO()

Check all return statements for a function to verify that returning using NRVO is possible.

isFuncDeclaration
inout(FuncDeclaration) isFuncDeclaration()
Undocumented in source. Be warned that the author may not have intended to support it.
toAliasFunc
inout(FuncDeclaration) toAliasFunc()
Undocumented in source. Be warned that the author may not have intended to support it.
accept
void accept(Visitor v)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta