Puzzling compiler crash

2024-05-09 Thread lou15b
An additional piece of information. I passed the equivalent source code to the `dumpCompiledCode` macro instead of the output from `refObjectDestructor`: dumpCompiledCode: proc `=destroy`(x: typeof(Marker()[])) = `=destroy`(x.tref) Run The result was

Puzzling compiler crash

2024-05-09 Thread lou15b
AST generated by the `refObjectDestructor` macro (obtained by inserting `echo treerepr(result)` at the end of the macro): ProcDef AccQuoted Ident "=" Ident "destroy" Empty Empty FormalParams Empty IdentDefs Ident "x"

Puzzling compiler crash

2024-05-08 Thread enthus1ast
I would compare the ast you generate with the ast of a dumpAstGen

Puzzling compiler crash

2024-05-08 Thread lou15b
I think that may help at execution time, but not at compile time. Other code that I've written that doesn't use the macros and without the nil check worked fine.

Puzzling compiler crash

2024-05-08 Thread planetis
Wild guess here, but you need to check for nil!

Puzzling compiler crash

2024-05-08 Thread lou15b
I have been writing some helper macros to assist in the coding of destructors, and I ran into the following problem. import macros macro dumpCompiledCode(compiledCode: typed): untyped = ## Simple macro to dump the final generated source code form of the argument,