Skip to content

Commit 4672f2c

Browse files
committed
Add scaladoc on ExpressionCompiler
1 parent 9fcf8f1 commit 4672f2c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

compiler/src/dotty/tools/debug/ExpressionCompiler.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ import dotty.tools.dotc.core.Contexts.Context
55
import dotty.tools.dotc.core.Phases.Phase
66
import dotty.tools.dotc.transform.ElimByName
77

8+
/**
9+
* The expression compiler powers the debug console in Metals and the IJ Scala plugin,
10+
* enabling evaluation of arbitrary Scala expressions at runtime (even macros).
11+
* It produces class files that can be loaded by the running Scala program,
12+
* to compute the evaluation output.
13+
*
14+
* To do so, it extends the Compiler with 3 phases:
15+
* - InsertExpression: parses and inserts the expression in the original source tree
16+
* - ExtractExpression: extract the typed expression and places it in the new expression class
17+
* - ResolveReflectEval: resolves local variables or inacessible members using reflection calls
18+
*/
819
class ExpressionCompiler(config: ExpressionCompilerConfig) extends Compiler:
920

1021
override protected def frontendPhases: List[List[Phase]] =

0 commit comments

Comments
 (0)