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

Unified Diff: sdk/lib/typed_data/dart2js/typed_data_dart2js.dart

Issue 23618043: dart:typed_data type hierarchy changes try 3 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix by adding !nonleaf annotation 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
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..f04e9183c02299fe947cd6db5d6b569bd12c780e 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);
@@ -615,7 +615,11 @@ class Uint8ClampedList extends Uint8List
class Uint8List
extends TypedData with ListMixin<int>, FixedLengthListMixin<int>
implements JavaScriptIndexingBehavior, List<int>
- native "Uint8Array" {
+ // On some browsers Uint8ClampedArray is a subtype of Uint8Array. Marking
+ // Uint8List as !nonleaf ensures that the native dispatch correctly handles
+ // the potential for Uint8ClampedArray to 'accidentally' pick up the
+ // dispatch record for Uint8List.
+ native "Uint8Array,!nonleaf" {
factory Uint8List(int length) => _create1(length);
factory Uint8List.fromList(List<num> list) =>
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart ('k') | sdk/lib/typed_data/typed_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698