Compiler implementation of the D programming language.
Find the first non-comma expression.
Expression e
| Expressions connected by commas |
Find the last non-comma expression.
Expression e
| Expressions connected by commas |
Determine if this
is available by walking up the enclosing scopes until a function is found.
Scope* sc
| where to start looking for the enclosing function |
isThis()
, otherwise null
Determine if a this
is needed to access d
.
Scope* sc
| context |
Declaration d
| declaration to check |
this
is neededcheck e is exp.opDispatch!(tiargs) or not It's used to switch to UFCS the semantic analysis path
Expand tuples.
Expand alias this tuples.
If s
is a function template, i.e. the only member of a template and that member is a function, return that template.
Dsymbol s
| symbol that might be a function template |
If we want the value of this expression, but do not want to call the destructor on it.
Handle the postblit call on lvalue, or the move of rvalue.
Scope* sc
| the scope where the expression is encountered |
Expression e
| the expression the needs to be moved or copied (source) |
Type t
| if the struct defines a copy constructor, the type of the destination |
Test to see if two reals are the same. Regard NaN's as equivalent. Regard +0 and -0 as different.
real_t x1
| first operand |
real_t x2
| second operand |
TypeDotIdExp
Given an Expression, find the variable it really is.
For example, a[index]
is really a
, and s.f
is really s
.
Expression e
| Expression to look at |
http://dlang.org/spec/expression.html#expression
Deinitializes the global state of the compiler.
This can be used to restore the state set by _init
to its original state.
Does *not* do a deep copy.
Combine e1 and e2 by CommaExp if both are not NULL.
If 'e' is a tree of commas, returns the rightmost expression by stripping off it from the tree. The remained part of the tree is returned via e0. Otherwise 'e' is directly returned and e0 is set to NULL.
Return !=0 if expression is an lvalue.
Give error if we're not an lvalue. If we can, convert expression to be an lvalue.
Resolve __FILE__, __LINE__, __MODULE__, __FUNCTION__, __PRETTY_FUNCTION__, _FILE_FULL_PATH__ to loc.
Check that the expression has a valid type. If not, generates an error "... has no type".
checkValue()
should also return true.Check that the expression has a valid value. If not, generates an error "... has no value".
Calling function f. Check the purity, i.e. if we're in a pure function we can only call other pure functions. Returns true if error occurs.
Accessing variable v. Check for purity and safety violations. Returns true if error occurs.
Calling function f. Check the safety, i.e. if we're in a @safe function we can only call @safe or @trusted functions. Returns true if error occurs.
Calling function f. Check the @nogc-ness, i.e. if we're in a @nogc function we can only call other @nogc functions. Returns true if error occurs.
Check that the postblit is callable if t is an array of structs. Returns true if error happens.
Check whether the expression allows RMW operations, error with rmw operator diagnostic if not. ex is the RHS expression, or NULL if ++/-- is used (for diagnostics) Returns true if error occurs.
If expression can be tested for true or false, returns the modified expression. Otherwise returns ErrorExp.
Destructors are attached to VarDeclarations. Hence, if expression returns a temp that needs a destructor, make sure and create a VarDeclaration for that temp.
Take address of expression.
If this is a reference, dereference it.
Does this expression statically evaluate to a boolean 'result' (true or false)?
Use this instead of creating new instances for commonly used literals such as 0 or 1.
Tint32
.Use this expression for error recovery. It should behave as a 'sink' to prevent further cascaded error messages.
An uninitialized value, generated from void initializers.
the variable from where the void value came from, null if not known
Useful for error messages
Won't be generated by parser.
http://dlang.org/spec/expression.html#string_literals
Return the number of code units the string would be if it were re-encoded as tynto.
int tynto
| code unit type of the target encoding |
Write the contents of the string to dest. Use numberOfCodeUnits() to determine size of result.
void* dest
| destination |
int tyto
| encoding type of the result |
bool zero
| add terminating 0 |
Get the code unit at index i
size_t i
| index |
Set the code unit at index i to c
size_t i
| index |
dchar c
| code unit to set it to |
If the string data is UTF-8 and can be accessed directly, return a pointer to it. Do not assume a terminating 0.
Convert string to char[].
Convert string contents to a 0 terminated string, allocated by mem.xmalloc().
[ e1, e2, e3, ... ]
http://dlang.org/spec/expression.html#array_literals
If !is null, elements[] can be sparse and basis is used for the "default" element value. In other words, non-null elements[i] overrides this 'basis' value.
[ key0 : value0, key1 : value1, ... ]
http://dlang.org/spec/expression.html#associative_array_literals
scrubReturnValue is running
hasNonConstPointers is running
optimize is running
apply is running
inlineScan is running
toCBuffer is running
sd( e1, e2, e3, ... )
which aggregate this is for
parallels sd.fields[] with null entries for fields to skip
final type of result (can be different from sd's type)
back end symbol to initialize with literal
pointer to the origin instance of the expression. once a new expression is created, origin is set to 'this'. anytime when an expression copy is created, 'origin' pointer is set to 'origin' pointer value of the original expression.
those fields need to prevent a infinite recursion when one field of struct initialized with 'this' pointer.
anytime when recursive function is calling, 'stageflags' marks with bit flag of current stage and unmarks before return from this function. 'inlinecopy' uses similar 'stageflags' and from multiple evaluation 'doInline' (with infinite recursion) of this expression.
if this is true, use the StructDeclaration's init symbol
Gets expression at offset of type. Returns NULL if not found.
Get index of field. Returns -1 if not found.
Mainly just a placeholder
Mainly just a placeholder of Package, Module, Nspace, and TemplateInstance (including TemplateMixin)
A template instance that requires IFTI: foo!tiargs(fargs) // foo!tiargs is left until CallExp::semantic() or resolveProperties()
Mainly just a placeholder
thisexp.new(newargs) newtype(arguments)
thisexp.new(newargs) class baseclasses { } (arguments)
Offset from symbol
Variable
Overload Set
Function/Delegate literal
Declaration of a symbol
D grammar allows declarations only as statements. However in AST representation it can be part of any expression. This is used, for example, during internal syntax re-writes to inject hidden symbols.
typeid(int)
_traits(identifier, args...)
is(targ id tok tspec) is(targ id == tok2)
The type for a unary expression is incompatible. Print error message.
Mark the operand as will never be dereferenced, which is useful info for @safe checks. Do before semantic() on operands rewrites them.
The types for a binary expression are incompatible. Print error message.
Mark the operands as will never be dereferenced, which is useful info for @safe checks. Do before semantic() on operands rewrites them.
Mainly just a placeholder
foo.bar!(args)
Instatiates a new function call expression
Loc loc
| location |
FuncDeclaration fd
| the declaration of the function to call |
Expression earg1
| the function argument |
Creates a new function call expression
Loc loc
| location |
FuncDeclaration fd
| the declaration of the function to call |
Expression earg1
| the function argument |
Possible to cast to one type while painting to another type
e1.array property for vectors.
e1 [lwr .. upr]
http://dlang.org/spec/expression.html#slice_expressions
e1 [ a0, a1, a2, a3 ,... ]
This is needed because AssignExp rewrites CommaExp, hence it needs to trigger the deprecation.
Temporary variable to enable / disable deprecation of comma expression depending on the context. Since most constructor calls are rewritting, the only place where false will be passed will be from the parser.
If the argument is a CommaExp, set a flag to prevent deprecation messages
It's impossible to know from CommaExp.semantic if the result will be used, hence when there is a result (type != void), a deprecation message is always emitted. However, some construct can produce a result but won't use it (ExpStatement and for loop increment). Those should call this function to prevent unwanted deprecations to be emitted.
Expression exp
| An expression that discards its result. If the argument is null or not a CommaExp, nothing happens. |
Mainly just a placeholder
e1 [ e2 ]
For both i++ and i--
For both ++i and --i
The ~= operator. It can have one of the following operators:
TOK.concatenateAssign - appending T[] to T[] TOK.concatenateElemAssign - appending T to T[] TOK.concatenateDcharAssign - appending dchar to T[]
The parser initially sets it to TOK.concatenateAssign, and semantic() later decides which of the three it will be set to.
http://dlang.org/spec/expression.html#andand_expressions http://dlang.org/spec/expression.html#oror_expressions
op
is one of: TOK.lessThan, TOK.lessOrEqual, TOK.greaterThan, TOK.greaterOrEqual
This deletes the key e1 from the associative array e2
==
and !=
TOK.equal and TOK.notEqual
http://dlang.org/spec/expression.html#equality_expressions
is
and !is
TOK.identity and TOK.notIdentity
http://dlang.org/spec/expression.html#identity_expressions
econd ? e1 : e2
http://dlang.org/spec/expression.html#conditional_expressions
Objective-C class reference expression.
Used to get the metaclass of an Objective-C class, NSObject.Class
.
© 1999–2019 The D Language Foundation
Licensed under the Boost License 1.0.
https://dlang.org/phobos/dmd_expression.html