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
a local clone.
dmd.clone
Compiler implementation of the
D programming language.
Authors:
License:
Source clone.d
Documentation https://dlang.org/phobos/dmd_clone.html
- pure StorageClass
mergeFuncAttrs(StorageClasss1, const FuncDeclarationf); - Merge function attributes pure, nothrow, @safe, @nogc, and @disable from f into s1.Parameters:
StorageClass s1storage class to merge into FuncDeclaration ffunction Returns:merged storage class - FuncDeclaration
hasIdentityOpAssign(AggregateDeclarationad, Scope*sc); - Check given aggregate actually has an identity opAssign or not.Parameters:
AggregateDeclaration adstruct or class Scope* sccurrent scope Returns:if found, returns FuncDeclaration of opAssign, otherwise null - FuncDeclaration
buildOpAssign(StructDeclarationsd, Scope*sc); - Build opAssign for struct. ref S opAssign(S s) { ... }Note that s will be constructed onto the stack, and probably copy-constructed in caller site. If S has copy copy construction and/or destructor, the body will make bit-wise object swap: S _swap = this; // bit copy this = s; // bit copy _swap.dtor(); Instead of running the destructor on s, run it on tmp instead. Otherwise, the body will make member-wise assignments: Then, the body is: this.field1 = s.field1; this.field2 = s.field2; ...;Parameters:
StructDeclaration sdstruct to generate opAssign for Scope* sccontext Returns:generated opAssign function - bool
needOpEquals(StructDeclarationsd); - We need an opEquals for the struct if any fields has an opEquals. Generate one if a user-specified one does not exist.
- FuncDeclaration
buildOpEquals(StructDeclarationsd, Scope*sc); - Build opEquals for struct. const bool opEquals(const S s) { ... }By fixing https://issues.dlang.org/show_bug.cgi?id=3789 opEquals is changed to be never implicitly generated. Now, struct objects comparison s1 == s2 is translated to: s1.tupleof == s2.tupleof to calculate structural equality. See EqualExp.op_overload.
- FuncDeclaration
buildXopEquals(StructDeclarationsd, Scope*sc); - Build __xopEquals for TypeInfo_Struct static bool __xopEquals(ref const S p, ref const S q) { return p == q; }This is called by TypeInfo.equals(p1, p2). If the struct does not support const objects comparison, it will throw "not implemented" Error in runtime.
- FuncDeclaration
buildXopCmp(StructDeclarationsd, Scope*sc); - Build __xopCmp for TypeInfo_Struct static bool __xopCmp(ref const S p, ref const S q) { return p.opCmp(q); }This is called by TypeInfo.compare(p1, p2). If the struct does not support const objects comparison, it will throw "not implemented" Error in runtime.
- FuncDeclaration
buildXtoHash(StructDeclarationsd, Scope*sc); - Build _xtoHash for non-bitwise hashing static hash_t xtoHash(ref const S p) nothrow @trusted;
- DtorDeclaration
buildDtor(AggregateDeclarationad, Scope*sc); - Create inclusive destructor for struct/class by aggregating all the destructors in dtors[] with the destructors for all the members.Parameters:
AggregateDeclaration adstruct or class to build destructor for Scope* sccontext Returns:generated function, null if none neededNote Close similarity with StructDeclaration::buildPostBlit(), and the ordering changes (runs backward instead of forwards).
- DtorDeclaration
buildExternDDtor(AggregateDeclarationad, Scope*sc); - build a shim function around the compound dtor that translates a C++ destructor to a destructor with extern(D) calling conventionParameters:
AggregateDeclaration adthe aggregate that contains the destructor to wrap Scope* scthe scope in which to analyze the new function Returns:the shim destructor, semantically analyzed and added to the class as a member - FuncDeclaration
buildInv(AggregateDeclarationad, Scope*sc); - Create inclusive invariant for struct/class by aggregating all the invariants in invs[]. void __invariant() const [pure nothrow @trusted] { invs[0](), invs[1](), ...; }
Copyright © 1999-2018 by the D Language Foundation | Page generated by
Ddoc on Thu Jul 5 08:37:27 2018