File tree 2 files changed +14
-12
lines changed
compiler/src/dotty/tools/dotc/core 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -406,6 +406,11 @@ object Flags {
406
406
/** A denotation that is valid in all run-ids */
407
407
val (Permanent @ _, _, _) = newFlags(61 , " <permanent>" )
408
408
409
+ /** Denotation is being loaded. If `Completing` is not set,
410
+ * this means this denotation was loaded from an external file.
411
+ */
412
+ val (Loading @ _, _, _) = newFlags(62 , " <loading>" )
413
+
409
414
// --------- Combined Flag Sets and Conjunctions ----------------------
410
415
411
416
/** All possible flags */
Original file line number Diff line number Diff line change @@ -149,16 +149,6 @@ object SymDenotations {
149
149
private var myPrivateWithin : Symbol = initPrivateWithin
150
150
private var myAnnotations : List [Annotation ] = Nil
151
151
152
- private [this ] var isLoading = false
153
- private [this ] var wasLoaded = false
154
-
155
- def startedLoading () =
156
- isLoading = true
157
-
158
- def finishedLoading () =
159
- isLoading = false
160
- wasLoaded = true
161
-
162
152
/** The owner of the symbol; overridden in NoDenotation */
163
153
def owner : Symbol = maybeOwner
164
154
@@ -171,12 +161,19 @@ object SymDenotations {
171
161
private [dotc] final def flagsUNSAFE : FlagSet = myFlags
172
162
173
163
private def setMyFlags (flags : FlagSet ) =
174
- lazy val immutableFlags = if wasLoaded then AfterLoadFlags else FromStartFlags
164
+ lazy val immutableFlags = if myInfo. isInstanceOf [ SymbolLoader ] then AfterLoadFlags else FromStartFlags
175
165
lazy val changedImmutableFlags = (myFlags ^ flags) & immutableFlags
176
- if myFlags.is(Touched ) && ! isLoading then assert(changedImmutableFlags.isEmpty,
166
+ if myFlags.is(Touched , butNot = Loading ) then assert(changedImmutableFlags.isEmpty,
177
167
s " Illegal mutation of flags ${changedImmutableFlags.flagsString} on completion of $this" )
178
168
myFlags = flags
179
169
170
+ final def startedLoading () =
171
+ myFlags |= Loading
172
+
173
+ final def finishedLoading () =
174
+ myFlags &~= Loading
175
+
176
+
180
177
final def flagsString (implicit ctx : Context ): String = flags.flagsString
181
178
182
179
/** Adapt flag set to this denotation's term or type nature */
You can’t perform that action at this time.
0 commit comments