Skip to content

Commit e8a38ce

Browse files
committed
log, abort
1 parent 2059e14 commit e8a38ce

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

src/dotty/tools/dotc/backend/jvm/BCodeBodyBuilder.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,12 +757,12 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
757757
val qualSym = findHostClass(qual.tpe, sym)
758758
if (qualSym == ArrayClass) {
759759
targetTypeKind = tpeTK(qual)
760-
log(s"Stored target type kind for ${sym.fullName} as $targetTypeKind")
760+
ctx.log(s"Stored target type kind for ${sym.fullName} as $targetTypeKind")
761761
}
762762
else {
763763
hostClass = qualSym
764764
if (qual.tpe.typeSymbol != qualSym) {
765-
log(s"Precisified host class for $sym from ${qual.tpe.typeSymbol.fullName} to ${qualSym.fullName}")
765+
ctx.log(s"Precisified host class for $sym from ${qual.tpe.typeSymbol.fullName} to ${qualSym.fullName}")
766766
}
767767
}
768768

@@ -948,8 +948,8 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
948948
val module = (
949949
if (!tree.symbol is Flags.PackageClass) tree.symbol
950950
else tree.symbol.info.member(nme.PACKAGE) match {
951-
case NoSymbol => abort(s"SI-5604: Cannot use package as value: $tree")
952-
case s => abort(s"SI-5604: found package class where package object expected: $tree")
951+
case NoDenotation => abort(s"SI-5604: Cannot use package as value: $tree")
952+
case s => abort(s"SI-5604: found package class where package object expected: $tree")
953953
}
954954
)
955955
lineNumber(tree)

src/dotty/tools/dotc/backend/jvm/BCodeHelpers.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,23 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters {
209209
/*
210210
* must-single-thread
211211
*/
212-
def initBytecodeWriter(entryPoints: List[Symbol]): BytecodeWriter = {
212+
def initBytecodeWriter(entryPoints: List[Symbol])(implicit ctx: core.Contexts.Context): BytecodeWriter = {
213213
settings.outputDirs.getSingleOutput match {
214214
case Some(f) if f hasExtension "jar" =>
215215
// If no main class was specified, see if there's only one
216216
// entry point among the classes going into the jar.
217217
if (settings.mainClass.isDefault) {
218218
entryPoints map (_.fullName('.')) match {
219219
case Nil =>
220-
log("No Main-Class designated or discovered.")
220+
ctx.log("No Main-Class designated or discovered.")
221221
case name :: Nil =>
222-
log(s"Unique entry point: setting Main-Class to $name")
222+
ctx.log(s"Unique entry point: setting Main-Class to $name")
223223
settings.mainClass.value = name
224224
case names =>
225-
log(s"No Main-Class due to multiple entry points:\n ${names.mkString("\n ")}")
225+
ctx.log(s"No Main-Class due to multiple entry points:\n ${names.mkString("\n ")}")
226226
}
227227
}
228-
else log(s"Main-Class was specified: ${settings.mainClass.value}")
228+
else ctx.log(s"Main-Class was specified: ${settings.mainClass.value}")
229229

230230
new DirectToJarfileWriter(f.file)
231231

src/dotty/tools/dotc/backend/jvm/BCodeIdiomatic.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,4 +691,10 @@ abstract class BCodeIdiomatic extends BCodeGlue {
691691
}
692692
}
693693
}
694+
695+
def abort(msg: => AnyRef)(implicit ctx: core.Contexts.Context): Nothing = {
696+
ctx.error(msg)
697+
throw new FatalError(msg)
698+
}
699+
694700
}

src/dotty/tools/dotc/backend/jvm/BCodeSkelBuilder.scala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ abstract class BCodeSkelBuilder extends BCodeHelpers {
8383

8484
def tpeTK(tree: Tree): BType = { toTypeKind(tree.tpe) }
8585

86-
def log(msg: => AnyRef) {
87-
global synchronized { global.log(msg) }
88-
}
89-
9086
override def getCurrentCUnit(): CompilationUnit = { cunit }
9187

9288
/* ---------------- helper utils for generating classes and fiels ---------------- */
@@ -188,7 +184,7 @@ abstract class BCodeSkelBuilder extends BCodeHelpers {
188184
exitingPickler { !(lmoc.name.toString contains '$') && lmoc.hasModuleFlag && !(lmoc is Flags.ImplClass) && !lmoc.isNestedClass }
189185
}
190186
if (isCandidateForForwarders) {
191-
log(s"Adding static forwarders from '$claszSymbol' to implementations in '$lmoc'")
187+
ctx.log(s"Adding static forwarders from '$claszSymbol' to implementations in '$lmoc'")
192188
addForwarders(isRemote(claszSymbol), cnode, thisName, lmoc.moduleClass)
193189
}
194190
}

0 commit comments

Comments
 (0)