@@ -136,33 +136,37 @@ class Driver {
136
136
*/
137
137
def process (args : Array [String ], rootCtx : Context ): Reporter = {
138
138
val (fileNames0, ctx0) = setup(args, rootCtx)
139
- val (fileNames, ctx) =
140
- if (ctx0.settings.fromTasty.value(ctx0)) {
141
- // Resolve classpath and class names of tasty files
142
- val (classPaths, classNames) = fileNames0.map { name =>
143
- val path = Paths .get(name)
144
- if (! name.endsWith(" .tasty" )) (" " , name)
145
- else if (Files .exists(path)) {
146
- TastyFileUtil .getClassName(path) match {
147
- case Some (res) => res
148
- case _ =>
149
- ctx0.error(s " Could not load classname from $name. " )
150
- (" " , name)
151
- }
152
- } else {
153
- ctx0.error(s " File $name does not exist. " )
154
- (" " , name)
155
- }
156
- }.unzip
157
- val ctx1 = ctx0.fresh
158
- val classPaths1 = classPaths.distinct.filter(_ != " " )
159
- val fullClassPath = (ctx1.settings.classpath.value(ctx1) :: classPaths1).mkString(java.io.File .pathSeparator)
160
- ctx1.setSetting(ctx1.settings.classpath, fullClassPath)
161
- (classNames, ctx1)
162
- } else (fileNames0, ctx0)
139
+ val (fileNames, ctx) = fromTastySetup(fileNames0, ctx0)
163
140
doCompile(newCompiler(ctx), fileNames)(ctx)
164
141
}
165
142
143
+ /** Settup extra classpath and figure out class names for tasty file inputs */
144
+ private def fromTastySetup (fileNames0 : List [String ], ctx0 : Context ) = {
145
+ if (ctx0.settings.fromTasty.value(ctx0)) {
146
+ // Resolve classpath and class names of tasty files
147
+ val (classPaths, classNames) = fileNames0.map { name =>
148
+ val path = Paths .get(name)
149
+ if (! name.endsWith(" .tasty" )) (" " , name)
150
+ else if (Files .exists(path)) {
151
+ TastyFileUtil .getClassName(path) match {
152
+ case Some (res) => res
153
+ case _ =>
154
+ ctx0.error(s " Could not load classname from $name. " )
155
+ (" " , name)
156
+ }
157
+ } else {
158
+ ctx0.error(s " File $name does not exist. " )
159
+ (" " , name)
160
+ }
161
+ }.unzip
162
+ val ctx1 = ctx0.fresh
163
+ val classPaths1 = classPaths.distinct.filter(_ != " " )
164
+ val fullClassPath = (classPaths1 :+ ctx1.settings.classpath.value(ctx1)).mkString(java.io.File .pathSeparator)
165
+ ctx1.setSetting(ctx1.settings.classpath, fullClassPath)
166
+ (classNames, ctx1)
167
+ } else (fileNames0, ctx0)
168
+ }
169
+
166
170
def main (args : Array [String ]): Unit = {
167
171
// Preload scala.util.control.NonFatal. Otherwise, when trying to catch a StackOverflowError,
168
172
// we may try to load it but fail with another StackOverflowError and lose the original exception,
0 commit comments