Skip to content

Commit 2059e14

Browse files
committed
passing Context around
1 parent a7ec28e commit 2059e14

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,14 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters {
405405
*
406406
* must-single-thread
407407
*/
408-
final def internalName(sym: Symbol): String = { asmClassType(sym).getInternalName }
408+
final def internalName(sym: Symbol)(implicit ctx: core.Contexts.Context): String = asmClassType(sym).getInternalName
409409

410410
/*
411411
* Tracks (if needed) the inner class given by `sym`.
412412
*
413413
* must-single-thread
414414
*/
415-
final def asmClassType(sym: Symbol): BType = {
415+
final def asmClassType(sym: Symbol)(implicit ctx: core.Contexts.Context): BType = {
416416
assert(
417417
hasInternalName(sym),
418418
{
@@ -489,16 +489,17 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters {
489489
}
490490

491491
def primitiveOrRefType2(sym: Symbol): BType = {
492+
import core.Symbols.defn
493+
492494
primitiveTypeMap.get(sym) match {
493495
case Some(pt) => pt
494496
case None =>
495-
sym match {
496-
case definitions.NullClass => RT_NULL
497-
case definitions.NothingClass => RT_NOTHING
498-
case _ if sym.isClass => newReference(sym)
499-
case _ =>
500-
assert(sym.isType, sym) // it must be compiling Array[a]
501-
ObjectReference
497+
if (sym == defn.NullClass) RT_NULL
498+
else if (sym == defn.NothingClass) RT_NOTHING
499+
else if (sym.isClass) newReference(sym)
500+
else {
501+
assert(sym.isType, sym) // it must be compiling Array[a]
502+
ObjectReference
502503
}
503504
}
504505
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,10 @@ abstract class BCodeTypes extends BCodeIdiomatic {
334334
final def isDeprecated(sym: Symbol): Boolean = { sym.annotations exists (_ matches definitions.DeprecatedAttr) }
335335

336336
/* must-single-thread */
337-
final def hasInternalName(sym: Symbol) = { sym.isClass || ((sym is Flags.ModuleVal) && !(sym is Flags.Method)) }
337+
final def hasInternalName(sym: Symbol)(implicit ctx: core.Contexts.Context) = (
338+
sym.isClass ||
339+
((sym is Flags.ModuleVal) && !(sym is Flags.Method))
340+
)
338341

339342
/* must-single-thread */
340343
def getSuperInterfaces(csym: Symbol): List[Symbol] = {

0 commit comments

Comments
 (0)