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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/types.dart

Issue 13940015: Allow using native JS []= on typed data lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
Index: sdk/lib/_internal/compiler/implementation/ssa/types.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/types.dart b/sdk/lib/_internal/compiler/implementation/ssa/types.dart
index 0cc63f9f9a1038b4f4a0497c991731cc7a4a3129..e6a90448d03f18e4d4a77746e5f89787ce3062fa 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/types.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/types.dart
@@ -181,7 +181,6 @@ abstract class HType {
bool isInteger() => false;
bool isDouble() => false;
bool isString() => false;
- bool isIndexablePrimitive() => false;
bool isFixedArray() => false;
bool isReadableArray() => false;
bool isMutableArray() => false;
@@ -195,6 +194,20 @@ abstract class HType {
bool isStringOrNull() => false;
bool isPrimitiveOrNull() => false;
+ // TODO(kasperl): Get rid of this one.
+ bool isIndexablePrimitive() => false;
+
+ bool isIndexable(Compiler compiler) =>
+ implementsInterface(compiler.backend.jsIndexableClass, compiler);
+ bool isMutableIndexable(Compiler compiler) =>
+ implementsInterface(compiler.backend.jsMutableIndexableClass, compiler);
+
+ bool implementsInterface(ClassElement interfaceElement, Compiler compiler) {
+ DartType interfaceType = interfaceElement.computeType(compiler);
+ TypeMask mask = new TypeMask.subtype(interfaceType);
+ return mask == mask.union(computeMask(compiler), compiler);
+ }
+
bool canBeNull() => false;
bool canBePrimitive(Compiler compiler) => false;
bool canBePrimitiveNumber(Compiler compiler) => false;

Powered by Google App Engine
This is Rietveld 408576698