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

Unified Diff: test/generated_sdk/lib/core/list.dart

Issue 1117793002: add checks needed for covariant generics, and List<E> (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 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 | « test/codegen/expect/covariance.txt ('k') | tool/input_sdk/patch/core_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/generated_sdk/lib/core/list.dart
diff --git a/test/generated_sdk/lib/core/list.dart b/test/generated_sdk/lib/core/list.dart
index e87bbcd9031d8cada2f1e5f25864efac2918f249..638cc03a2197392deebbea20e3af5ced5911fbe6 100644
--- a/test/generated_sdk/lib/core/list.dart
+++ b/test/generated_sdk/lib/core/list.dart
@@ -77,17 +77,22 @@ abstract class List<E> implements Iterable<E>, EfficientLength {
* The [length] must not be negative or null, if it is provided.
*/
factory List([int length]) {
+ dynamic list;
if (length == null) {
- return JS('', '[]');
- }
- // Explicit type test is necessary to guard against JavaScript conversions
- // in unchecked mode.
- if ((length is !int) || (length < 0)) {
- throw new ArgumentError("Length must be a non-negative integer: $length");
+ list = JS('', '[]');
+ } else {
+ // Explicit type test is necessary to guard against JavaScript conversions
+ // in unchecked mode.
+ if ((length is !int) || (length < 0)) {
+ throw new ArgumentError("Length must be a non-negative integer: $length");
+ }
+ list = JS('', 'new Array(#)', length);
+ // TODO(jmesserly): consider a fixed array subclass instead.
+ JS('void', r'#.fixed$length = Array', list);
}
- var list = JS('', 'new Array(#)', length);
- // TODO(jmesserly): consider a fixed array subclass instead.
- JS('void', r'#.fixed$length = Array', list);
+ // TODO(jmesserly): skip this when E is dynamic and Object.
+ JS('void', 'dart.setType(#, List\$(#))', list, E);
+ // TODO(jmesserly): compiler creates a bogus type check here.
return list;
}
@@ -100,7 +105,7 @@ abstract class List<E> implements Iterable<E>, EfficientLength {
* The [length] must not be negative or null.
*/
factory List.filled(int length, E fill) {
- List result = new JSArray<E>.fixed(length);
+ List result = new List<E>(length);
if (length != 0 && fill != null) {
for (int i = 0; i < result.length; i++) {
result[i] = fill;
« no previous file with comments | « test/codegen/expect/covariance.txt ('k') | tool/input_sdk/patch/core_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698