mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-09 21:28:13 +00:00
fixes #2401
This commit is contained in:
@@ -1962,7 +1962,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) =
|
||||
var sym = n.sym
|
||||
case sym.kind
|
||||
of skMethod:
|
||||
if sym.getBody.kind == nkEmpty or sfDispatcher in sym.flags:
|
||||
if {sfDispatcher, sfForward} * sym.flags != {}:
|
||||
# we cannot produce code for the dispatcher yet:
|
||||
fillProcLoc(sym)
|
||||
genProcPrototype(p.module, sym)
|
||||
|
||||
11
tests/method/temptybody.nim
Normal file
11
tests/method/temptybody.nim
Normal file
@@ -0,0 +1,11 @@
|
||||
# bug #2401
|
||||
|
||||
type MyClass = ref object of RootObj
|
||||
|
||||
method HelloWorld*(obj: MyClass) =
|
||||
when defined(myPragma):
|
||||
echo("Hello World")
|
||||
# discard # with this line enabled it works
|
||||
|
||||
var obj = MyClass()
|
||||
obj.HelloWorld()
|
||||
Reference in New Issue
Block a user