Skip to content

Commit

Permalink
compilerEs: fix closure reflection to handle nullable types
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Giannini authored and Matthew Giannini committed Mar 20, 2024
1 parent 369018a commit 6c2e09f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/compilerEs/fan/ast/JsClosure.fan
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class JsClosure : JsNode
varToFunc.each |MethodDef func, Str var|
{
loc := func.loc
js.w("const ${var} = [${qnameToJs(func.ret)}.type\$,")
nullable := func.ret.isNullable ? ".toNullable()" : ""
js.w("const ${var} = [${qnameToJs(func.ret)}.type\$${nullable},")
js.w("sys.List.make(sys.Param.type\$, [")
func.params.each |p,i|
{
Expand All @@ -78,11 +79,7 @@ class JsClosure : JsNode

private Str mapFuncSpec(ClosureExpr ce)
{
var := specKeyToVar.getOrAdd(specKey(ce)) |->Str|
{
// "${ce.enclosingType.pod}.__clos${plugin.nextUid}"
"__clos${plugin.nextUid}"
}
var := specKeyToVar.getOrAdd(specKey(ce)) |->Str| { "__clos${plugin.nextUid}" }
varToFunc[var] = ce.doCall
return var
}
Expand Down

0 comments on commit 6c2e09f

Please sign in to comment.