Skip to content

Implement tasty.Reflection in the library #6195

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ object ReflectionImpl {
apply(rootContext, SourcePosition(rootContext.source, Spans.NoSpan))

def apply(rootContext: Contexts.Context, rootPosition: SourcePosition): scala.tasty.Reflection =
new ReflectionImpl(new KernelImpl(rootContext, rootPosition))
new scala.tasty.Reflection(new KernelImpl(rootContext, rootPosition))

def showTree(tree: tpd.Tree)(implicit ctx: Contexts.Context): String = {
val refl = new ReflectionImpl(new KernelImpl(ctx, tree.sourcePos))
new refl.SourceCodePrinter().showTree(tree)
val refl = new scala.tasty.Reflection(new KernelImpl(ctx, tree.sourcePos))
val reflCtx = ctx.asInstanceOf[refl.Context]
val reflTree = tree.asInstanceOf[refl.Tree]
new refl.SourceCodePrinter().showTree(reflTree)(reflCtx)
}

private class ReflectionImpl(val kernel: KernelImpl) extends scala.tasty.Reflection

}
2 changes: 1 addition & 1 deletion library/src/scala/tasty/Reflection.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package scala.tasty

import scala.tasty.reflect._

abstract class Reflection
class Reflection(val kernel: Kernel)
extends Core
with ConstantOps
with ContextOps
Expand Down