@@ -29,7 +29,7 @@ private class InsertExpression(config: ExpressionCompilerConfig) extends Phase:
29
29
30
30
// TODO move reflection methods (callMethod, getField, etc) to scala3-library
31
31
// under scala.runtime (or scala.debug?) to avoid recompiling them again and again
32
- private val evaluationClassSource =
32
+ private val expressionClassSource =
33
33
s """ |class ${config.expressionClassName}(thisObject: Any, names: Array[String], values: Array[Any]) {
34
34
| import java.lang.reflect.InvocationTargetException
35
35
| val classLoader = getClass.getClassLoader
@@ -122,10 +122,10 @@ private class InsertExpression(config: ExpressionCompilerConfig) extends Phase:
122
122
| """ .stripMargin
123
123
124
124
override def run (using Context ): Unit =
125
- val inserter = Inserter (parseExpression, parseEvaluationClass )
125
+ val inserter = Inserter (parseExpression, parseExpressionClass )
126
126
ctx.compilationUnit.untpdTree = inserter.transform(ctx.compilationUnit.untpdTree)
127
127
128
- class Inserter (expression : Tree , expressionClass : Seq [Tree ]) extends UntypedTreeMap :
128
+ private class Inserter (expression : Tree , expressionClass : Seq [Tree ]) extends UntypedTreeMap :
129
129
override def transform (tree : Tree )(using Context ): Tree =
130
130
tree match
131
131
case tree : PackageDef =>
@@ -181,9 +181,7 @@ private class InsertExpression(config: ExpressionCompilerConfig) extends Phase:
181
181
new VirtualFile (" <wrapped-expression>" , contentBytes)
182
182
val sourceFile =
183
183
new SourceFile (wrappedExpressionFile, wrappedExpression.toArray):
184
- override def start : Int =
185
- // prefix.size depends on the OS
186
- - prefix.size
184
+ override def start : Int = - prefix.size
187
185
override def underlying : SourceFile = expressionFile
188
186
override def atSpan (span : Span ): SourcePosition =
189
187
if (span.exists) SourcePosition (this , span)
@@ -198,9 +196,8 @@ private class InsertExpression(config: ExpressionCompilerConfig) extends Phase:
198
196
.body
199
197
.head
200
198
201
- private def parseEvaluationClass (using Context ): Seq [Tree ] =
202
- val sourceFile =
203
- SourceFile .virtual(" <evaluation class>" , evaluationClassSource)
199
+ private def parseExpressionClass (using Context ): Seq [Tree ] =
200
+ val sourceFile = SourceFile .virtual(" <expression class>" , expressionClassSource)
204
201
parse(sourceFile).asInstanceOf [PackageDef ].stats
205
202
206
203
private def parse (sourceFile : SourceFile )(using Context ): Tree =
@@ -233,4 +230,4 @@ private class InsertExpression(config: ExpressionCompilerConfig) extends Phase:
233
230
else report.warning(msg, srcPos)
234
231
235
232
private object InsertExpression :
236
- val name : String = " insert-expression "
233
+ val name : String = " insertExpression "
0 commit comments