dmd.expressionsem
Semantic analysis of expressions.
Specification: ($LINK2 https://dlang.org/spec/expression.html, Expressions)
License
Source: expressionsem.d
Documentation: https://dlang.org/phobos/dmd_expressionsem.html
-
Declaration
boolexpressionsToString(ref OutBufferbuf, Scope*sc, Expressions*exps);Perform semantic analysis and CTFE on expressions to produce a string.
Parameters
OutBufferbufappend generated string to buffer
Scope*sccontext
Expressions*expsarray of Expressions
Return Value
trueon error -
Declaration
StringExpsemanticString(Scope*sc, Expressionexp, const char*s);Resolve
as a compile-time known string.expParameters
Scope*scscope
ExpressionexpExpression which expected as a string
char*sWhat the string is expected for, will be used in error diagnostic.
Return Value
String literal, or
nullif error happens. -
Declaration
ExpressionresolveOpDollar(Scope*sc, ArrayExpae, Expression*pe0);Runs semantic on
ae.arguments. Declares temporary variables if '$' was used. -
Declaration
ExpressionresolveOpDollar(Scope*sc, ArrayExpae, IntervalExpie, Expression*pe0);Runs semantic on se.lwr and se.upr. Declares a temporary variable if '$' was used.
Return Value
ae, or ErrorExp if errors occurred -
Declaration
boolarrayExpressionSemantic(Expressions*exps, Scope*sc, boolpreserveErrors= false);Perform semantic() on an array of Expressions.
-
Declaration
ExpressionresolvePropertiesOnly(Scope*sc, Expressione1);If
e1is a property function (template), resolve it. -
Declaration
ExpressionsymbolToExp(Dsymbols, const ref Locloc, Scope*sc, boolhasOverloads);Turn symbol
into the expression it represents.sParameters
Dsymbolssymbol to resolve
Locloclocation of use of
sScope*sccontext
boolhasOverloadsapplies if
represents a function.struemeans it'soverloaded and will be resolved later,falsemeans it'sthe exact function symbol.Return Value
turned into an expression,sErrorExpif an error occurred -
Declaration
PackageresolveIsPackage(Dsymbolsym);Determines whether a symbol represents a module or package (Used as a helper for is(type == module) and is(type == package))
Parameters
Dsymbolsymthe symbol to be checked
Return Value
the symbol which
represents (orsymnullif it doesn't represent aPackage) -
Declaration
ExpressiontrySemantic(Expressionexp, Scope*sc);Try to run semantic routines. If they fail, return NULL.
-
Declaration
ExpressionunaSemantic(UnaExpe, Scope*sc);Helper function for easy error propagation. If error occurs, returns ErrorExp. Otherwise returns NULL.
-
Declaration
ExpressionbinSemantic(BinExpe, Scope*sc);Helper function for easy error propagation. If error occurs, returns ErrorExp. Otherwise returns NULL.
-
Declaration
ExpressionsemanticY(DotIdExpexp, Scope*sc, intflag);Resolve properties, i.e.
e1.ident, without seeing UFCS.Parameters
DotIdExpexpexpression to resolve
Scope*sccontext
intflagif 1 then do not emit error messages, just return
nullReturn Value
resolved expression,
nullif error -
Declaration
boolcheckSharedAccess(Expressione, Scope*sc, boolreturnRef= false);If expression is shared, check that we can access it. Give error message if not.
Parameters
Expressioneexpression to check
Scope*sccontext
boolreturnRefWhether this expression is for a
returnstatement off areffunction, in which case a single level of dereference is allowed (e.g.shared(int)*).Return Value
trueon error -
Declaration
boolcheckAddressVar(Scope*sc, Expressionexp, VarDeclarationv);Determine if
, which gets its address taken, can do so safely.expParameters
Scope*sccontext
Expressionexpexpression having its address taken
VarDeclarationvthe variable getting its address taken
Return Value
trueif ok,falsefor error -
Declaration
ExpressiongetThisSkipNestedFuncs(const ref Locloc, Scope*sc, Dsymbols, AggregateDeclarationad, Expressione1, Typet, Dsymbolvar, boolflag= false);Helper function for
getRightThis(). Getsthisof the next outer aggregate.Parameters
Locloclocation to use for error messages
Scope*sccontext
Dsymbolsthe parent symbol of the existing
thisAggregateDeclarationadstruct or class we need the correct
thisforExpressione1existing
thisTypettype of the existing
thisDsymbolvarthe specific member of
adwe're accessingboolflagif
true, returnnullinstead of throwing an errorReturn Value
Expression representing the
thisfor thevar -
Declaration
VarDeclarationmakeThis2Argument(const ref Locloc, Scope*sc, FuncDeclarationfd);Make a dual-context container for use as a
thisargument.Parameters
Locloclocation to use for error messages
Scope*sccurrent scope
FuncDeclarationfdtarget function that will take the
thisargumentReturn Value
Temporary closure variable.
Note: The function
is added to the nested references of the newly created variable such that a closure is made for the variable when the address offdis taken.fd -
Declaration
boolverifyHookExist(const ref Locloc, ref Scopesc, Identifierid, stringdescription, Identifiermodule_= Id.object);Make sure that the runtime hook
exists.idParameters
Locloclocation to use for error messages
Scopesccurrent scope
Identifieridthe hook identifier
stringdescriptionwhat the hook does
Identifiermodule_what module the hook is located in
Return Value
a
boolindicating if the hook is present. -
Declaration
ExpressiongetVarExp(EnumMemberem, const ref Locloc, Scope*sc);Returns
as a VariableExpemParameters
EnumMemberemthe EnumMember to wrap
Locloclocation of use of
emScope*scscope of use of
emReturn Value
VarExp referenceing
or ErrorExp ifemif disabled/deprecatedem -
Declaration
ExpressiontoBoolean(Expressionexp, Scope*sc);Try to treat
as a boolean,expParameters
Expressionexpthe expression
Scope*scscope to evalute
inexpReturn Value
Modified expression on success, ErrorExp on error