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

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

Issue 24118004: It's not just [] that return the element type of a List. Make the container optimization work for s… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/union_type_mask.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/list_tracer_node_type_test.dart
===================================================================
--- tests/compiler/dart2js/list_tracer_node_type_test.dart (revision 27800)
+++ tests/compiler/dart2js/list_tracer_node_type_test.dart (working copy)
@@ -56,7 +56,16 @@
}
""";
+String generateTest(String call) {
+ return """
+main() {
+ var a = [42];
+ return a.$call + 42;
+}
+""";
+}
+
main() {
asyncTest(() => compileAll(TEST1).then((generated) {
// Check that we only do a null check on the receiver for
@@ -88,4 +97,21 @@
asyncTest(() => compileAll(TEST6).then((generated) {
Expect.isFalse(generated.contains('iae'));
}));
+
+ var selectors = const <String>[
+ 'first',
+ 'last',
+ 'single',
+ 'singleWhere',
+ 'elementAt',
+ 'removeAt',
+ 'removeLast'
+ ];
+ selectors.map((name) => generateTest('$name()')).forEach((String test) {
+ asyncTest(() => compileAll(test).then((generated) {
+ Expect.isFalse(generated.contains('if (typeof t1'));
+ Expect.isFalse(generated.contains('if (t1 == null)'));
+ }));
+ });
+
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/union_type_mask.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698