Skip to content

Post typer transformer #64

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

Merged
merged 5 commits into from
Mar 13, 2014
Merged

Conversation

DarkDimius
Copy link
Contributor

Transformer that simplifies life of Transforms by:

  1. reordering companion objects and classes so that class always precedes companion object,
  2. removing imports and named arguments
  3. rewriting trees representing types to TypeTrees

odersky added 2 commits March 12, 2014 21:14
Needs new TypeRef creation method that works for NoPrefix and at the same time
does not need a denotation. This is provided by method TermRef.withNakedSymbol.
Distringuish between ModifierFlags -- which can appear in trees -- and SourceModifierFlags -- which are
modifiers according to the language spec.
@DarkDimius
Copy link
Contributor Author

@odersky @sjrd please review.

/** A trait that's assumed by the transformers that run right after typer.
* Ensures that trees are normalized when seen by other transforms. This means:
* (1) All module class definitions appear after their companion class definitions
* (2) There are no import clauses or named arguments
Copy link

Choose a reason for hiding this comment

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

Why do we need 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.

Just to reduce variety of types of trees which can be seen during transformations.
This is performed after the "Frontend" phase, so IDEs and, possibly, quasiquotes, should be able to see NamedArgs and Imports.

1) reorders companion objects so that they allways follow matching
classes
2) removes imports and named arguments
3) rewrites all trees holding types are to TypeTrees
Added a prepareForStats&transformStats pair of methods,
which provide a convinient way to alter scopes of
PackageDefs, Templates and Block's.
@DarkDimius
Copy link
Contributor Author

@sjrd @odersky,
I've updated commits, taking reviewer comments into account.
Please, have one more look

A transformer that provides a convenient way to create
companion objects.
@odersky
Copy link
Contributor

odersky commented Mar 13, 2014

LGTM now.

@sjrd
Copy link
Member

sjrd commented Mar 13, 2014

LGTM

sjrd added a commit that referenced this pull request Mar 13, 2014
@sjrd sjrd merged commit 9cd9d97 into scala:master Mar 13, 2014
@DarkDimius DarkDimius mentioned this pull request Mar 14, 2014
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.

4 participants