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

Unified Diff: tests/compiler/dart2js/value_range3_test.dart

Issue 91103003: Use the integer type to get rid of above 0 checks in bounds checks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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
Index: tests/compiler/dart2js/value_range3_test.dart
===================================================================
--- tests/compiler/dart2js/value_range3_test.dart (revision 0)
+++ tests/compiler/dart2js/value_range3_test.dart (revision 0)
@@ -0,0 +1,33 @@
+// 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.
+
+// Test that global analysis in dart2js propagates positive integers.
+
+import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
+import 'memory_compiler.dart';
+
+const MEMORY_SOURCE_FILES = const {
+ 'main.dart': '''
+
+var a = [42];
+
+main() {
+ var value = a[0];
+ if (value < 42) {
+ return new List(42)[value];
+ }
+}
+''',
+};
+
+main() {
+ var compiler = compilerFor(MEMORY_SOURCE_FILES);
+ asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
+ var element = compiler.mainApp.findExported('main');
+ var code = compiler.backend.assembleCode(element);
+ Expect.isFalse(code.contains('ioore'));
+ }));
+}
+

Powered by Google App Engine
This is Rietveld 408576698