flyx / emerald

HTML5 templating engine for Nimrod
Do What The F*ck You Want To Public License
95 stars 9 forks source link

Prepend and append regression in Nim 0.20 #20

Open konradmb opened 5 years ago

konradmb commented 5 years ago

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 https://github.com/flyx/emerald/blob/8b443ef20cb1834a7c9a4b49f6c1066dd4cd2fd4/src/emerald/html.nim#L345 to

        objName = ident":obj"

fixes it.

Related issue in compiler is open in https://github.com/nim-lang/Nim/issues/11214