@@ -59,18 +59,10 @@ class TyperState(r: Reporter) extends DotClass with Showable {
59
59
/** Commit state so that it gets propagated to enclosing context */
60
60
def commit ()(implicit ctx : Context ): Unit = unsupported(" commit" )
61
61
62
- /** The typer state has already been committed */
63
- def isCommitted : Boolean = false
64
-
65
- /** Optionally, if this is a mutable typerstate, it's creator state */
66
- def parent : Option [TyperState ] = None
67
-
68
62
/** The closest ancestor of this typer state (including possibly this typer state itself)
69
63
* which is not yet committed, or which does not have a parent.
70
64
*/
71
- def uncommittedAncestor : TyperState =
72
- if (! isCommitted || ! parent.isDefined) this
73
- else parent.get.uncommittedAncestor
65
+ def uncommittedAncestor : TyperState = this
74
66
75
67
/** Make type variable instances permanent by assigning to `inst` field if
76
68
* type variable instantiation cannot be retracted anymore. Then, remove
@@ -110,7 +102,6 @@ extends TyperState(r) {
110
102
override def ephemeral = myEphemeral
111
103
override def ephemeral_= (x : Boolean ): Unit = { myEphemeral = x }
112
104
113
-
114
105
override def fresh (isCommittable : Boolean ): TyperState =
115
106
new MutableTyperState (this , new StoreReporter (reporter), isCommittable)
116
107
@@ -121,6 +112,11 @@ extends TyperState(r) {
121
112
isCommittable &&
122
113
(! previous.isInstanceOf [MutableTyperState ] || previous.isGlobalCommittable)
123
114
115
+ private var isCommitted = false
116
+
117
+ override def uncommittedAncestor : TyperState =
118
+ if (isCommitted) previous.uncommittedAncestor else this
119
+
124
120
/** Commit typer state so that its information is copied into current typer state
125
121
* In addition (1) the owning state of undetermined or temporarily instantiated
126
122
* type variables changes from this typer state to the current one. (2) Variables
@@ -140,15 +136,9 @@ extends TyperState(r) {
140
136
targetState.ephemeral |= ephemeral
141
137
targetState.gc()
142
138
reporter.flush()
143
- myIsCommitted = true
139
+ isCommitted = true
144
140
}
145
141
146
- private var myIsCommitted = false
147
-
148
- override def isCommitted : Boolean = myIsCommitted
149
-
150
- override def parent = Some (previous)
151
-
152
142
override def gc ()(implicit ctx : Context ): Unit = {
153
143
val toCollect = new mutable.ListBuffer [GenericType ]
154
144
constraint foreachTypeVar { tvar =>
0 commit comments