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

Rename mro not to overlap with Python keyword #188

Merged
merged 2 commits into from Oct 26, 2017

Conversation

kanghyojun
Copy link
Member

@kanghyojun kanghyojun commented Oct 24, 2017

Fix #185.

Add _ at the end of member name when it is duplicated with Python keyword (eg. mro).

@kanghyojun kanghyojun added target:python typ:bug Type: Bug/defect labels Oct 24, 2017
@kanghyojun kanghyojun self-assigned this Oct 24, 2017
@kanghyojun kanghyojun changed the title Rename mro not to duplicate with python keyword Rename mro not to overlap with python keyword Oct 24, 2017
toEnumMemberName :: Name -> T.Text
toEnumMemberName name' = if attributeName `elem` memberKeywords
then T.snoc attributeName '_'
else attributeName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation.

toEnumMemberName name' = if attributeName `elem` memberKeywords
then T.snoc attributeName '_'
else attributeName
where
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This where doesn't have to be nested.

memberKeywords = ["mro"]
toEnumMemberName :: Name -> T.Text
toEnumMemberName name' = if attributeName `elem` memberKeywords
then T.snoc attributeName '_'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about making T.snoc an infix operator?

dahlia
dahlia previously approved these changes Oct 24, 2017
@kanghyojun kanghyojun changed the title Rename mro not to overlap with python keyword Rename mro not to overlap with Python keyword Oct 24, 2017
@dahlia dahlia added the cmp:compiler Component: Compiler backend (e.g., annotation processors, code generators) label Oct 24, 2017
@dahlia dahlia merged commit 8ac04b0 into nirum-lang:master Oct 26, 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.

None yet

2 participants