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

operator precedence between instanceof and && incorrect #9

Closed
vicb opened this issue May 21, 2015 · 2 comments
Closed

operator precedence between instanceof and && incorrect #9

vicb opened this issue May 21, 2015 · 2 comments

Comments

@vicb
Copy link
Contributor

vicb commented May 21, 2015

in ng2 element_injector.js

  callOnDestroy(): void {
    var p = this._protoStrategy;

    for (var i = 0; i < p._bindings.length; i++) {
      if (p._bindings[i] instanceof DirectiveBinding &&
                                        (<DirectiveBinding>p._bindings[i]).callOnDestroy) {
        this._objs[i].onDestroy();
      }
    }
  }
@mprobst
Copy link
Contributor

mprobst commented Jul 2, 2015

I think the cast is formatted alright, but the operator precedence is incorrect – instanceof binds tighter than &&, so the cast itself should be indented relative to the && expression at +4 ws from the opening parenthesis of the if statement.

if (p._bindings[i] instanceof DirectiveBinding &&
        (<DirectiveBinding>p._bindings[i]).callOnDestroy) {
  this._objs[i].onDestroy();
}

@mprobst mprobst changed the title problems formatting TS cast <Class> operator precedence between instanceof and && incorrect Jul 2, 2015
@mprobst
Copy link
Contributor

mprobst commented Apr 18, 2016

This has been fixed.

@mprobst mprobst closed this as completed Apr 18, 2016
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

2 participants