Skip to content

Make Modifiers not extend from Positioned #5668

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

Closed
wants to merge 1 commit into from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jan 2, 2019

Modifiers was made a subclass of Positioned since it contains elements that
are Positioned: source modifiers and annotations. That way, we got the navigation
logic to get to the elements for free. However, a lot of modifiers are synthetic,
and it seems artificial to give these a position. With the addition of a source
component to position the balance swings the other way. It now seems preferable
to have Modifiers not extend Positions and to consider Modifier as a as a separate
case for navigation instead.

Modifiers was made a subclass of Positioned since it contains elements that
are Positioned: source modifiers and annotations. That way, we got the navigation
logic to get to the elements for free. However, a lot of modifiers are synthetic,
and seems artificial to give these a position. With the addition of a source
component to position the balance swings the other way. It now seems preferable
to have Modifiers not extend Positions and to consider modifier as a as a separate
case for navigation instead.
Copy link
Contributor

@nicolasstucki nicolasstucki left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

@@ -2016,7 +2013,7 @@ object Parsers {
if (in.token == EQUALS) { in.nextToken(); expr() }
else EmptyTree
if (implicitOffset >= 0) {
mods = mods.withPos(mods.pos.union(Position(implicitOffset, implicitOffset)))
//mods = mods.withPos(mods.pos.union(Position(implicitOffset, implicitOffset)))
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed

if (in.token == OBJECT)
stats += objectDef(start, atPos(start, in.skipToken()) { Modifiers(Package) })
if (in.token == OBJECT) {
in.nextToken()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not skipToken?

@odersky
Copy link
Contributor Author

odersky commented Jan 4, 2019

This is part of #5664, where I also addressed review comments.

@odersky odersky closed this Jan 4, 2019
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.

2 participants