@@ -103,7 +103,6 @@ class Semantic {
103
103
*
104
104
* As in the OOPSLA paper, the abstract heap is monotonistic.
105
105
*
106
- * This is only one object we need to care about, hence it's just `Objekt`.
107
106
*/
108
107
object Heap {
109
108
opaque type Heap = mutable.Map [Addr , Objekt ]
@@ -119,9 +118,17 @@ class Semantic {
119
118
end extension
120
119
121
120
extension (ref : Addr )
121
+ /** Update field value of the abstract object
122
+ *
123
+ * Invariant: fields are immutable and only set once from `init`
124
+ */
122
125
def updateField (field : Symbol , value : Value ): Contextual [Unit ] =
123
126
heap(ref).fields(field) = value
124
127
128
+ /** Update the immediate outer of the given `klass` of the abstract object
129
+ *
130
+ * Invariant: outers are immutable and only set once from `init`
131
+ */
125
132
def updateOuter (klass : ClassSymbol , value : Value ): Contextual [Unit ] =
126
133
heap(ref).outers(klass) = value
127
134
end extension
@@ -316,7 +323,7 @@ class Semantic {
316
323
val cls = target.owner.enclosingClass.asClass
317
324
if target.isPrimaryConstructor then
318
325
val tpl = cls.defTree.asInstanceOf [TypeDef ].rhs.asInstanceOf [Template ]
319
- eval(tpl, addr, cls, cacheResult = true )(using ctx, trace.add(tpl ), promoted)
326
+ eval(tpl, addr, cls, cacheResult = true )(using ctx, trace.add(cls.defTree ), promoted)
320
327
else
321
328
val rhs = target.defTree.asInstanceOf [ValOrDefDef ].rhs
322
329
eval(rhs, addr, cls, cacheResult = true )
@@ -777,9 +784,9 @@ class Semantic {
777
784
else if target.is(Flags .Package ) || target.isStaticOwner then Hot
778
785
else
779
786
thisV match
780
- case Hot | _ : ThisRef => Hot
781
- case warm : Warm =>
782
- val obj = heap(warm )
787
+ case Hot => Hot
788
+ case addr : Addr =>
789
+ val obj = heap(addr )
783
790
val outerCls = klass.owner.enclosingClass.asClass
784
791
resolveThis(target, obj.outers(klass), outerCls, source)
785
792
case RefSet (refs) =>
0 commit comments