Index: sdk/lib/typed_data/dart2js/typed_data_dart2js.dart |
diff --git a/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart b/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart |
index 5933b2ef060271e2e97a6d159e660d7c946ee95a..022231141a4c95fc88d76deaa343051a93e6c556 100644 |
--- a/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart |
+++ b/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart |
@@ -563,7 +563,8 @@ class Uint32List |
} |
-class Uint8ClampedList extends Uint8List |
+class Uint8ClampedList extends TypedData with ListMixin<int>, |
+ FixedLengthListMixin<int> implements JavaScriptIndexingBehavior, List<int> |
native "Uint8ClampedArray,CanvasPixelArray" { |
factory Uint8ClampedList(int length) => _create1(length); |
@@ -578,8 +579,7 @@ class Uint8ClampedList extends Uint8List |
static const int BYTES_PER_ELEMENT = 1; |
- // Use implementation from Uint8List |
- // final int length; |
+ int get length => JS("int", '#(#)', fetchLength, this); |
int operator[](int index) { |
_checkIndex(index, length); |
@@ -660,6 +660,21 @@ class Uint8List |
} |
+class _Uint8ListSubclass extends Uint8List native "Uint8Array_bogus_subclass" { |
+ // The Typed Array specification states that Uint8ClampedArray is _not_ |
+ // a subclass of Uint8Array and is a subclass of ArrayBufferView. |
+ // However, some browsers have implemented Uint8ClampedArray as a subclass of |
+ // Uint8Array. Dart follows the specification but in order for dart2js to |
+ // generate correct code it needs to know that there might be a subclass of |
+ // Uint8Array. See: https://codereview.chromium.org/23093027/ |
+ |
+ // Factory constructor is unused but needed since a default |
+ // (generative) constructor can't be generated for a class |
+ // extending a class with no generative constructor. |
+ factory _Uint8ListSubclass() => null; |
+} |
+ |
+ |
class Int64List extends TypedData implements JavaScriptIndexingBehavior, List<int> { |
factory Int64List(int length) { |
throw new UnsupportedError("Int64List not supported by dart2js."); |