8281292638
In the builder we compile (x && y && z) into nested ifs. Before
code-emission we try to detect this pattern:
If
/ \
/ \
1 expr1 \
If \
/ \ \
/ \ goto
1 expr2 |
goto goto |
\ / |
\ / |
phi1(expr2, true|false) <=== nested if's join block
\ |
\ |
phi(phi1, true|false)
However we forgot to verify that the nested if's join block didn't
contain any expression.
Fixes issue 4826.
Review URL: https://chromiumcodereview.appspot.com//10917012
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11627 260f80e4-7a28-3924-810f-c04153c831b5
34 lines
1.1 KiB
Dart
34 lines
1.1 KiB
Dart
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
// Dart2Js had problems with nested ifs inside loops.
|
|
|
|
foo(x, a) {
|
|
/*---------------------------------------------*/
|
|
/*---------------------------------------------*/
|
|
/*---------------------------------------------*/
|
|
/*---------------------------------------------*/
|
|
/*---------------------------------------------*/
|
|
/*---------------------------------------------*/
|
|
/*------- Avoid inlining ----------------------*/
|
|
/*---------------------------------------------*/
|
|
/*---------------------------------------------*/
|
|
/*---------------------------------------------*/
|
|
/*---------------------------------------------*/
|
|
/*---------------------------------------------*/
|
|
/*---------------------------------------------*/
|
|
for (int i = 0; i < 10; i++) {
|
|
if (x) {
|
|
if (!x) a = [];
|
|
a.add(3);
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
main() {
|
|
var a = foo(true, []);
|
|
Expect.equals(10, a.length);
|
|
Expect.equals(3, a[0]);
|
|
}
|