<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I'm still learning, but I think its just the distinction between introducing the name and performing the name binding. Consider this example,<div class=""><br class=""></div><div class="">let (x, y) = (1, 2)</div><div class=""><br class=""></div><div class="">This parses into one PatternBindingDecl and two VarDecls.</div><div class=""><br class=""></div><div class="">Slava</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 18, 2015, at 8:08 AM, Lee M via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">With the code: var foo = true, swift parses this into the following AST:<div class=""><br class=""></div><div class=""><div class="">(pattern_binding_decl</div><div class=""> (pattern_named 'foo')</div><div class=""> (boolean_literal_expr type='<null>' value=true))</div><div class="">(var_decl "foo" type='<null type>' storage_kind=stored)))</div></div><div class=""><br class=""></div><div class="">I'm wondering why VarDecl and PatternBindingDecl are separate nodes in the tree and not nested somehow, as they both represent similar things..?</div><div class=""><br class=""></div><div class="">Might be a trivial question as I'm not a compiler guru. I'm porting parts of the AST representation to another language for a project.</div><div class=""><br class=""></div><div class="">Thanks!</div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=NLTid1W7V2mxBEfr5Y3KfTntaxSmOQp5vjACZc9Eh186k4R8NlzQ2EimfxkcaCWka6IWHS6fGINC4NqMpr2fqtjiWEJPKro23RYFs1BqXOChF5tHwFfK5zQBbbHYde8M7Db29U5ci1lJJwzu9ysltmA-2Fjxp6GEVBljZAH6A0v0hzcWYaWg1xiZB5btja2-2Fhc33h5Bux5-2BBYL60Pt72GHS-2Fqjxh8-2BKkVgHxbVjnKiMA8-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></div></body></html>