fixes #25284; .global initialization inside method hoisted to preInitProc (#25285)

fixes #25284

```nim
proc m2()  =
  let v {.global, used.}: string = f2(f2("123"))
```

transform lifted `.global`statements in the top level scope
This commit is contained in:
ringabout
2025-11-14 23:20:42 +08:00
committed by GitHub
parent f608e109c9
commit 9becd1453d
3 changed files with 13 additions and 3 deletions

View File

@@ -55,3 +55,10 @@ block: # bug #24997
doAssert not isNil(u(typeof(B.j)))
R()
discard u(B)
proc f2(str: string): string = str
proc m2() =
let v {.global, used.}: string = f2(f2("123"))
assert v == "123"
m2()