@@ -48,40 +48,14 @@ def ccState(using Context): CCState =
48
48
49
49
extension (tree : Tree )
50
50
51
- /** Map tree with CaptureRef type to its type,
52
- * map CapSet^{refs} to the `refs` references,
53
- * throw IllegalCaptureRef otherwise
54
- */
55
- def toCaptureRefs (using Context ): List [CaptureRef ] = tree match
56
- // case ReachCapabilityApply(arg) =>
57
- // arg.toCaptureRefs.map(_.reach)
58
- // case ReadOnlyCapabilityApply(arg) =>
59
- // arg.toCaptureRefs.map(_.readOnly)
60
- // case CapsOfApply(arg) =>
61
- // arg.toCaptureRefs
62
- case _ => tree.tpe.dealiasKeepAnnots match
63
- case ref : CaptureRef if ref.isTrackableRef =>
64
- ref :: Nil
65
- case AnnotatedType (parent, ann)
66
- if ann.symbol.isRetains && parent.derivesFrom(defn.Caps_CapSet ) =>
67
- ann.tree.toCaptureSet.elems.toList
68
- case tpe =>
69
- throw IllegalCaptureRef (tpe) // if this was compiled from cc syntax, problem should have been reported at Typer
70
-
71
51
/** Convert a @retains or @retainsByName annotation tree to the capture set it represents.
72
52
* For efficience, the result is cached as an Attachment on the tree.
73
53
*/
74
54
def toCaptureSet (using Context ): CaptureSet =
75
55
tree.getAttachment(Captures ) match
76
56
case Some (refs) => refs
77
57
case None =>
78
- val refs =
79
- tree match
80
- case Apply (_ : TypeApply , _) =>
81
- CaptureSet (tree.retainedSet.retainedElements* )
82
- case _ =>
83
- CaptureSet (tree.retainedElems.flatMap(_.toCaptureRefs)* )
84
- // println(s"toCaptureSet: $tree -> $refs")
58
+ val refs = CaptureSet (tree.retainedSet.retainedElements* )
85
59
tree.putAttachment(Captures , refs)
86
60
refs
87
61
0 commit comments