mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-19 07:21:19 +00:00
fixes yet another LL regression (Aporia compiles again)
This commit is contained in:
@@ -362,6 +362,7 @@ proc detectCapturedVars(n: PNode; owner: PSym; c: var DetectionPass) =
|
||||
# this handles the case that the inner proc was declared as
|
||||
# .closure but does not actually capture anything:
|
||||
addClosureParam(c, s)
|
||||
c.somethingToDo = true
|
||||
|
||||
let innerProc = isInnerProc(s)
|
||||
if innerProc:
|
||||
@@ -654,7 +655,6 @@ proc wrapIterBody(n: PNode; owner: PSym): PNode =
|
||||
proc symToClosure(n: PNode; owner: PSym; d: DetectionPass;
|
||||
c: var LiftingPass): PNode =
|
||||
let s = n.sym
|
||||
|
||||
if s == owner:
|
||||
# recursive calls go through (lambda, hiddenParam):
|
||||
let available = getHiddenParam(owner)
|
||||
|
||||
22
tests/closure/texplicit_dummy_closure.nim
Normal file
22
tests/closure/texplicit_dummy_closure.nim
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
# This is a regression of the new lambda lifting; detected by Aporia
|
||||
import asyncio, sockets
|
||||
import os
|
||||
|
||||
type
|
||||
Window = object
|
||||
oneInstSock*: PAsyncSocket
|
||||
IODispatcher*: PDispatcher
|
||||
|
||||
var
|
||||
win: Window
|
||||
|
||||
proc initSocket() =
|
||||
win.oneInstSock = asyncSocket()
|
||||
#win.oneInstSock.handleAccept =
|
||||
proc test(s: PAsyncSocket) =
|
||||
var client: PAsyncSocket
|
||||
proc dummy(c: PAsyncSocket) {.closure.} =
|
||||
discard
|
||||
client.handleRead = dummy
|
||||
test(win.oneInstSock)
|
||||
Reference in New Issue
Block a user