Skip to content

Commit

Permalink
Use TypeInfo_Class.initializer() in D2 builds to get the initializer
Browse files Browse the repository at this point in the history
TypeInfo_Class.init is deprecated and removed from the runtime (since
.init clashes with the type property of the same name). This uses
`initializer()` method which is the new way of accessing the same thing
in D2.

dlang/druntime#1403
dlang/druntime#1766
dlang/druntime#1807

https://issues.dlang.org/show_bug.cgi?id=15037
https://issues.dlang.org/show_bug.cgi?id=12233
  • Loading branch information
nemanja-boric-sociomantic committed Jan 19, 2018
1 parent 3df0077 commit ad0e808
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/swarm/neo/node/ConnectionHandler.d
Expand Up @@ -693,12 +693,21 @@ class ConnectionHandler : IConnectionHandler
assert(!(ci.flags & 8) && ci.defaultConstructor is null);
assert(ci.destructor is null);

version (D_Version2)
{
auto initializer = ci.initializer();
}
else
{
auto initializer = ci.init;
}

// Allocate space
buf.length = ci.init.length;
buf.length = initializer.length;
enableStomping(buf);

// Initialize it
buf[] = ci.init[];
buf[] = initializer[];

// Cast to T (and check that the cast succeeded)
auto t_instance = cast(T)cast(Object)buf.ptr;
Expand Down

0 comments on commit ad0e808

Please sign in to comment.