Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
implement init function for TypeInfo_Pointer, TypeInfo_AssociativeArr…
Browse files Browse the repository at this point in the history
…ay, TypeInfo_Function, TypeInfo_Delegate and TypeInfo_Interface
  • Loading branch information
rainers committed Jul 18, 2015
1 parent 8e99214 commit ceffd63
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/object.d
Expand Up @@ -398,6 +398,11 @@ class TypeInfo_Pointer : TypeInfo
return (void*).sizeof;
}

override const(void)[] init() const @trusted
{
return (cast(void *)null)[0 .. (void*).sizeof];
}

override void swap(void* p1, void* p2) const
{
void* tmp = *cast(void**)p1;
Expand Down Expand Up @@ -656,6 +661,11 @@ class TypeInfo_AssociativeArray : TypeInfo
return (char[int]).sizeof;
}

override const(void)[] init() const @trusted
{
return (cast(void *)null)[0 .. (char[int]).sizeof];
}

override @property inout(TypeInfo) next() nothrow pure inout { return value; }
override @property uint flags() nothrow pure const { return 1; }

Expand Down Expand Up @@ -728,6 +738,11 @@ class TypeInfo_Function : TypeInfo
return 0; // no size for functions
}

override const(void)[] init() const @safe
{
return null;
}

TypeInfo next;
string deco;
}
Expand Down Expand Up @@ -755,6 +770,11 @@ class TypeInfo_Delegate : TypeInfo
return dg.sizeof;
}

override const(void)[] init() const @trusted
{
return (cast(void *)null)[0 .. (int delegate()).sizeof];
}

override @property uint flags() nothrow pure const { return 1; }

TypeInfo next;
Expand Down Expand Up @@ -987,6 +1007,11 @@ class TypeInfo_Interface : TypeInfo
return Object.sizeof;
}

override const(void)[] init() const @trusted
{
return (cast(void *)null)[0 .. Object.sizeof];
}

override @property uint flags() nothrow pure const { return 1; }

TypeInfo_Class info;
Expand Down Expand Up @@ -1197,6 +1222,11 @@ class TypeInfo_Tuple : TypeInfo
assert(0);
}

override const(void)[] init() const @trusted
{
assert(0);
}

override void swap(void* p1, void* p2) const
{
assert(0);
Expand Down

0 comments on commit ceffd63

Please sign in to comment.