Skip to content

Commit 3b0bef9

Browse files
committed
added followOnce()
1 parent b22008f commit 3b0bef9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

hscript/Checker.hx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,17 @@ class Checker {
934934
}
935935
}
936936

937+
public function followOnce( t : TType, withAbstracts=false ) {
938+
return switch( t ) {
939+
case TMono(r): if( r.r != null ) r.r else t;
940+
case TType(t,args): apply(t.t, t.params, args);
941+
case TLazy(f): f();
942+
case TNull(t) if( withAbstracts ): t;
943+
case TAbstract(a, args) if( withAbstracts ): apply(a.t,a.params,args);
944+
default: t;
945+
}
946+
}
947+
937948
public function getFields( t : TType ) : Array<{ name : String, t : TType }> {
938949
var fields = [];
939950
switch( follow(t) ) {

0 commit comments

Comments
 (0)