Skip to content

Commit

Permalink
Closes #262
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnask committed Sep 2, 2011
1 parent 538715a commit 1d514d9
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions source/rock/backend/cnaughty/ModuleWriter.ooc
Expand Up @@ -231,21 +231,25 @@ ModuleWriter: abstract class extends Skeleton {
else hw app(", ")
hw app(retArg getName())
}


// We eliminate any generic variable that is passed as a "true" function argument
// E.g. in __va_call: inline func <T> (f: Func <T> (T), T: Class, arg: T)
// T is passed as a first param while it shouldnt as it is passed later :D
typeArgs := fDecl typeArgs filter(|arg| fDecl args each(|rarg| if(arg getName() == rarg getName()) return true); false)
/* Step 3 : write generic type args */
for(typeArg in fDecl typeArgs) {
for(typeArg in typeArgs) {
if(isFirst) isFirst = false
else hw app(", ")
else hw app(", ")
hw app(typeArg getName())
}


/* Step 4 : write real args */
for(arg in fDecl args) {
if(isFirst) isFirst = false
else hw app(", ")
else hw app(", ")
if(arg instanceOf?(VarArg)) hw app("...")
else hw app(arg getName())
else hw app(arg getName())
}

hw app(") ")
Expand All @@ -272,7 +276,7 @@ ModuleWriter: abstract class extends Skeleton {
}

/* Step 3 : write generic type args */
for(typeArg in fDecl typeArgs) {
for(typeArg in typeArgs) {
if(isFirst) isFirst = false
else hw app(", ")
hw app('('). app(typeArg getName()). app(')')
Expand Down

0 comments on commit 1d514d9

Please sign in to comment.