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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart

Issue 11861007: Move indexSet and unary operators to the new interceptor mechanism. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/lib/js_helper.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/lib/js_helper.dart (revision 17016)
+++ sdk/lib/_internal/compiler/implementation/lib/js_helper.dart (working copy)
@@ -61,39 +61,6 @@
? JS('bool', r'# <= #', a, b)
: identical(le$slow(a, b), true);
-index(var a, var index) {
- // The type test may cause a NoSuchMethodError to be thrown but
- // that matches the specification of what the indexing operator is
- // supposed to do.
- bool isJsArrayOrString = JS('bool',
- r'typeof # == "string" || #.constructor === Array',
- a, a);
- if (isJsArrayOrString) {
- var key = JS('int', '# >>> 0', index);
- if (identical(key, index) && key < JS('int', r'#.length', a)) {
- return JS('var', r'#[#]', a, key);
- }
- }
- return index$slow(a, index);
-}
-
-indexSet(var a, var index, var value) {
- // The type test may cause a NoSuchMethodError to be thrown but
- // that matches the specification of what the indexing operator is
- // supposed to do.
- bool isMutableJsArray = JS('bool',
- r'#.constructor === Array && !#.immutable$list',
- a, a);
- if (isMutableJsArray) {
- var key = JS('int', '# >>> 0', index);
- if (identical(key, index) && key < JS('int', r'#.length', a)) {
- JS('void', r'#[#] = #', a, key, value);
- return;
- }
- }
- indexSet$slow(a, index, value);
-}
-
/**
* Returns true if both arguments are numbers.
*
@@ -280,47 +247,6 @@
return UNINTERCEPTED(a ^ b);
}
-not(var a) {
- if (JS('bool', r'typeof # === "number"', a)) {
- return JS('num', r'(~#) >>> 0', a);
- }
- return UNINTERCEPTED(~a);
-}
-
-neg(var a) {
- if (JS('bool', r'typeof # === "number"', a)) return JS('num', r'-#', a);
- return UNINTERCEPTED(-a);
-}
-
-index$slow(var a, var index) {
- if (a is String || isJsArray(a)) {
- if (index is !int) {
- if (index is !num) throw new ArgumentError(index);
- if (!identical(index.truncate(), index)) throw new ArgumentError(index);
- }
- if (index < 0 || index >= a.length) {
- throw new RangeError.value(index);
- }
- return JS('', r'#[#]', a, index);
- }
- return UNINTERCEPTED(a[index]);
-}
-
-void indexSet$slow(var a, var index, var value) {
- if (isJsArray(a)) {
- if (index is !int) {
- throw new ArgumentError(index);
- }
- if (index < 0 || index >= a.length) {
- throw new RangeError.value(index);
- }
- checkMutable(a, 'indexed set');
- JS('void', r'#[#] = #', a, index, value);
- return;
- }
- UNINTERCEPTED(a[index] = value);
-}
-
checkMutable(list, reason) {
if (JS('bool', r'!!(#.immutable$list)', list)) {
throw new UnsupportedError(reason);

Powered by Google App Engine
This is Rietveld 408576698