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

Python target generates code that raises NameError #138

Closed
dahlia opened this issue May 24, 2017 · 1 comment
Closed

Python target generates code that raises NameError #138

dahlia opened this issue May 24, 2017 · 1 comment

Comments

@dahlia
Copy link
Member

@dahlia dahlia commented May 24, 2017

Python target generates code that raises NameError when a referring type is above than a referred type e.g.:

record a (b value);
record b (text value);

The above code generates a Python code like the following (though it's approximated, it shows a point):

class A:
    __nirum_field_types__ = {'value': B}  # B is not defined at the moment.

class B:
    __nirum_field_types__ = {'value': str}
@dahlia
Copy link
Member Author

@dahlia dahlia commented Jun 21, 2017

We need to encode all forward references as string literals and get types always through typing.get_type_hints() function.

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

Successfully merging a pull request may close this issue.

None yet
2 participants