[swift-dev] Why doesn't CaptureListExpr hold a ClosureExpr?

Slava Pestov spestov at apple.com
Tue Feb 7 21:56:37 CST 2017


> On Feb 7, 2017, at 7:30 PM, Jacob Bandes-Storch via swift-dev <swift-dev at swift.org> wrote:
> 
> I just learned about CaptureListExpr when working on some diagnostics. Is there a particular reason that its member "closureBody" is an Expr* and not a ClosureExpr*? There seems to be only one place it's built <https://github.com/apple/swift/blob/1e46f13184d7256c991b2ba9424af9efe3cd860f/lib/Parse/ParseExpr.cpp#L2425>, and the body is always a ClosureExpr.
> 
> I can see one minor place <https://github.com/apple/swift/blob/1e46f13184d7256c991b2ba9424af9efe3cd860f/lib/AST/ASTWalker.cpp#L663-L665> where it might be less convenient to have a ClosureExpr, but otherwise there doesn't seem to be much of a reason to keep it generalized to Expr*.

Since autoclosures cannot have capture lists, I think the change you’re suggesting makes sense.

Slava

> 
> Jacob
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170207/4013c480/attachment.html>


More information about the swift-dev mailing list