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

Rendering of return statements in typed AST #10805

Closed
cooldome opened this issue Mar 7, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@cooldome
Copy link
Member

commented Mar 7, 2019

Example

import macros

proc test_func(x: int): int = 
  if x mod 2 == 0:
    return x + 2
  else:
    return 0

macro dumpSym(someproc: typed) : untyped = 
  echo someProc.getImpl.repr

dumpSym(test_func)

Function test_func gets rendered as:

proc aSimpleFunction(x: int): int =
  if x mod 2 == 0:
    return result = x + 2
  else:
    return result = 0

this is not valid AST. It is easy to patch renderer to handle return statement better.

@cooldome cooldome added the Macros label Mar 7, 2019

cooldome added a commit to cooldome/Nim that referenced this issue Mar 7, 2019

@Araq Araq closed this in d8c3df2 Mar 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.