Skip to content

Conversation

arnetheduck
Copy link
Contributor

random code readability fixes & dead code cleanups

Copy link
Contributor

@dom96 dom96 left a comment

Choose a reason for hiding this comment

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

Nice!


case reason
of tiNew: c.visitorFrmt = "#nimGCvisit((void*)$1, op);$n"
else: assert false
Copy link
Contributor

Choose a reason for hiding this comment

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

I know very little about this code, but I have suspicion that removing this case statement is a bad idea. New reasons could be added in the future, and it would be good to get an error for them.

Oh, I see you've actually removed the enum.

of skConst:
let constVal = if s.ast != nil: s.ast else: s.typ.n
gen(c, constVal, dest)
of skEnumField:
Copy link
Member

Choose a reason for hiding this comment

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

How is that a code cleanup? Don't touch this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mainly because it looks like we never get here - afaict skEnumField gets converted to an int node in semfold.nim leading to this branch never being taken.. can add it back, though lit looks pretty dead.

Copy link
Member

Choose a reason for hiding this comment

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

It's more robust to not assume the frontend did this transformation to the underlying integer value. Don't remove this code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, added a comment instead.

fyi, the js backend doesn't handle it either and there's a number of other sk... cases that get the internalError treatment here through an else branch.

@Araq Araq merged commit 85e2115 into nim-lang:devel Apr 12, 2018
@arnetheduck arnetheduck deleted the cleanups-20180401 branch April 13, 2018 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants