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

Side by Side Diff: runtime/lib/typeddata.dart

Issue 12531009: Fix typo in method calls for [] and []= operators in views. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // patch classes for Int8List ..... Float64List and ByteData implementations. 5 // patch classes for Int8List ..... Float64List and ByteData implementations.
6 6
7 patch class Int8List { 7 patch class Int8List {
8 /* patch */ factory Int8List(int length) { 8 /* patch */ factory Int8List(int length) {
9 return new _Int8Array(length); 9 return new _Int8Array(length);
10 } 10 }
(...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 } 1949 }
1950 1950
1951 1951
1952 // Method(s) implementing List interface. 1952 // Method(s) implementing List interface.
1953 1953
1954 int operator[](int index) { 1954 int operator[](int index) {
1955 if (index < 0 || index >= length) { 1955 if (index < 0 || index >= length) {
1956 String message = "$index must be in the range [0..$length)"; 1956 String message = "$index must be in the range [0..$length)";
1957 throw new RangeError(message); 1957 throw new RangeError(message);
1958 } 1958 }
1959 return _typeddata.getInt8(offsetInBytes + 1959 return _typeddata._getInt8(offsetInBytes +
1960 (index * Int8List.BYTES_PER_ELEMENT)); 1960 (index * Int8List.BYTES_PER_ELEMENT));
1961 } 1961 }
1962 1962
1963 void operator[]=(int index, int value) { 1963 void operator[]=(int index, int value) {
1964 if (index < 0 || index >= length) { 1964 if (index < 0 || index >= length) {
1965 String message = "$index must be in the range [0..$length)"; 1965 String message = "$index must be in the range [0..$length)";
1966 throw new RangeError(message); 1966 throw new RangeError(message);
1967 } 1967 }
1968 _typeddata.setInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT), 1968 _typeddata. setInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT),
1969 _toInt8(value)); 1969 _toInt8(value));
1970 } 1970 }
1971 1971
1972 Iterator<int> get iterator { 1972 Iterator<int> get iterator {
1973 return new _TypedListIterator<int>(this); 1973 return new _TypedListIterator<int>(this);
1974 } 1974 }
1975 1975
1976 1976
1977 // Method(s) implementing TypedData interface. 1977 // Method(s) implementing TypedData interface.
1978 1978
1979 int get elementSizeInBytes { 1979 int get elementSizeInBytes {
(...skipping 15 matching lines...) Expand all
1995 } 1995 }
1996 1996
1997 1997
1998 // Method(s) implementing List interface. 1998 // Method(s) implementing List interface.
1999 1999
2000 int operator[](int index) { 2000 int operator[](int index) {
2001 if (index < 0 || index >= length) { 2001 if (index < 0 || index >= length) {
2002 String message = "$index must be in the range [0..$length)"; 2002 String message = "$index must be in the range [0..$length)";
2003 throw new RangeError(message); 2003 throw new RangeError(message);
2004 } 2004 }
2005 return _typeddata.getUint8(offsetInBytes + 2005 return _typeddata._getUint8(offsetInBytes +
2006 (index * Uint8List.BYTES_PER_ELEMENT)); 2006 (index * Uint8List.BYTES_PER_ELEMENT));
2007 } 2007 }
2008 2008
2009 void operator[]=(int index, int value) { 2009 void operator[]=(int index, int value) {
2010 if (index < 0 || index >= length) { 2010 if (index < 0 || index >= length) {
2011 String message = "$index must be in the range [0..$length)"; 2011 String message = "$index must be in the range [0..$length)";
2012 throw new RangeError(message); 2012 throw new RangeError(message);
2013 } 2013 }
2014 _typeddata.setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), 2014 _typeddata._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
2015 _toUint8(value)); 2015 _toUint8(value));
2016 } 2016 }
2017 2017
2018 Iterator<int> get iterator { 2018 Iterator<int> get iterator {
2019 return new _TypedListIterator<int>(this); 2019 return new _TypedListIterator<int>(this);
2020 } 2020 }
2021 2021
2022 2022
2023 // Method(s) implementing TypedData interface. 2023 // Method(s) implementing TypedData interface.
2024 2024
2025 int get elementSizeInBytes { 2025 int get elementSizeInBytes {
(...skipping 16 matching lines...) Expand all
2042 } 2042 }
2043 2043
2044 2044
2045 // Method(s) implementing List interface. 2045 // Method(s) implementing List interface.
2046 2046
2047 int operator[](int index) { 2047 int operator[](int index) {
2048 if (index < 0 || index >= length) { 2048 if (index < 0 || index >= length) {
2049 String message = "$index must be in the range [0..$length)"; 2049 String message = "$index must be in the range [0..$length)";
2050 throw new RangeError(message); 2050 throw new RangeError(message);
2051 } 2051 }
2052 return _typeddata.getUint8(offsetInBytes + 2052 return _typeddata._getUint8(offsetInBytes +
2053 (index * Uint8List.BYTES_PER_ELEMENT)); 2053 (index * Uint8List.BYTES_PER_ELEMENT));
2054 } 2054 }
2055 2055
2056 void operator[]=(int index, int value) { 2056 void operator[]=(int index, int value) {
2057 if (index < 0 || index >= length) { 2057 if (index < 0 || index >= length) {
2058 String message = "$index must be in the range [0..$length)"; 2058 String message = "$index must be in the range [0..$length)";
2059 throw new RangeError(message); 2059 throw new RangeError(message);
2060 } 2060 }
2061 _typeddata.setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), 2061 _typeddata._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
2062 _toClampedUint8(value)); 2062 _toClampedUint8(value));
2063 } 2063 }
2064 2064
2065 Iterator<int> get iterator { 2065 Iterator<int> get iterator {
2066 return new _TypedListIterator<int>(this); 2066 return new _TypedListIterator<int>(this);
2067 } 2067 }
2068 2068
2069 2069
2070 // Method(s) implementing TypedData interface. 2070 // Method(s) implementing TypedData interface.
2071 2071
2072 int get elementSizeInBytes { 2072 int get elementSizeInBytes {
(...skipping 15 matching lines...) Expand all
2088 } 2088 }
2089 2089
2090 2090
2091 // Method(s) implementing List interface. 2091 // Method(s) implementing List interface.
2092 2092
2093 int operator[](int index) { 2093 int operator[](int index) {
2094 if (index < 0 || index >= length) { 2094 if (index < 0 || index >= length) {
2095 String message = "$index must be in the range [0..$length)"; 2095 String message = "$index must be in the range [0..$length)";
2096 throw new RangeError(message); 2096 throw new RangeError(message);
2097 } 2097 }
2098 return _typeddata.getInt16(offsetInBytes + 2098 return _typeddata._getInt16(offsetInBytes +
2099 (index * Int16List.BYTES_PER_ELEMENT)); 2099 (index * Int16List.BYTES_PER_ELEMENT));
2100 } 2100 }
2101 2101
2102 void operator[]=(int index, int value) { 2102 void operator[]=(int index, int value) {
2103 if (index < 0 || index >= length) { 2103 if (index < 0 || index >= length) {
2104 String message = "$index must be in the range [0..$length)"; 2104 String message = "$index must be in the range [0..$length)";
2105 throw new RangeError(message); 2105 throw new RangeError(message);
2106 } 2106 }
2107 _typeddata.setInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT), 2107 _typeddata._setInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT),
2108 _toInt16(value)); 2108 _toInt16(value));
2109 } 2109 }
2110 2110
2111 Iterator<int> get iterator { 2111 Iterator<int> get iterator {
2112 return new _TypedListIterator<int>(this); 2112 return new _TypedListIterator<int>(this);
2113 } 2113 }
2114 2114
2115 2115
2116 // Method(s) implementing TypedData interface. 2116 // Method(s) implementing TypedData interface.
2117 2117
2118 int get elementSizeInBytes { 2118 int get elementSizeInBytes {
(...skipping 15 matching lines...) Expand all
2134 } 2134 }
2135 2135
2136 2136
2137 // Method(s) implementing List interface. 2137 // Method(s) implementing List interface.
2138 2138
2139 int operator[](int index) { 2139 int operator[](int index) {
2140 if (index < 0 || index >= length) { 2140 if (index < 0 || index >= length) {
2141 String message = "$index must be in the range [0..$length)"; 2141 String message = "$index must be in the range [0..$length)";
2142 throw new RangeError(message); 2142 throw new RangeError(message);
2143 } 2143 }
2144 return _typeddata.getUint16(offsetInBytes + 2144 return _typeddata._getUint16(offsetInBytes +
2145 (index * Uint16List.BYTES_PER_ELEMENT)); 2145 (index * Uint16List.BYTES_PER_ELEMENT));
2146 } 2146 }
2147 2147
2148 void operator[]=(int index, int value) { 2148 void operator[]=(int index, int value) {
2149 if (index < 0 || index >= length) { 2149 if (index < 0 || index >= length) {
2150 String message = "$index must be in the range [0..$length)"; 2150 String message = "$index must be in the range [0..$length)";
2151 throw new RangeError(message); 2151 throw new RangeError(message);
2152 } 2152 }
2153 _typeddata.setUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT), 2153 _typeddata._setUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT) ,
2154 _toUint16(value)); 2154 _toUint16(value));
2155 } 2155 }
2156 2156
2157 Iterator<int> get iterator { 2157 Iterator<int> get iterator {
2158 return new _TypedListIterator<int>(this); 2158 return new _TypedListIterator<int>(this);
2159 } 2159 }
2160 2160
2161 2161
2162 // Method(s) implementing TypedData interface. 2162 // Method(s) implementing TypedData interface.
2163 2163
2164 int get elementSizeInBytes { 2164 int get elementSizeInBytes {
(...skipping 15 matching lines...) Expand all
2180 } 2180 }
2181 2181
2182 2182
2183 // Method(s) implementing List interface. 2183 // Method(s) implementing List interface.
2184 2184
2185 int operator[](int index) { 2185 int operator[](int index) {
2186 if (index < 0 || index >= length) { 2186 if (index < 0 || index >= length) {
2187 String message = "$index must be in the range [0..$length)"; 2187 String message = "$index must be in the range [0..$length)";
2188 throw new RangeError(message); 2188 throw new RangeError(message);
2189 } 2189 }
2190 return _typeddata.getInt32(offsetInBytes + 2190 return _typeddata._getInt32(offsetInBytes +
2191 (index * Int32List.BYTES_PER_ELEMENT)); 2191 (index * Int32List.BYTES_PER_ELEMENT));
2192 } 2192 }
2193 2193
2194 void operator[]=(int index, int value) { 2194 void operator[]=(int index, int value) {
2195 if (index < 0 || index >= length) { 2195 if (index < 0 || index >= length) {
2196 String message = "$index must be in the range [0..$length)"; 2196 String message = "$index must be in the range [0..$length)";
2197 throw new RangeError(message); 2197 throw new RangeError(message);
2198 } 2198 }
2199 _typeddata.setInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT), 2199 _typeddata._setInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT),
2200 _toInt32(value)); 2200 _toInt32(value));
2201 } 2201 }
2202 2202
2203 Iterator<int> get iterator { 2203 Iterator<int> get iterator {
2204 return new _TypedListIterator<int>(this); 2204 return new _TypedListIterator<int>(this);
2205 } 2205 }
2206 2206
2207 2207
2208 // Method(s) implementing TypedData interface. 2208 // Method(s) implementing TypedData interface.
2209 2209
2210 int get elementSizeInBytes { 2210 int get elementSizeInBytes {
(...skipping 15 matching lines...) Expand all
2226 } 2226 }
2227 2227
2228 2228
2229 // Method(s) implementing List interface. 2229 // Method(s) implementing List interface.
2230 2230
2231 int operator[](int index) { 2231 int operator[](int index) {
2232 if (index < 0 || index >= length) { 2232 if (index < 0 || index >= length) {
2233 String message = "$index must be in the range [0..$length)"; 2233 String message = "$index must be in the range [0..$length)";
2234 throw new RangeError(message); 2234 throw new RangeError(message);
2235 } 2235 }
2236 return _typeddata.getUint32(offsetInBytes + 2236 return _typeddata._getUint32(offsetInBytes +
2237 (index * Uint32List.BYTES_PER_ELEMENT)); 2237 (index * Uint32List.BYTES_PER_ELEMENT));
2238 } 2238 }
2239 2239
2240 void operator[]=(int index, int value) { 2240 void operator[]=(int index, int value) {
2241 if (index < 0 || index >= length) { 2241 if (index < 0 || index >= length) {
2242 String message = "$index must be in the range [0..$length)"; 2242 String message = "$index must be in the range [0..$length)";
2243 throw new RangeError(message); 2243 throw new RangeError(message);
2244 } 2244 }
2245 _typeddata.setUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT), 2245 _typeddata._setUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT) ,
2246 _toUint32(value)); 2246 _toUint32(value));
2247 } 2247 }
2248 2248
2249 Iterator<int> get iterator { 2249 Iterator<int> get iterator {
2250 return new _TypedListIterator<int>(this); 2250 return new _TypedListIterator<int>(this);
2251 } 2251 }
2252 2252
2253 2253
2254 // Method(s) implementing TypedData interface. 2254 // Method(s) implementing TypedData interface.
2255 2255
2256 int get elementSizeInBytes { 2256 int get elementSizeInBytes {
(...skipping 15 matching lines...) Expand all
2272 } 2272 }
2273 2273
2274 2274
2275 // Method(s) implementing List interface. 2275 // Method(s) implementing List interface.
2276 2276
2277 int operator[](int index) { 2277 int operator[](int index) {
2278 if (index < 0 || index >= length) { 2278 if (index < 0 || index >= length) {
2279 String message = "$index must be in the range [0..$length)"; 2279 String message = "$index must be in the range [0..$length)";
2280 throw new RangeError(message); 2280 throw new RangeError(message);
2281 } 2281 }
2282 return _typeddata.getInt64(offsetInBytes + 2282 return _typeddata._getInt64(offsetInBytes +
2283 (index * Int64List.BYTES_PER_ELEMENT)); 2283 (index * Int64List.BYTES_PER_ELEMENT));
2284 } 2284 }
2285 2285
2286 void operator[]=(int index, int value) { 2286 void operator[]=(int index, int value) {
2287 if (index < 0 || index >= length) { 2287 if (index < 0 || index >= length) {
2288 String message = "$index must be in the range [0..$length)"; 2288 String message = "$index must be in the range [0..$length)";
2289 throw new RangeError(message); 2289 throw new RangeError(message);
2290 } 2290 }
2291 _typeddata.setInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT), 2291 _typeddata._setInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT),
2292 _toInt64(value)); 2292 _toInt64(value));
2293 } 2293 }
2294 2294
2295 Iterator<int> get iterator { 2295 Iterator<int> get iterator {
2296 return new _TypedListIterator<int>(this); 2296 return new _TypedListIterator<int>(this);
2297 } 2297 }
2298 2298
2299 2299
2300 // Method(s) implementing TypedData interface. 2300 // Method(s) implementing TypedData interface.
2301 2301
2302 int get elementSizeInBytes { 2302 int get elementSizeInBytes {
(...skipping 15 matching lines...) Expand all
2318 } 2318 }
2319 2319
2320 2320
2321 // Method(s) implementing List interface. 2321 // Method(s) implementing List interface.
2322 2322
2323 int operator[](int index) { 2323 int operator[](int index) {
2324 if (index < 0 || index >= length) { 2324 if (index < 0 || index >= length) {
2325 String message = "$index must be in the range [0..$length)"; 2325 String message = "$index must be in the range [0..$length)";
2326 throw new RangeError(message); 2326 throw new RangeError(message);
2327 } 2327 }
2328 return _typeddata.getUint64(offsetInBytes + 2328 return _typeddata._getUint64(offsetInBytes +
2329 (index * Uint64List.BYTES_PER_ELEMENT)); 2329 (index * Uint64List.BYTES_PER_ELEMENT));
2330 } 2330 }
2331 2331
2332 void operator[]=(int index, int value) { 2332 void operator[]=(int index, int value) {
2333 if (index < 0 || index >= length) { 2333 if (index < 0 || index >= length) {
2334 String message = "$index must be in the range [0..$length)"; 2334 String message = "$index must be in the range [0..$length)";
2335 throw new RangeError(message); 2335 throw new RangeError(message);
2336 } 2336 }
2337 _typeddata.setUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT), 2337 _typeddata._setUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT) ,
2338 _toUint64(value)); 2338 _toUint64(value));
2339 } 2339 }
2340 2340
2341 Iterator<int> get iterator { 2341 Iterator<int> get iterator {
2342 return new _TypedListIterator<int>(this); 2342 return new _TypedListIterator<int>(this);
2343 } 2343 }
2344 2344
2345 2345
2346 // Method(s) implementing TypedData interface. 2346 // Method(s) implementing TypedData interface.
2347 2347
2348 int get elementSizeInBytes { 2348 int get elementSizeInBytes {
(...skipping 15 matching lines...) Expand all
2364 } 2364 }
2365 2365
2366 2366
2367 // Method(s) implementing List interface. 2367 // Method(s) implementing List interface.
2368 2368
2369 double operator[](int index) { 2369 double operator[](int index) {
2370 if (index < 0 || index >= length) { 2370 if (index < 0 || index >= length) {
2371 String message = "$index must be in the range [0..$length)"; 2371 String message = "$index must be in the range [0..$length)";
2372 throw new RangeError(message); 2372 throw new RangeError(message);
2373 } 2373 }
2374 return _typeddata.getFloat32(offsetInBytes + 2374 return _typeddata._getFloat32(offsetInBytes +
2375 (index * Float32List.BYTES_PER_ELEMENT)); 2375 (index * Float32List.BYTES_PER_ELEMENT));
2376 } 2376 }
2377 2377
2378 void operator[]=(int index, double value) { 2378 void operator[]=(int index, double value) {
2379 if (index < 0 || index >= length) { 2379 if (index < 0 || index >= length) {
2380 String message = "$index must be in the range [0..$length)"; 2380 String message = "$index must be in the range [0..$length)";
2381 throw new RangeError(message); 2381 throw new RangeError(message);
2382 } 2382 }
2383 _typeddata.setFloat32(offsetInBytes + 2383 _typeddata._setFloat32(offsetInBytes +
2384 (index * Float32List.BYTES_PER_ELEMENT), value); 2384 (index * Float32List.BYTES_PER_ELEMENT), value);
2385 } 2385 }
2386 2386
2387 Iterator<double> get iterator { 2387 Iterator<double> get iterator {
2388 return new _TypedListIterator<double>(this); 2388 return new _TypedListIterator<double>(this);
2389 } 2389 }
2390 2390
2391 2391
2392 // Method(s) implementing TypedData interface. 2392 // Method(s) implementing TypedData interface.
2393 2393
2394 int get elementSizeInBytes { 2394 int get elementSizeInBytes {
(...skipping 15 matching lines...) Expand all
2410 } 2410 }
2411 2411
2412 2412
2413 // Method(s) implementing List interface. 2413 // Method(s) implementing List interface.
2414 2414
2415 double operator[](int index) { 2415 double operator[](int index) {
2416 if (index < 0 || index >= length) { 2416 if (index < 0 || index >= length) {
2417 String message = "$index must be in the range [0..$length)"; 2417 String message = "$index must be in the range [0..$length)";
2418 throw new RangeError(message); 2418 throw new RangeError(message);
2419 } 2419 }
2420 return _typeddata.getFloat64(offsetInBytes + 2420 return _typeddata._getFloat64(offsetInBytes +
2421 (index * Float64List.BYTES_PER_ELEMENT)); 2421 (index * Float64List.BYTES_PER_ELEMENT));
2422 } 2422 }
2423 2423
2424 void operator[]=(int index, double value) { 2424 void operator[]=(int index, double value) {
2425 if (index < 0 || index >= length) { 2425 if (index < 0 || index >= length) {
2426 String message = "$index must be in the range [0..$length)"; 2426 String message = "$index must be in the range [0..$length)";
2427 throw new RangeError(message); 2427 throw new RangeError(message);
2428 } 2428 }
2429 _typeddata.setFloat64(offsetInBytes + 2429 _typeddata._setFloat64(offsetInBytes +
2430 (index * Float64List.BYTES_PER_ELEMENT), value); 2430 (index * Float64List.BYTES_PER_ELEMENT), value);
2431 } 2431 }
2432 2432
2433 Iterator<double> get iterator { 2433 Iterator<double> get iterator {
2434 return new _TypedListIterator<double>(this); 2434 return new _TypedListIterator<double>(this);
2435 } 2435 }
2436 2436
2437 2437
2438 // Method(s) implementing TypedData interface. 2438 // Method(s) implementing TypedData interface.
2439 2439
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 } 2611 }
2612 } 2612 }
2613 2613
2614 2614
2615 int _defaultIfNull(object, value) { 2615 int _defaultIfNull(object, value) {
2616 if (object == null) { 2616 if (object == null) {
2617 return value; 2617 return value;
2618 } 2618 }
2619 return object; 2619 return object;
2620 } 2620 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698