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

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

Issue 94303002: Add another type JSPositiveInt to show a range analysis in the inferrer would be very beneficial :-… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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
===================================================================
--- sdk/lib/typed_data/dart2js/typed_data_dart2js.dart (revision 30705)
+++ sdk/lib/typed_data/dart2js/typed_data_dart2js.dart (working copy)
@@ -10,7 +10,7 @@
import 'dart:collection';
import 'dart:_collection-dev';
-import 'dart:_interceptors' show JSIndexable;
+import 'dart:_interceptors' show JSIndexable, JSUInt32, JSUInt31;
import 'dart:_js_helper'
show Creates, JavaScriptIndexingBehavior, JSName, Null, Returns;
import 'dart:_foreign_helper' show JS, JS_CONST;
@@ -259,7 +259,7 @@
_getUint16(byteOffset, endian._littleEndian);
@JSName('getUint16')
- @Returns('int')
+ @Returns('JSUInt31')
int _getUint16(int byteOffset, [bool littleEndian]) native;
/**
@@ -275,7 +275,7 @@
_getUint32(byteOffset, endian._littleEndian);
@JSName('getUint32')
- @Returns('int')
+ @Returns('JSUInt32')
int _getUint32(int byteOffset, [bool littleEndian]) native;
/**
@@ -874,7 +874,7 @@
int operator[](int index) {
_checkIndex(index, length);
- return JS("int", "#[#]", this, index);
+ return JS("JSUInt31", "#[#]", this, index);
}
void operator[]=(int index, int value) {
@@ -948,7 +948,7 @@
int operator[](int index) {
_checkIndex(index, length);
- return JS("int", "#[#]", this, index);
+ return JS("JSUInt32", "#[#]", this, index);
}
void operator[]=(int index, int value) {
@@ -1019,7 +1019,7 @@
int operator[](int index) {
_checkIndex(index, length);
- return JS("int", "#[#]", this, index);
+ return JS("JSUInt31", "#[#]", this, index);
}
void operator[]=(int index, int value) {
@@ -1095,7 +1095,7 @@
int operator[](int index) {
_checkIndex(index, length);
- return JS("int", "#[#]", this, index);
+ return JS("JSUInt31", "#[#]", this, index);
}
void operator[]=(int index, int value) {
@@ -1364,7 +1364,8 @@
}
void _checkIndex(int index, int length) {
- if (JS('bool', '(# >>> 0 != #)', index, index) || index >= length) {
+ if (JS('bool', '(# >>> 0 != #)', index, index)
+ || JS('bool', '# >= #', index, length)) {
_invalidIndex(index, length);
}
}
« sdk/lib/_internal/lib/js_number.dart ('K') | « sdk/lib/_internal/lib/js_number.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698