Skip to content

Commit

Permalink
Alias syntax updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
TurkeyMan committed Aug 20, 2014
1 parent 8b01fc6 commit 8c655e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion luad/conversions/classes.d
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void pushStaticTypeInterface(T)(lua_State* L) if(is(T == class) || is(T == struc
{
enum isFunction = is(typeof(mixin("T." ~ member)) == function);
static if(isFunction)
enum isProperty = isFunction && (functionAttributes!(mixin("T." ~ member)) & FunctionAttribute.property);
enum isProperty = (functionAttributes!(mixin("T." ~ member)) & FunctionAttribute.property);
else
enum isProperty = false;

Expand Down
14 changes: 7 additions & 7 deletions luad/conversions/functions.d
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ package:
// TODO: right now, virtual functions on specialized classes can be called with base classes as 'self', not safe!
extern(C) int methodWrapper(M, T, bool virtual)(lua_State* L)
{
alias ParameterTypeTuple!M Args;
alias Args = ParameterTypeTuple!M;

static assert ((variadicFunctionStyle!M != Variadic.d && variadicFunctionStyle!M != Variadic.c),
"Non-typesafe variadic functions are not supported.");
Expand All @@ -175,9 +175,9 @@ extern(C) int methodWrapper(M, T, bool virtual)(lua_State* L)
{
alias RT = ReturnType!M;
static if(returnsRef!M && isUserStruct!RT)
alias ref RT function(T, Args) VirtualWrapper;
alias VirtualWrapper = ref RT function(T, Args);
else
alias RT function(T, Args) VirtualWrapper;
alias VirtualWrapper = RT function(T, Args);
VirtualWrapper func = cast(VirtualWrapper)lua_touserdata(L, lua_upvalueindex(1));
}
else
Expand All @@ -195,14 +195,14 @@ extern(C) int methodWrapper(M, T, bool virtual)(lua_State* L)
{
TreatArgs!(ParameterTypeTuple!VirtualWrapper) allArgs;
allArgs[0] = self;
alias allArgs[1..$] args;
alias args = allArgs[1..$];
}
else
{
// TODO: maybe we should build a tuple of 'ReturnType!(getArgument!(T, i))' for each arg?
// then we could get rid of this TreatArgs! rubbish...
TreatArgs!Args allArgs;
alias allArgs args;
alias args = allArgs;
}

foreach(i, Arg; Args)
Expand All @@ -213,7 +213,7 @@ extern(C) int methodWrapper(M, T, bool virtual)(lua_State* L)

extern(C) int functionWrapper(T)(lua_State* L)
{
alias FillableParameterTypeTuple!T Args;
alias Args = FillableParameterTypeTuple!T;

static assert ((variadicFunctionStyle!T != Variadic.d && variadicFunctionStyle!T != Variadic.c),
"Non-typesafe variadic functions are not supported.");
Expand Down Expand Up @@ -271,7 +271,7 @@ void pushFunction(T)(lua_State* L, T func) if (isSomeFunction!T)
// TODO: optimize for non-virtual functions
void pushMethod(T, string member)(lua_State* L) if (isSomeFunction!(__traits(getMember, T, member)))
{
alias typeof(mixin("&T.init." ~ member)) M;
alias M = typeof(mixin("&T.init." ~ member));

enum isVirtual = !is(T == struct); // TODO: final methods should also be handled...

Expand Down

0 comments on commit 8c655e7

Please sign in to comment.