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

Fix the way to mangle temporary local variables used by serializers #204

Merged
merged 1 commit into from
Dec 21, 2017

Conversation

dahlia
Copy link
Member

@dahlia dahlia commented Dec 21, 2017

Generated serializers had to generated temporary local variables and referred to it, but sometimes these had had an invalid name (e.g., __self.field_name__elem__). This patch fixes the bug besides the following bugs:

  • A bug that map types had been serialized in JSON to {k: v} while these should be [{"key": k, "value": v}].

  • A potential bug that temporary variables had been leaked to their outer scope in Python 2 since local variables in list comprehensions aren't isolated in Python 2. See also What's New in Python 3.0:

    Also note that list comprehensions have different semantics: they are closer to syntactic sugar for a generator expression inside a list() constructor, and in particular the loop control variables are no longer leaked into the surrounding scope.

@dahlia dahlia added cmp:compiler Component: Compiler backend (e.g., annotation processors, code generators) target:python typ:bug Type: Bug/defect labels Dec 21, 2017
@dahlia dahlia self-assigned this Dec 21, 2017
@dahlia dahlia requested review from kanghyojun and Kroisse December 21, 2017 15:40
Kroisse
Kroisse previously approved these changes Dec 21, 2017
@dahlia dahlia merged commit ac99efd into nirum-lang:master Dec 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmp:compiler Component: Compiler backend (e.g., annotation processors, code generators) target:python typ:bug Type: Bug/defect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants