Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nested proc vm compilation error when compiling to javascript #12492

Closed
krux02 opened this issue Oct 22, 2019 · 0 comments · Fixed by #23484
Closed

nested proc vm compilation error when compiling to javascript #12492

krux02 opened this issue Oct 22, 2019 · 0 comments · Fixed by #23484
Assignees

Comments

@krux02
Copy link
Contributor

krux02 commented Oct 22, 2019

When compiling to JS, compiling a nested proc to the vm does not work like in the example. This is strage, because compiling to JS should not affect if I can compile something to the VM.

Example

nim js -r scratch.nim

proc foo() =
  var i = 0
  proc bar() =
    inc i

  bar()
  echo i

foo()
static:
  foo()

Current Output

/tmp/scratch.nim(4, 9) Error: cannot evaluate at compile time: i

Expected Output

Hint: scratch [Processing]
1
CC: scratch.nim
Hint:  [Link]
Hint: operation successful (21875 lines compiled; 0.161 sec total; 25.77MiB peakmem; Debug Build) [SuccessX]
Hint: /tmp/scratch  [Exec]
1

Additional Information

  • Compiling with nim c -r scratch.nim shows no errors at all.

  • This is importat, because my refactoring of the json.to macro test requires this to work.

    proc mulTest: JsonNode =

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

Successfully merging a pull request may close this issue.

3 participants