dart-sdk/tests/language/phi_merge_test.dart
ngeoffray@google.com b3525db9a9 Fix a crash in the compiler.
joinedLocals is populated with phis and the [thisValue], but [thisValue] could be a phi as well. So the check has to be whether the element of the local is the this element.

R=kasperl@google.com

Review URL: https://codereview.chromium.org//108293002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30949 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-06 15:55:58 +00:00

31 lines
663 B
Dart

// Copyright (c) 2013, 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.
// Regression test for dart2js that used to crash on this code.
class A {
operator[]=(index, value) {
switch (value) {
case 42: break;
case 43: break;
}
}
}
main() {
// Make [a] a phi.
var a;
if (true) {
a = new A();
} else {
a = new A();
}
// `A[]=` being inlined, the compiler was confused when merging the
// phis after the switch.
a[0] = 42;
// Use [a] to provoke the crash.
print(a);
}