-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Drop modifiers #1539
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
Drop modifiers #1539
Conversation
Prefer to access directly via symbol.
@@ -944,7 +944,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma | |||
} | |||
|
|||
object ValDef extends ValDefDeconstructor { | |||
def _1: Modifiers = field.mods | |||
def _1: Modifiers = tpd.Modifiers(field.symbol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DarkDimius Note that modifiers will be re-created as a new object everytime _1
is called. Is it possible to split the _1
accessor into two accessors, one for flags and another for annotations? If not, an alternative would be to let Symbol inherit from Modifiers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you also plan to retain original positions of modifiers as written in the source file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the parse-trees yes. But these are not preserved in typed trees or TASTY.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grepping the source code it seems that _1 is never used. Try returning null
to ensure it?
@@ -249,17 +249,6 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => | |||
/** Is this case guarded? */ | |||
def isGuardedCase(cdef: CaseDef) = cdef.guard ne EmptyTree | |||
|
|||
/** True iff definition is a val or def with no right-hand-side, or it | |||
* is an abstract typoe declaration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function was unused, superseded by NavigateAST.
Backend does not need them after all, can just use nulls there. So the functionality is only used for printing, and it makes sense to move everything there.
/rebuild |
The typed variant is no longer needed. This means modifiers can safely be ignored in typed trees if we so choose.
That way it can be accessed by other parts which deal with error messages.
/rebuild |
I tried this locally and everything seems to be fine. I'll try to rebuild this again. |
/rebuild |
LGTM |
The end goal of this PR is to get rid of the Modifiers structure and to represent each modifier as a tree of its own. This is more IDE friendly and simplifies treatment of trees.
@DarkDimius can you comment on this? Also, have a look at my comments in BackendInterface which require action.