View source code
Display the source code in dmd/expressionsem.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aBugzilla 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 usinglocal 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/compiler/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.
checkDisabled(d, loc, sc, isAliasedDeclaration) Issue an error if an attempt to call a disabled method is made
checkFrameAccess(loc, sc, ad, iStart) Check to see the aggregate type is nested and its context pointer is accessible from the current scope. Returns true if error occurs.
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.
checkValue(e) Check that the expression has a valid value. If not, generates an error "... has no value".`
doCopyOrMove(sc, e, t, nrvo, move) 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.
errorSupplementalInferredAttr(fd, maxDepth, deprecation, stc, eSink) Print the reason why fd was inferred @system as a supplemental error
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, loc, fmt, expandTuples) Perform semantic analysis and CTFE on expressions to produce a string.
fill(sd, loc, elements, ctorinit) Fill out remainder of elements[] with default initializers for fields[].
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.
incompatibleTypes(e, sc) The types for a binary expression are incompatible. Print error message.
isAliasThisTuple(e) Expand alias this tuples.
lowerArrayAggregate(sfe, sc) Turn an aggregate which is an array into an expression tuple of its elements. I.e., lower static foreach (x; [1, 2, 3, 4]) { ... } to static foreach (x; AliasSeq!(1, 2, 3, 4)) { ... }
lowerNonArrayAggregate(sfe, sc) Lower any aggregate that is not an array to an array using a regular foreach loop within CTFE. If there are multiple static foreach loop variables, an array of tuples is generated. In thise case, the field needExpansion is set to true to indicate that the static foreach loop expansion will need to expand the tuples into multiple variables.
modifiableLvalue(_this, sc) Similar to toLvalue, but also enforce it is mutable or raise an error.
prepare(sfe, sc) Perform static foreach lowerings that are necessary in order to finally expand the static foreach using makeTupleForeach.
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.
semanticTypeInfo(sc, t) Request additional semantic analysis for TypeInfo generation.
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.
trySemanticAliasThis(exp, sc, aliasThisStop) Try expression semantic on exp, gagging semantic errors, but don't resolve alias this on a BinExp when the lhs or rhs has the corresponding type in aliasThisStop (See isRecursiveAliasThis).
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.

Enums

NameDescription
Modifiable Return value for checkModifiable
ModifyFlags Specifies how the checkModify deals with certain situations

Authors

Walter Bright

License

Boost License 1.0