Reset location when creating a method dispatcher
When creating a method dispatcher, the location of the underlying method was copied. Under some circumstances, the name of the location (loc.r) was already initialized, in which case the method dispatcher shared a name with one of the methods, leading to a C compiler error. By setting loc.r to nil when copying the dispatcher information from the original method, we ensure that the dispatcher C function gets its proper name.
This commit is contained in:
parent
52a3acb066
commit
1fc8bab643
1 changed files with 1 additions and 0 deletions
|
|
@ -100,6 +100,7 @@ proc methodDef*(s: PSym, fromCache: bool) =
|
||||||
if disp.typ.callConv == ccInline: disp.typ.callConv = ccDefault
|
if disp.typ.callConv == ccInline: disp.typ.callConv = ccDefault
|
||||||
disp.ast = copyTree(s.ast)
|
disp.ast = copyTree(s.ast)
|
||||||
disp.ast.sons[bodyPos] = ast.emptyNode
|
disp.ast.sons[bodyPos] = ast.emptyNode
|
||||||
|
disp.loc.r = nil
|
||||||
if s.typ.sons[0] != nil:
|
if s.typ.sons[0] != nil:
|
||||||
disp.ast.sons[resultPos].sym = copySym(s.ast.sons[resultPos].sym)
|
disp.ast.sons[resultPos].sym = copySym(s.ast.sons[resultPos].sym)
|
||||||
attachDispatcher(s, newSymNode(disp))
|
attachDispatcher(s, newSymNode(disp))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue