dart2js: optimize redundant and contradictory nested conditions in if-tests #12571
Labels
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
web-dart2js
Inlining sometimes creates redundant or contradicting tests when all levels of the call tree have the same test.
if (a) { if (a) ... } --> if (a) { if (true) ... }
From swarm:
t1 = this._node == null;
if (!t1) {
if (t1) {
if (t1)
this._node = this.render$0();
this.afterRender$1(this._node);
}
t1 = $.get$body$x($.get$document$x(this._node));
t2 = this._node == null;
if (t2) {
if (t2)
this._node = this.render$0();
this.afterRender$1(this._node);
}
t1 = t1.contains(this._node) === true;
} else
t1 = false;
if (t1) {
view._enterDocument$0();
this.doLayout$0();
}
Should reduce to:
t1 = this._node;
if ($.get$body$x($.get$document$x(t1)).contains(t1)) {
view._enterDocument$0();
this.doLayout$0();
}
The text was updated successfully, but these errors were encountered: