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

Projects
None yet
2 participants
@kanghyojun
Member

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 self-assigned this Oct 24, 2017

@kanghyojun kanghyojun requested review from dahlia and Kroisse Oct 24, 2017

@kanghyojun kanghyojun changed the title from Rename mro not to duplicate with python keyword to 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

This comment has been minimized.

@dahlia

dahlia Oct 24, 2017

Member

Incorrect indentation.

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

This comment has been minimized.

@dahlia

dahlia Oct 24, 2017

Member

This where doesn't have to be nested.

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

This comment has been minimized.

@dahlia

dahlia Oct 24, 2017

Member

How about making T.snoc an infix operator?

@kanghyojun kanghyojun changed the title from Rename mro not to overlap with python keyword to Rename mro not to overlap with Python keyword Oct 24, 2017

@dahlia dahlia added the cmp:compiler label Oct 24, 2017

@kanghyojun kanghyojun force-pushed the kanghyojun:enum-mro branch from e381b0e to f459705 Oct 26, 2017

@dahlia

dahlia approved these changes Oct 26, 2017

@dahlia dahlia merged commit 8ac04b0 into nirum-lang:master Oct 26, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment