Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Sep 20, 2018

Add a defTree field that gets set for certain symbols.

Some possible uses:

  • find inline bodies
  • goto definition in IDE
  • follow inline bindings to actual arguments

@odersky odersky force-pushed the add-tree-field branch 3 times, most recently from 86620c9 to 6a5aec8 Compare September 20, 2018 16:09
As a first step, rename all occurrences of `rewrite` to `inline`.
Analogous to `&` and `|`, treat `inline` as an identifier but
intrepret it specially if it appears in places where it influences
the syntax.

This allows us to keep `@inline` as an annotation.
Need to introduce a side effect to avoid a "pure expression does nothing in statement position" warning.
Rename `tree`, `trees` and associated methods in `ClassSymbol` to `rootTree`, `rootTrees`.

We want to add another tree field to symbols that points directly to the symbol's definition tree.
So we should be more specific about `rootTree`.
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.

Actually, this is the tree before Post typer has transformed it. Hence it does not match the tree that is pickled. Previously I loaded stored it inside of pickler.

@nicolasstucki
Copy link
Contributor

I saw the issue with a def that contained inlined code. The call of the Inlined tree still had the full call tree.

val sym = tree.symbol
sym.registerIfChild()
sym.transformAnnotations(transformAnnot)
sym.defTree = tree
Copy link
Contributor

Choose a reason for hiding this comment

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

I referred to this tree

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have an alternative fix in 241122e of #5138. @nicolasstucki can you review this one?

@nicolasstucki
Copy link
Contributor

I have a fix in f3885ac.

@odersky
Copy link
Contributor Author

odersky commented Sep 26, 2018

This PR and a proposed fix is part of #5138.

@odersky odersky closed this Sep 26, 2018
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