flyx / emerald

HTML5 templating engine for Nimrod

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prepend and append regression in Nim 0.20

konradmb opened this issue · comments

It's a regression in compiler that started between version 0.19 and 0.20.
This code compiled in Nim 0.20 crashes compiler:

import emerald

proc parent() {.html_templ.} =
    block content:
        discard

proc child() {.html_templ: parent.} =
    prepend content:
        h1(): "Hello!"
    append content:
        h1(): "Hello!"
/home/konrad/.nimble/pkgs/emerald-0.2.3/emerald/html.nim(660, 36) Warning: use {.base.} for base methods; baseless methods are deprecated [UseBase]
/home/konrad/.nimble/pkgs/emerald-0.2.3/emerald/html.nim(345, 25) Error: internal error: environment misses: :obj

Changing this line

objName = genSym(nskParam, ":obj")

to

        objName = ident":obj"

fixes it.

Related issue in compiler is open in nim-lang/Nim#11214