Skip to content

fixes 25610; ignores skTemplate and skMacro symbols in cgen#25616

Open
demotomohiro wants to merge 1 commit intonim-lang:develfrom
demotomohiro:fixes-25610
Open

fixes 25610; ignores skTemplate and skMacro symbols in cgen#25616
demotomohiro wants to merge 1 commit intonim-lang:develfrom
demotomohiro:fixes-25610

Conversation

@demotomohiro
Copy link
Copy Markdown
Contributor

also adds simple macro tests to tests/ic.

of skTemplate, skMacro:
# it is possible to get these kind of symbols if cgen was called from nifbackend.nim
# as symbols are lazily loaded including symbol kinds, cannot exclude them when loading Nif files
discard
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix makes no sense to me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do these symbol kinds enter the backend for IC? And how is simply ignoring them a valid strategy?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When encoding procs, templates or macros defined under top level block statements to Nif, they are written as sdef.
When loading the Nif file, they are loaded as symbol nodes without nkProcDef/nkTemplateDef/nkMacroDef nodes.
expr proc in ccgexprs.nim simply ignores nkTemplateDef/nkMacroDef nodes and nkProcDef with sfCompileTime flag.

I'm trying to fix this bug by encoding procs, templates and macros defined under top level block statements in the same way as ast inside sdef (write full structure).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants