Skip to content

Commit 9e80e94

Browse files
committed
Address review: Better names
1 parent 1e5f661 commit 9e80e94

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

compiler/src/dotty/tools/dotc/transform/init/Objects.scala

+12-12
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ object Objects:
470470

471471
/** Store the heap as a mutable field to avoid threading it through the program. */
472472
class MutableData(private[Heap] var heap: Data):
473-
private[Heap] def writeUnion(addr: Addr, value: Value): Unit =
473+
private[Heap] def writeJoin(addr: Addr, value: Value): Unit =
474474
heap.get(addr) match
475475
case None =>
476476
heap = heap.updated(addr, value)
@@ -479,7 +479,7 @@ object Objects:
479479
val value2 = value.join(current)
480480
if value2 != current then
481481
heap = heap.updated(addr, value2)
482-
482+
end MutableData
483483

484484
def empty(): MutableData = new MutableData(Map.empty)
485485

@@ -489,8 +489,8 @@ object Objects:
489489
def read(addr: Addr)(using mutable: MutableData): Value =
490490
mutable.heap(addr)
491491

492-
def writeUnion(addr: Addr, value: Value)(using mutable: MutableData): Unit =
493-
mutable.writeUnion(addr, value)
492+
def writeJoin(addr: Addr, value: Value)(using mutable: MutableData): Unit =
493+
mutable.writeJoin(addr, value)
494494

495495
def localVarAddr(regions: Regions.Data, sym: Symbol, owner: ClassSymbol): Addr =
496496
LocalVarAddr(regions, sym, owner)
@@ -639,7 +639,7 @@ object Objects:
639639
if arr.addr.owner != State.currentObject then
640640
errorMutateOtherStaticObject(State.currentObject, arr.addr.owner)
641641
else
642-
Heap.writeUnion(arr.addr, args.tail.head.value)
642+
Heap.writeJoin(arr.addr, args.tail.head.value)
643643
Bottom
644644
else
645645
// Array.length is OK
@@ -660,7 +660,7 @@ object Objects:
660660
if target.isOneOf(Flags.Method) then
661661
if target.owner == defn.ArrayModuleClass && target.name == nme.apply then
662662
val arr = OfArray(State.currentObject, summon[Regions.Data])
663-
Heap.writeUnion(arr.addr, args.map(_.value).join)
663+
Heap.writeJoin(arr.addr, args.map(_.value).join)
664664
arr
665665
else if target.hasSource then
666666
val cls = target.owner.enclosingClass.asClass
@@ -846,7 +846,7 @@ object Objects:
846846
if addr.owner != State.currentObject then
847847
errorMutateOtherStaticObject(State.currentObject, addr.owner)
848848
else
849-
Heap.writeUnion(addr, rhs)
849+
Heap.writeJoin(addr, rhs)
850850
else
851851
report.warning("Mutating a field before its initialization: " + field.show + ". Calling trace:\n" + Trace.show, Trace.position)
852852
end match
@@ -871,7 +871,7 @@ object Objects:
871871
case outer: (Ref | Cold.type | Bottom.type) =>
872872
if klass == defn.ArrayClass then
873873
val arr = OfArray(State.currentObject, summon[Regions.Data])
874-
Heap.writeUnion(arr.addr, Bottom)
874+
Heap.writeJoin(arr.addr, Bottom)
875875
arr
876876
else
877877
// Widen the outer to finitize the domain. Arguments already widened in `evalArgs`.
@@ -907,7 +907,7 @@ object Objects:
907907
if sym.is(Flags.Mutable) then
908908
val addr = Heap.localVarAddr(summon[Regions.Data], sym, State.currentObject)
909909
Env.setLocalVar(sym, addr)
910-
Heap.writeUnion(addr, value)
910+
Heap.writeJoin(addr, value)
911911
else
912912
Env.setLocalVal(sym, value)
913913
}
@@ -978,7 +978,7 @@ object Objects:
978978
if addr.owner != State.currentObject then
979979
errorMutateOtherStaticObject(State.currentObject, addr.owner)
980980
else
981-
Heap.writeUnion(addr, value)
981+
Heap.writeJoin(addr, value)
982982
case _ =>
983983
report.warning("[Internal error] Variable not found " + sym.show + "\nenv = " + env.show + ". Calling trace:\n" + Trace.show, Trace.position)
984984

@@ -1541,7 +1541,7 @@ object Objects:
15411541
if acc.is(Flags.Mutable) then
15421542
val addr = Heap.fieldVarAddr(summon[Regions.Data], acc, State.currentObject)
15431543
thisV.initVar(acc, addr)
1544-
Heap.writeUnion(addr, value)
1544+
Heap.writeJoin(addr, value)
15451545
else
15461546
thisV.initVal(acc, value)
15471547
printer.println(acc.show + " initialized with " + value)
@@ -1636,7 +1636,7 @@ object Objects:
16361636
if sym.is(Flags.Mutable) then
16371637
val addr = Heap.fieldVarAddr(summon[Regions.Data], sym, State.currentObject)
16381638
thisV.initVar(sym, addr)
1639-
Heap.writeUnion(addr, res)
1639+
Heap.writeJoin(addr, res)
16401640
else
16411641
thisV.initVal(sym, res)
16421642

0 commit comments

Comments
 (0)