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

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/js_array.dart

Issue 3009623002: fix list_test for strong mode, and fix DDC List constructors (Closed)
Patch Set: Created 3 years, 4 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
Index: pkg/dev_compiler/tool/input_sdk/private/js_array.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
index 44b6271471c15b0ddd33591c0be69cd0dfd45f84..a83f3d1318362db8d5e75d5a85094c6ade4a362d 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
@@ -18,33 +18,40 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
* Constructor for adding type parameters to an existing JavaScript
* Array. Used for creating literal lists.
*/
- factory JSArray.of(allocation) {
+ factory JSArray.of(list) {
// TODO(sra): Move this to core.List for better readability.
// Capture the parameterized ES6 'JSArray' class.
- return JS('-dynamic', '#', dart.setType(allocation, JS('', 'JSArray')));
+ JS('', '#.__proto__ = JSArray.prototype', list);
+ return JS('-dynamic', '#', list);
}
// TODO(jmesserly): consider a fixed array subclass instead.
- factory JSArray.markFixed(allocation) =>
- new JSArray<E>.of(markFixedList(allocation));
+ factory JSArray.fixed(list) {
+ JS('', '#.__proto__ = JSArray.prototype', list);
+ JS('', r'#.fixed$length = Array', list);
+ return JS('-dynamic', '#', list);
+ }
- factory JSArray.markGrowable(allocation) = JSArray<E>.of;
+ factory JSArray.unmodifiable(list) {
+ JS('', '#.__proto__ = JSArray.prototype', list);
+ JS('', r'#.fixed$length = Array', list);
+ JS('', r'#.immutable$list = Array', list);
+ return JS('-dynamic', '#', list);
+ }
- static List markFixedList(List list) {
+ static void markFixedList(list) {
// Functions are stored in the hidden class and not as properties in
// the object. We never actually look at the value, but only want
// to know if the property exists.
- JS('void', r'#.fixed$length = Array', list);
- return JS('JSFixedArray', '#', list);
+ JS('', r'#.fixed$length = Array', list);
}
- static List markUnmodifiableList(List list) {
+ static void markUnmodifiableList(list) {
// Functions are stored in the hidden class and not as properties in
// the object. We never actually look at the value, but only want
// to know if the property exists.
- JS('void', r'#.fixed$length = Array', list);
- JS('void', r'#.immutable$list = Array', list);
- return JS('JSUnmodifiableArray', '#', list);
+ JS('', r'#.fixed$length = Array', list);
+ JS('', r'#.immutable$list = Array', list);
}
checkMutable(reason) {

Powered by Google App Engine
This is Rietveld 408576698