Fix typeSym.getImpl for ref types (#13752)
* Fix typeSym.getImpl for ref types * Fix a codegen issue affecting the test suite of nim-beacon-chain * Fix tests/stdlib/tjsonmacro To understand the fix better it may help to take a look at the history of the replaced code. The nil check that is removed in this commit was introduced in another fix that failed to identify the root cause of the issue - namely that we allow an object type to exist for which no ast is present: https://github.com/nim-lang/Nim/pull/9601/files The original intention of the code is more obvious here: https://github.com/nim-lang/Nim/pull/9538/files
This commit is contained in:
parent
1b31e08917
commit
e50441ab33
4 changed files with 88 additions and 8 deletions
|
|
@ -159,10 +159,10 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo;
|
|||
of tyObject:
|
||||
if inst:
|
||||
result = newNodeX(nkObjectTy)
|
||||
if t.sym.ast != nil:
|
||||
result.add t.sym.ast[2][0].copyTree # copy object pragmas
|
||||
else:
|
||||
result.add newNodeI(nkEmpty, info)
|
||||
var objectDef = t.sym.ast[2]
|
||||
if objectDef.kind == nkRefTy:
|
||||
objectDef = objectDef[0]
|
||||
result.add objectDef[0].copyTree # copy object pragmas
|
||||
if t[0] == nil:
|
||||
result.add newNodeI(nkEmpty, info)
|
||||
else: # handle parent object
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue