Fix issues in ComplexType -> Type conversion for functions.

This commit is contained in:
Juraj Kirchheim
2020-06-26 15:09:21 +02:00
parent 8c50dcf04b
commit b5e992b820

View File

@@ -23,8 +23,8 @@ class Sisyphus {
if (cf.params.length == 0) { if (cf.params.length == 0) {
name: cf.name, name: cf.name,
doc: cf.doc, doc: cf.doc,
access: access:
(cf.isPublic ? [ APublic ] : [ APrivate ]) (cf.isPublic ? [ APublic ] : [ APrivate ])
#if haxe4 .concat(if (cf.isFinal) [AFinal] else []) #end #if haxe4 .concat(if (cf.isFinal) [AFinal] else []) #end
, ,
kind: switch([ cf.kind, cf.type ]) { kind: switch([ cf.kind, cf.type ]) {
@@ -84,7 +84,7 @@ class Sisyphus {
cl.kind.match(KTypeParameter(_)) cl.kind.match(KTypeParameter(_))
&& cl.module == classType.module && cl.module == classType.module
&& cl.pack.join('.') == classType.pack.join('.') && cl.pack.join('.') == classType.pack.join('.')
): ct; ): ct;
default: default:
direct(); direct();
} }
@@ -95,8 +95,12 @@ class Sisyphus {
TPath(toTypePath(baseType, params)); TPath(toTypePath(baseType, params));
case TFun(args, ret): case TFun(args, ret):
TFunction( TFunction(
[ for (a in args) a.opt ? nullable(toComplexType(a.t)) : toComplexType(a.t) ], [for (a in args) {
toComplexType(ret)); var t = TNamed(a.name, toComplexType(a.t));
if (a.opt) TOptional(t) else t;
}],
toComplexType(ret)
);
case TAnonymous(_.get() => { fields: fields }): case TAnonymous(_.get() => { fields: fields }):
TAnonymous([ for (cf in fields) toField(cf) ]); TAnonymous([ for (cf in fields) toField(cf) ]);
case TDynamic(t): case TDynamic(t):
@@ -121,7 +125,7 @@ class Sisyphus {
case _ == name => true: null; case _ == name => true: null;
case v: v; case v: v;
} }
{ {
pack: baseType.pack, pack: baseType.pack,
name: name, name: name,