Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: tests/language/regress_13494_test.dart

Issue 25877002: Don't evaluate the argument twice for unresolved static setter calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« tests/co19/co19-co19.status ('K') | « tests/co19/co19-co19.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/regress_13494_test.dart
diff --git a/tests/language/factory_return_type_checked_test.dart b/tests/language/regress_13494_test.dart
similarity index 50%
copy from tests/language/factory_return_type_checked_test.dart
copy to tests/language/regress_13494_test.dart
index dc46145d5e7565a4aec1661a61914b4ebcf8f54d..aaf975abe7921fe6f9af69740d9a0e8933ef4338 100644
--- a/tests/language/factory_return_type_checked_test.dart
+++ b/tests/language/regress_13494_test.dart
@@ -2,22 +2,24 @@
// 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. Test that the argument to an unresolved static
+// getter is only evaluated once.
+
import "package:expect/expect.dart";
-class A {
- factory A() => 42;
-}
+int i = 0;
+
+p(x) => i++;
+
+class A {}
main() {
- bool isCheckedMode = false;
+ bool caught = false;
try {
- String a = 42;
- } catch (e) {
- isCheckedMode = true;
- }
- if (isCheckedMode) {
- Expect.throws(() => new A(), (e) => e is TypeError);
- } else {
- Expect.equals(42, new A());
+ A.unknown = p(2);
+ } catch (_) {
+ caught = true;
}
+ Expect.isTrue(caught);
+ Expect.equals(1, i);
}
« tests/co19/co19-co19.status ('K') | « tests/co19/co19-co19.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698