@@ -103,7 +103,6 @@ class Semantic {
103103 *
104104 * As in the OOPSLA paper, the abstract heap is monotonistic.
105105 *
106- * This is only one object we need to care about, hence it's just `Objekt`.
107106 */
108107 object Heap {
109108 opaque type Heap = mutable.Map [Addr , Objekt ]
@@ -119,9 +118,17 @@ class Semantic {
119118 end extension
120119
121120 extension (ref : Addr )
121+ /** Update field value of the abstract object
122+ *
123+ * Invariant: fields are immutable and only set once from `init`
124+ */
122125 def updateField (field : Symbol , value : Value ): Contextual [Unit ] =
123126 heap(ref).fields(field) = value
124127
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+ */
125132 def updateOuter (klass : ClassSymbol , value : Value ): Contextual [Unit ] =
126133 heap(ref).outers(klass) = value
127134 end extension
@@ -316,7 +323,7 @@ class Semantic {
316323 val cls = target.owner.enclosingClass.asClass
317324 if target.isPrimaryConstructor then
318325 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)
320327 else
321328 val rhs = target.defTree.asInstanceOf [ValOrDefDef ].rhs
322329 eval(rhs, addr, cls, cacheResult = true )
@@ -777,9 +784,9 @@ class Semantic {
777784 else if target.is(Flags .Package ) || target.isStaticOwner then Hot
778785 else
779786 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 )
783790 val outerCls = klass.owner.enclosingClass.asClass
784791 resolveThis(target, obj.outers(klass), outerCls, source)
785792 case RefSet (refs) =>
0 commit comments