Skip to content

Create infrastructure for SemanticDB #5193

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 3 commits into from
Oct 7, 2018

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Oct 2, 2018

No description provided.

@nicolasstucki nicolasstucki requested a review from smarter October 2, 2018 17:55
@nicolasstucki
Copy link
Contributor Author

I plan to refactor common logic with the decompiler later on.

import dotty.tools.dotc.core.Phases.Phase
import dotty.tools.dotc.tastyreflect.TastyImpl

class TASTyConsumer extends Phase {
Copy link
Member

Choose a reason for hiding this comment

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

Tasty not TASTy

override def setup(args0: Array[String], rootCtx: Context): (List[String], Context) = {
var args = args0.filter(a => a != "-gen-semantic-db")
if (!args.contains("-from-tasty")) args = "-from-tasty" +: args
if (args.contains("-d")) args = "-color:never" +: args
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy pasted from the decompiler. Will remove it.

smarter
smarter previously requested changes Oct 2, 2018
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

This needs to be in a separate project from the compiler since it may need to use scala libraries for serializing semanticdb.

@allanrenucci
Copy link
Contributor

What about a compiler plugin instead?

@smarter
Copy link
Member

smarter commented Oct 2, 2018

A subproject in the dotty repo is better for rapid development (if something needs to be fixed in tasty reflect while working on the emitter) but eventually it should be in a separate repo yes (and it shouldn't need to be a compiler plugin since it shouldn't have to use internal compiler APIs)

@nicolasstucki nicolasstucki force-pushed the semanticdb-infrastructure branch 3 times, most recently from b3a94b1 to 941f95d Compare October 2, 2018 19:32
@nicolasstucki nicolasstucki dismissed smarter’s stale review October 2, 2018 20:13

Reimplemented the code

Copy link
Contributor

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

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

Cool! Please ping me if you have any questions. It's possible to generate pure Java bindings for semanticdb, I haven't tried it myself but there are instructions here https://github.com/thesamet/sbt-protoc#installation

@@ -677,6 +677,7 @@ object Build {
val dottyCompiler = jars("dotty-compiler")
val args0: List[String] = spaceDelimited("<arg>").parsed.toList
val decompile = args0.contains("-decompile")
val consumeTasty = args0.contains("-gen-semantic-db")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'd write -gen-semanticdb and in in camel case it would be GenSemanticdb (or SemanticdbGen, ..)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I should remove this flag.

tests/run-with-compiler/tasty-consumer/Test.scala shows an example of how
to consume tasty files.
@nicolasstucki nicolasstucki force-pushed the semanticdb-infrastructure branch from b52292e to 7ba35b6 Compare October 4, 2018 08:36
@nicolasstucki nicolasstucki changed the title Create infrastructure for semantic DB Create infrastructure for SemanticDB Oct 4, 2018
@nicolasstucki
Copy link
Contributor Author

@smarter can we merge this?

Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

I guess it can be changed later but I'm not a fan of having something called "TastyConsumer" and something called "ConsumeTasty" at the same time, it's ugly.

@nicolasstucki
Copy link
Contributor Author

I agree with the names. They are horrible. Any suggestions?

@smarter
Copy link
Member

smarter commented Oct 7, 2018

no idea

@nicolasstucki
Copy link
Contributor Author

I will ask around to see if someone has a good idea

@nicolasstucki nicolasstucki merged commit 978d01c into scala:master Oct 7, 2018
@nicolasstucki nicolasstucki deleted the semanticdb-infrastructure branch October 7, 2018 09:43
nicolasstucki added a commit to dotty-staging/dotty that referenced this pull request Oct 7, 2018
allanrenucci added a commit that referenced this pull request Oct 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants