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

Semantic analysis of expressions.

Specification

($LINK2 https://dlang.org/spec/expression.html, Expressions)

Documentation

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

Coverage

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

Functions

NameDescription
addDtorHook(e, sc) Destructors are attached to VarDeclarations. Hence, if expression returns a temp that needs a destructor, make sure and create a VarDeclaration for that temp.
arrayExpressionSemantic(exps, sc, preserveErrors) Perform semantic() on an array of Expressions.
binSemantic(e, sc) Helper function for easy error propagation. If error occurs, returns ErrorExp. Otherwise returns NULL.
checkAddressable(e, sc) This check ensures that the object in exp can have its address taken, or issue a diagnostic error.
checkAddressVar(sc, exp, v) Determine if exp, which gets its address taken, can do so safely.
checkModifiable(exp, sc, flag)
checkOverriddenDtor(f, sc, loc, check, checkName) Checks whether f is a generated DtorDeclaration that hides a user-defined one which passes check while f doesn't (e.g. when the user defined dtor is pure but the generated dtor is not). In that case the method will identify and print all members causing the attribute missmatch.
checkSharedAccess(e, sc, returnRef) If expression is shared, check that we can access it. Give error message if not.
doCopyOrMove(sc, e, t) Handle the postblit call on lvalue, or the move of rvalue.
dotIdSemanticProp(exp, sc, gag) Resolve properties, i.e. e1.ident, without seeing UFCS.
dotTemplateSemanticProp(exp, sc, gag) Resolve e1.ident!tiargs without seeing UFCS.
evalStaticCondition(sc, original, e, errors, negatives) Semantically analyze and then evaluate a static condition at compile time. This is special because short circuit operators &&, || and ?: at the top level are not semantically analyzed if the result of the expression is not necessary.
expressionsToString(buf, sc, exps) Perform semantic analysis and CTFE on expressions to produce a string.
getThisSkipNestedFuncs(loc, sc, s, ad, e1, t, var, flag) Helper function for getRightThis(). Gets this of the next outer aggregate.
getVarExp(em, loc, sc) Returns em as a VariableExp
hasThis(sc) Determine if this is available by walking up the enclosing scopes until a function is found.
isAliasThisTuple(e) Expand alias this tuples.
makeThis2Argument(loc, sc, fd) Make a dual-context container for use as a this argument.
modifiableLvalue(_this, sc) Similar to toLvalue, but also enforce it is mutable or raise an error.
resolveIsPackage(sym) Determines whether a symbol represents a module or package (Used as a helper for is(type == module) and is(type == package))
resolveLoc(exp, loc, sc) Resolve _FILE__, _LINE__, _MODULE__, _FUNCTION__, _PRETTY_FUNCTION__, _FILE_FULL_PATH__ to loc.
resolveOpDollar(sc, ae, pe0) Runs semantic on ae.arguments. Declares temporary variables if '$' was used.
resolveOpDollar(sc, ae, ie, pe0) Runs semantic on se.lwr and se.upr. Declares a temporary variable if '$' was used.
resolvePropertiesOnly(sc, e1) If e1 is a property function (template), resolve it.
semanticString(sc, exp, s) Resolve exp as a compile-time known string.
symbolToExp(s, loc, sc, hasOverloads) Turn symbol s into the expression it represents.
toBoolean(exp, sc) Try to treat exp as a boolean,
toLvalue(_this, sc, action) Try to convert an expression to be an lvalue.
toUTF8(se, sc) Convert string to char[].
trySemantic(exp, sc) Try to run semantic routines. If they fail, return NULL.
unaSemantic(e, sc) Helper function for easy error propagation. If error occurs, returns ErrorExp. Otherwise returns NULL.
valueNoDtor(e) If we want the value of this expression, but do not want to call the destructor on it.
verifyHookExist(loc, sc, id, description, module_) Make sure that the runtime hook id exists.

Authors

Walter Bright

License

Boost License 1.0