Specify that address is taken when converter takes a var parameter (#21391)

* Add test case

* closes #21247 Add the sfAddrTaken flag to var parameters in converters

This allows the JS backend to properly pass the parameter as a fat pointer
This commit is contained in:
Jake Leahy
2023-02-21 22:27:12 +11:00
committed by GitHub
parent de65b380ed
commit 0a45543cc1
2 changed files with 16 additions and 0 deletions

View File

@@ -1980,6 +1980,7 @@ proc userConvMatch(c: PContext, m: var TCandidate, f, a: PType,
param = implicitConv(nkHiddenSubConv, src, copyTree(arg), m, c)
elif src.kind in {tyVar}:
# Analyse the converter return type
arg.sym.flags.incl sfAddrTaken
param = newNodeIT(nkHiddenAddr, arg.info, s.typ[1])
param.add copyTree(arg)
else: