Skip to content

Commit f718d5f

Browse files
committed
fixed setGlobals with class type parameters
1 parent 3300ce0 commit f718d5f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

hscript/Checker.hx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,22 @@ class Checker {
348348
this.types = types;
349349
}
350350

351-
public function setGlobals( cl : CClass, allowPrivate = false ) {
351+
public function setGlobals( cl : CClass, ?params : Array<TType>, allowPrivate = false ) {
352+
if( params == null )
353+
params = [for( p in cl.params ) makeMono()];
352354
while( true ) {
353355
for( f in cl.fields )
354356
if( f.isPublic || allowPrivate )
355-
setGlobal(f.name, f.params.length == 0 ? f.t : TLazy(function() return apply(f.t,f.params,[for( i in 0...f.params.length) makeMono()])));
357+
setGlobal(f.name, f.params.length == 0 ? f.t : TLazy(function() {
358+
var t = apply(f.t,f.params,[for( i in 0...f.params.length) makeMono()]);
359+
return apply(t, cl.params, params);
360+
}));
356361
if( cl.superClass == null )
357362
break;
358363
cl = switch( cl.superClass ) {
359-
case TInst(c,_): c;
364+
case TInst(csup,pl):
365+
params = [for( p in pl ) apply(p,cl.params,params)];
366+
csup;
360367
default: throw "assert";
361368
}
362369
}

0 commit comments

Comments
 (0)