Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match doesn't rebind this #926

Closed
andreivolt opened this issue Oct 3, 2016 · 1 comment
Closed

match doesn't rebind this #926

andreivolt opened this issue Oct 3, 2016 · 1 comment

Comments

@andreivolt
Copy link

It seems that match doesn't do the right thing that switch does with this:

foo:
  match @bar
  | foo => bar

compiles to:

  foo: (function(){
    var ref$;
    switch (ref$ = [this.bar], false) {
    case !foo(ref$[0]):
      return bar;
    }
  }())
rhendric added a commit to rhendric/LiveScript that referenced this issue Oct 3, 2016
This issue was caused by a failure of `traverse-children` to enter the
topic of a `match` statement (it worked fine with `switch`). This in
turn was because the Switch AST node, when representing a match, stored
its thing-to-match in a member called `target` instead of `topic`, but
'target' was not included in its list of child fields ('topic' was).

I couldn't see any use in keeping two distinct `topic` and `target`
fields, since they're never both used in the same node and never
referenced from other classes, so the issue was fixed by unifying them.
@gkz gkz closed this as completed in 820cb37 Oct 3, 2016
@andreivolt
Copy link
Author

wow, that was fast! thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant