@@ -190,40 +190,14 @@ def ccState(using Context): CCState =
190
190
191
191
extension (tree : Tree )
192
192
193
- /** Map tree with CaptureRef type to its type,
194
- * map CapSet^{refs} to the `refs` references,
195
- * throw IllegalCaptureRef otherwise
196
- */
197
- def toCaptureRefs (using Context ): List [CaptureRef ] = tree match
198
- // case ReachCapabilityApply(arg) =>
199
- // arg.toCaptureRefs.map(_.reach)
200
- // case ReadOnlyCapabilityApply(arg) =>
201
- // arg.toCaptureRefs.map(_.readOnly)
202
- // case CapsOfApply(arg) =>
203
- // arg.toCaptureRefs
204
- case _ => tree.tpe.dealiasKeepAnnots match
205
- case ref : CaptureRef if ref.isTrackableRef =>
206
- ref :: Nil
207
- case AnnotatedType (parent, ann)
208
- if ann.symbol.isRetains && parent.derivesFrom(defn.Caps_CapSet ) =>
209
- ann.tree.toCaptureSet.elems.toList
210
- case tpe =>
211
- throw IllegalCaptureRef (tpe) // if this was compiled from cc syntax, problem should have been reported at Typer
212
-
213
193
/** Convert a @retains or @retainsByName annotation tree to the capture set it represents.
214
194
* For efficience, the result is cached as an Attachment on the tree.
215
195
*/
216
196
def toCaptureSet (using Context ): CaptureSet =
217
197
tree.getAttachment(Captures ) match
218
198
case Some (refs) => refs
219
199
case None =>
220
- val refs =
221
- tree match
222
- case Apply (_ : TypeApply , _) =>
223
- CaptureSet (tree.retainedSet.retainedElements* )
224
- case _ =>
225
- CaptureSet (tree.retainedElems.flatMap(_.toCaptureRefs)* )
226
- // println(s"toCaptureSet: $tree -> $refs")
200
+ val refs = CaptureSet (tree.retainedSet.retainedElements* )
227
201
tree.putAttachment(Captures , refs)
228
202
refs
229
203
0 commit comments