mirror of
https://github.com/dart-lang/sdk
synced 2024-10-15 00:10:36 +00:00
Add some ArgumentError and RangeError constructors that capture more information.
Switch some uses of RangeError.range to RangeError.index. Fix bug in Queue where elementAt allowed `length` as input. R=sgjesse@google.com Review URL: https://codereview.chromium.org//711003002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41653 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
bc1972c228
commit
42dac4c7b4
|
@ -32,12 +32,12 @@ abstract class _TypedDataBuffer<E> extends ListBase<E> {
|
||||||
|
|
||||||
int get length => _length;
|
int get length => _length;
|
||||||
E operator[](int index) {
|
E operator[](int index) {
|
||||||
if (index >= length) throw new RangeError.range(index, 0, length - 1);
|
if (index >= length) throw new RangeError.index(index, this);
|
||||||
return _buffer[index];
|
return _buffer[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator[]=(int index, E value) {
|
void operator[]=(int index, E value) {
|
||||||
if (index >= length) throw new RangeError.range(index, 0, length - 1);
|
if (index >= length) throw new RangeError.index(index, this);
|
||||||
_buffer[index] = value;
|
_buffer[index] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: typed_data
|
name: typed_data
|
||||||
version: 1.0.0
|
version: 1.0.1-dev
|
||||||
author: Dart Team <misc@dartlang.org>
|
author: Dart Team <misc@dartlang.org>
|
||||||
description: Utility functions and classes related to the 'dart:typed_data' library.
|
description: Utility functions and classes related to the 'dart:typed_data' library.
|
||||||
homepage: http://www.dartlang.org
|
homepage: http://www.dartlang.org
|
||||||
|
|
|
@ -149,7 +149,7 @@ class NativeFloat32x4List
|
||||||
|
|
||||||
void _invalidIndex(int index, int length) {
|
void _invalidIndex(int index, int length) {
|
||||||
if (index < 0 || index >= length) {
|
if (index < 0 || index >= length) {
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
} else {
|
} else {
|
||||||
throw new ArgumentError('Invalid list index $index');
|
throw new ArgumentError('Invalid list index $index');
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ class NativeInt32x4List
|
||||||
|
|
||||||
void _invalidIndex(int index, int length) {
|
void _invalidIndex(int index, int length) {
|
||||||
if (index < 0 || index >= length) {
|
if (index < 0 || index >= length) {
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
} else {
|
} else {
|
||||||
throw new ArgumentError('Invalid list index $index');
|
throw new ArgumentError('Invalid list index $index');
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ class NativeFloat64x2List
|
||||||
|
|
||||||
void _invalidIndex(int index, int length) {
|
void _invalidIndex(int index, int length) {
|
||||||
if (index < 0 || index >= length) {
|
if (index < 0 || index >= length) {
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
} else {
|
} else {
|
||||||
throw new ArgumentError('Invalid list index $index');
|
throw new ArgumentError('Invalid list index $index');
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ class NativeTypedData implements TypedData {
|
||||||
|
|
||||||
void _invalidIndex(int index, int length) {
|
void _invalidIndex(int index, int length) {
|
||||||
if (index < 0 || index >= length) {
|
if (index < 0 || index >= length) {
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
} else {
|
} else {
|
||||||
throw new ArgumentError('Invalid list index $index');
|
throw new ArgumentError('Invalid list index $index');
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,8 +427,8 @@ class ListQueue<E> extends IterableBase<E> implements Queue<E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
E elementAt(int index) {
|
E elementAt(int index) {
|
||||||
if (index < 0 || index > length) {
|
if (index < 0 || index >= length) {
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
}
|
}
|
||||||
return _table[(_head + index) & (_table.length - 1)];
|
return _table[(_head + index) & (_table.length - 1)];
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,10 +292,10 @@ class _SimpleAsciiDecoderSink extends ByteConversionSinkBase {
|
||||||
void addSlice(List<int> source, int start, int end, bool isLast) {
|
void addSlice(List<int> source, int start, int end, bool isLast) {
|
||||||
final int length = source.length;
|
final int length = source.length;
|
||||||
if (start < 0 || start > length) {
|
if (start < 0 || start > length) {
|
||||||
throw new RangeError.range(start, 0, length - 1);
|
throw new RangeError.range(start, 0, length);
|
||||||
}
|
}
|
||||||
if (end < start || end > length) {
|
if (end < start || end > length) {
|
||||||
throw new RangeError.range(end, start, length - 1);
|
throw new RangeError.range(end, start, length);
|
||||||
}
|
}
|
||||||
if (start < end) {
|
if (start < end) {
|
||||||
if (start != 0 || end != length) {
|
if (start != 0 || end != length) {
|
||||||
|
|
|
@ -159,16 +159,67 @@ class NullThrownError extends Error {
|
||||||
* Error thrown when a function is passed an unacceptable argument.
|
* Error thrown when a function is passed an unacceptable argument.
|
||||||
*/
|
*/
|
||||||
class ArgumentError extends Error {
|
class ArgumentError extends Error {
|
||||||
|
/** Whether value was provided. */
|
||||||
|
final bool _hasValue;
|
||||||
|
/** The invalid value. */
|
||||||
|
final invalidValue;
|
||||||
|
/** Name of the invalid argument, if available. */
|
||||||
|
final String name;
|
||||||
|
/** Message describing the problem. */
|
||||||
final message;
|
final message;
|
||||||
|
|
||||||
/** The [message] describes the erroneous argument. */
|
/**
|
||||||
ArgumentError([this.message]);
|
* The [message] describes the erroneous argument.
|
||||||
|
*
|
||||||
|
* Existing code may be using `message` to hold the invalid value.
|
||||||
|
* If the `message` is not a [String], it is assumed to be a value instead
|
||||||
|
* of a message.
|
||||||
|
*/
|
||||||
|
ArgumentError([this.message])
|
||||||
|
: invalidValue = null,
|
||||||
|
_hasValue = false,
|
||||||
|
name = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates error containing the invalid [value].
|
||||||
|
*
|
||||||
|
* A message is built by suffixing the [message] argument with
|
||||||
|
* the [name] argument (if provided) and the value. Example
|
||||||
|
*
|
||||||
|
* "Invalid argument (foo): null"
|
||||||
|
*
|
||||||
|
* The `name` should match the argument name of the function, but if
|
||||||
|
* the function is a method implementing an interface, and its argument
|
||||||
|
* names differ from the interface, it might be more useful to use the
|
||||||
|
* interface method's argument name (or just rename arguments to match).
|
||||||
|
*/
|
||||||
|
ArgumentError.value(value,
|
||||||
|
[String this.name,
|
||||||
|
String this.message = "Invalid argument"])
|
||||||
|
: invalidValue = value,
|
||||||
|
_hasValue = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an argument error for a `null` argument that must not be `null`.
|
||||||
|
*
|
||||||
|
* Shorthand for calling [ArgumentError.value] with a `null` value and a
|
||||||
|
* message of `"Must not be null"`.
|
||||||
|
*/
|
||||||
|
ArgumentError.notNull([String name])
|
||||||
|
: this.value(null, name, "Must not be null");
|
||||||
|
|
||||||
String toString() {
|
String toString() {
|
||||||
if (message != null) {
|
if (!_hasValue) {
|
||||||
return "Illegal argument(s): $message";
|
if (message != null) {
|
||||||
|
return "Invalid argument(s): $message";
|
||||||
|
}
|
||||||
|
return "Invalid argument(s)";
|
||||||
}
|
}
|
||||||
return "Illegal argument(s)";
|
String nameString = "";
|
||||||
|
if (name != null) {
|
||||||
|
nameString = " ($name)";
|
||||||
|
}
|
||||||
|
return "$message$nameString: ${Error.safeToString(invalidValue)}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,25 +227,115 @@ class ArgumentError extends Error {
|
||||||
* Error thrown due to an index being outside a valid range.
|
* Error thrown due to an index being outside a valid range.
|
||||||
*/
|
*/
|
||||||
class RangeError extends ArgumentError {
|
class RangeError extends ArgumentError {
|
||||||
|
/** The value that is outside its valid range. */
|
||||||
|
final num invalidValue;
|
||||||
|
/** The minimum value that [value] is allowed to assume. */
|
||||||
|
final num start;
|
||||||
|
/** The maximum value that [value] is allowed to assume. */
|
||||||
|
final num end;
|
||||||
|
|
||||||
// TODO(lrn): This constructor should be called only with string values.
|
// TODO(lrn): This constructor should be called only with string values.
|
||||||
// It currently isn't in all cases.
|
// It currently isn't in all cases.
|
||||||
/**
|
/**
|
||||||
* Create a new [RangeError] with the given [message].
|
* Create a new [RangeError] with the given [message].
|
||||||
*/
|
*/
|
||||||
RangeError(var message) : super(message);
|
RangeError(var message)
|
||||||
|
: invalidValue = null, start = null, end = null, super(message);
|
||||||
|
|
||||||
/** Create a new [RangeError] with a message for the given [value]. */
|
/** Create a new [RangeError] with a message for the given [value]. */
|
||||||
RangeError.value(num value) : super("value $value");
|
RangeError.value(num value, [String message = "Value not in range"])
|
||||||
|
: invalidValue = value, start = null, end = null,
|
||||||
|
super(message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new [RangeError] with a message for a value and a range.
|
* Create a new [RangeError] with for an invalid value being outside a range.
|
||||||
*
|
*
|
||||||
* The allowed range is from [start] to [end], inclusive.
|
* The allowed range is from [start] to [end], inclusive.
|
||||||
|
* If `start` or `end` are `null`, the range is infinite in that direction.
|
||||||
|
*
|
||||||
|
* For a range from 0 to the length of something, end exclusive, use
|
||||||
|
* [RangeError.index].
|
||||||
*/
|
*/
|
||||||
RangeError.range(num value, num start, num end)
|
RangeError.range(this.invalidValue, this.start, this.end,
|
||||||
: super("value $value not in range $start..$end");
|
[String message = "Invalid value"]) : super(message);
|
||||||
|
|
||||||
String toString() => "RangeError: $message";
|
/**
|
||||||
|
* Creates a new [RangeError] stating that [index] is not a valid index
|
||||||
|
* into [indexable].
|
||||||
|
*
|
||||||
|
* The [length] is the length of [indexable] at the time of the error.
|
||||||
|
* If `length` is omitted, it defaults to `indexable.length`.
|
||||||
|
*
|
||||||
|
* The message is used as part of the string representation of the error.
|
||||||
|
*/
|
||||||
|
factory RangeError.index(int index, indexable,
|
||||||
|
[String message,
|
||||||
|
int length]) = IndexError;
|
||||||
|
|
||||||
|
String toString() {
|
||||||
|
if (invalidValue == null) return "$message";
|
||||||
|
String value = Error.safeToString(invalidValue);
|
||||||
|
if (start == null) {
|
||||||
|
if (end == null) {
|
||||||
|
return "$message ($value)";
|
||||||
|
}
|
||||||
|
return "$message ($value): Value must be less than or equal to $end";
|
||||||
|
}
|
||||||
|
if (end == null) {
|
||||||
|
return "$message ($value): Value must be greater than or equal to $start";
|
||||||
|
}
|
||||||
|
if (end > start) {
|
||||||
|
return "$message ($value): Value must be in range $start..$end, "
|
||||||
|
"inclusive.";
|
||||||
|
}
|
||||||
|
if (end < start) return "$message ($value): Valid range is empty";
|
||||||
|
return "$message ($value): Only valid value is $start";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A specialized [RangeError] used when an index is not in the range
|
||||||
|
* `0..indexable.length-1`.
|
||||||
|
*
|
||||||
|
* Also contains the indexable object, its length at the time of the error,
|
||||||
|
* and the invalid index itself.
|
||||||
|
*/
|
||||||
|
class IndexError extends ArgumentError implements RangeError {
|
||||||
|
/** The indexable object that [index] was not a valid index into. */
|
||||||
|
final indexable;
|
||||||
|
/** The invalid index. */
|
||||||
|
final int invalidValue;
|
||||||
|
/** The length of [indexable] at the time of the error. */
|
||||||
|
final int length;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new [IndexError] stating that [invalidValue] is not a valid index
|
||||||
|
* into [indexable].
|
||||||
|
*
|
||||||
|
* The [length] is the length of [indexable] at the time of the error.
|
||||||
|
* If `length` is omitted, it defaults to `indexable.length`.
|
||||||
|
*
|
||||||
|
* The message is used as part of the string representation of the error.
|
||||||
|
*/
|
||||||
|
IndexError(indexable, this.invalidValue,
|
||||||
|
[String message = "Index out of range", int length])
|
||||||
|
: this.indexable = indexable,
|
||||||
|
this.length = (length != null) ? length : indexable.length,
|
||||||
|
super(message);
|
||||||
|
|
||||||
|
// Getters inherited from RangeError.
|
||||||
|
int get start => 0;
|
||||||
|
int get end => length - 1;
|
||||||
|
|
||||||
|
String toString() {
|
||||||
|
String target = Error.safeToString(indexable);
|
||||||
|
if (invalidValue < 0) {
|
||||||
|
return "RangeError: $message ($target[$invalidValue]): "
|
||||||
|
"index must not be negative.";
|
||||||
|
}
|
||||||
|
return "RangeError: $message: ($target[$invalidValue]): "
|
||||||
|
"index should be less than $length.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -678,7 +678,7 @@ class RuneIterator implements BidirectionalIterator<int> {
|
||||||
*/
|
*/
|
||||||
void set rawIndex(int rawIndex) {
|
void set rawIndex(int rawIndex) {
|
||||||
if (rawIndex >= string.length) {
|
if (rawIndex >= string.length) {
|
||||||
throw new RangeError.range(rawIndex, 0, string.length - 1);
|
throw new RangeError.index(rawIndex, string);
|
||||||
}
|
}
|
||||||
reset(rawIndex);
|
reset(rawIndex);
|
||||||
moveNext();
|
moveNext();
|
||||||
|
|
|
@ -9222,7 +9222,7 @@ class DomStringList extends Interceptor with ListMixin<String>, ImmutableListMix
|
||||||
String operator[](int index) {
|
String operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("String", "#[#]", this, index);
|
return JS("String", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, String value) {
|
void operator[]=(int index, String value) {
|
||||||
|
@ -14250,7 +14250,7 @@ class FileList extends Interceptor with ListMixin<File>, ImmutableListMixin<File
|
||||||
File operator[](int index) {
|
File operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("File", "#[#]", this, index);
|
return JS("File", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, File value) {
|
void operator[]=(int index, File value) {
|
||||||
|
@ -16108,7 +16108,7 @@ class HtmlCollection extends Interceptor with ListMixin<Node>, ImmutableListMixi
|
||||||
Node operator[](int index) {
|
Node operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("Node", "#[#]", this, index);
|
return JS("Node", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, Node value) {
|
void operator[]=(int index, Node value) {
|
||||||
|
@ -20802,7 +20802,7 @@ class MimeTypeArray extends Interceptor with ListMixin<MimeType>, ImmutableListM
|
||||||
MimeType operator[](int index) {
|
MimeType operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("MimeType", "#[#]", this, index);
|
return JS("MimeType", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, MimeType value) {
|
void operator[]=(int index, MimeType value) {
|
||||||
|
@ -22354,7 +22354,7 @@ class NodeList extends Interceptor with ListMixin<Node>, ImmutableListMixin<Node
|
||||||
Node operator[](int index) {
|
Node operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("Node", "#[#]", this, index);
|
return JS("Node", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, Node value) {
|
void operator[]=(int index, Node value) {
|
||||||
|
@ -23533,7 +23533,7 @@ class PluginArray extends Interceptor with ListMixin<Plugin>, ImmutableListMixin
|
||||||
Plugin operator[](int index) {
|
Plugin operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("Plugin", "#[#]", this, index);
|
return JS("Plugin", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, Plugin value) {
|
void operator[]=(int index, Plugin value) {
|
||||||
|
@ -25917,7 +25917,7 @@ class SourceBufferList extends EventTarget with ListMixin<SourceBuffer>, Immutab
|
||||||
SourceBuffer operator[](int index) {
|
SourceBuffer operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("SourceBuffer", "#[#]", this, index);
|
return JS("SourceBuffer", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, SourceBuffer value) {
|
void operator[]=(int index, SourceBuffer value) {
|
||||||
|
@ -26123,7 +26123,7 @@ class SpeechGrammarList extends Interceptor with ListMixin<SpeechGrammar>, Immut
|
||||||
SpeechGrammar operator[](int index) {
|
SpeechGrammar operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("SpeechGrammar", "#[#]", this, index);
|
return JS("SpeechGrammar", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, SpeechGrammar value) {
|
void operator[]=(int index, SpeechGrammar value) {
|
||||||
|
@ -27988,7 +27988,7 @@ class TextTrackCueList extends Interceptor with ListMixin<TextTrackCue>, Immutab
|
||||||
TextTrackCue operator[](int index) {
|
TextTrackCue operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("TextTrackCue", "#[#]", this, index);
|
return JS("TextTrackCue", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, TextTrackCue value) {
|
void operator[]=(int index, TextTrackCue value) {
|
||||||
|
@ -28073,7 +28073,7 @@ class TextTrackList extends EventTarget with ListMixin<TextTrack>, ImmutableList
|
||||||
TextTrack operator[](int index) {
|
TextTrack operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("TextTrack", "#[#]", this, index);
|
return JS("TextTrack", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, TextTrack value) {
|
void operator[]=(int index, TextTrack value) {
|
||||||
|
@ -28474,7 +28474,7 @@ class TouchList extends Interceptor with ListMixin<Touch>, ImmutableListMixin<To
|
||||||
Touch operator[](int index) {
|
Touch operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("Touch", "#[#]", this, index);
|
return JS("Touch", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, Touch value) {
|
void operator[]=(int index, Touch value) {
|
||||||
|
@ -32729,7 +32729,7 @@ class _ClientRectList extends Interceptor with ListMixin<Rectangle>, ImmutableLi
|
||||||
Rectangle operator[](int index) {
|
Rectangle operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("Rectangle", "#[#]", this, index);
|
return JS("Rectangle", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, Rectangle value) {
|
void operator[]=(int index, Rectangle value) {
|
||||||
|
@ -32807,7 +32807,7 @@ class _CssRuleList extends Interceptor with ListMixin<CssRule>, ImmutableListMix
|
||||||
CssRule operator[](int index) {
|
CssRule operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("CssRule", "#[#]", this, index);
|
return JS("CssRule", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, CssRule value) {
|
void operator[]=(int index, CssRule value) {
|
||||||
|
@ -32873,7 +32873,7 @@ class _CssValueList extends _CSSValue with ListMixin<_CSSValue>, ImmutableListMi
|
||||||
_CSSValue operator[](int index) {
|
_CSSValue operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("_CSSValue", "#[#]", this, index);
|
return JS("_CSSValue", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, _CSSValue value) {
|
void operator[]=(int index, _CSSValue value) {
|
||||||
|
@ -33177,7 +33177,7 @@ class _GamepadList extends Interceptor with ListMixin<Gamepad>, ImmutableListMix
|
||||||
Gamepad operator[](int index) {
|
Gamepad operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("Gamepad", "#[#]", this, index);
|
return JS("Gamepad", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, Gamepad value) {
|
void operator[]=(int index, Gamepad value) {
|
||||||
|
@ -33405,7 +33405,7 @@ class _NamedNodeMap extends Interceptor with ListMixin<Node>, ImmutableListMixin
|
||||||
Node operator[](int index) {
|
Node operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("Node", "#[#]", this, index);
|
return JS("Node", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, Node value) {
|
void operator[]=(int index, Node value) {
|
||||||
|
@ -33671,7 +33671,7 @@ class _SpeechRecognitionResultList extends Interceptor with ListMixin<SpeechReco
|
||||||
SpeechRecognitionResult operator[](int index) {
|
SpeechRecognitionResult operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("SpeechRecognitionResult", "#[#]", this, index);
|
return JS("SpeechRecognitionResult", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, SpeechRecognitionResult value) {
|
void operator[]=(int index, SpeechRecognitionResult value) {
|
||||||
|
@ -33735,7 +33735,7 @@ class _StyleSheetList extends Interceptor with ListMixin<StyleSheet>, ImmutableL
|
||||||
StyleSheet operator[](int index) {
|
StyleSheet operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return JS("StyleSheet", "#[#]", this, index);
|
return JS("StyleSheet", "#[#]", this, index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, StyleSheet value) {
|
void operator[]=(int index, StyleSheet value) {
|
||||||
|
|
|
@ -10207,7 +10207,7 @@ class DomStringList extends NativeFieldWrapperClass2 with ListMixin<String>, Imm
|
||||||
|
|
||||||
String operator[](int index) {
|
String operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkDOMStringList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkDOMStringList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15085,7 +15085,7 @@ class FileList extends NativeFieldWrapperClass2 with ListMixin<File>, ImmutableL
|
||||||
|
|
||||||
File operator[](int index) {
|
File operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkFileList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkFileList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16993,7 +16993,7 @@ class HtmlCollection extends NativeFieldWrapperClass2 with ListMixin<Node>, Immu
|
||||||
|
|
||||||
Node operator[](int index) {
|
Node operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkHTMLCollection.instance.item_Callback_1_(this, index);
|
return _blink.BlinkHTMLCollection.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22836,7 +22836,7 @@ class MimeTypeArray extends NativeFieldWrapperClass2 with ListMixin<MimeType>, I
|
||||||
|
|
||||||
MimeType operator[](int index) {
|
MimeType operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkMimeTypeArray.instance.item_Callback_1_(this, index);
|
return _blink.BlinkMimeTypeArray.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24422,7 +24422,7 @@ class NodeList extends NativeFieldWrapperClass2 with ListMixin<Node>, ImmutableL
|
||||||
|
|
||||||
Node operator[](int index) {
|
Node operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkNodeList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkNodeList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25722,7 +25722,7 @@ class PluginArray extends NativeFieldWrapperClass2 with ListMixin<Plugin>, Immut
|
||||||
|
|
||||||
Plugin operator[](int index) {
|
Plugin operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkPluginArray.instance.item_Callback_1_(this, index);
|
return _blink.BlinkPluginArray.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28178,7 +28178,7 @@ class SourceBufferList extends EventTarget with ListMixin<SourceBuffer>, Immutab
|
||||||
|
|
||||||
SourceBuffer operator[](int index) {
|
SourceBuffer operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkSourceBufferList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkSourceBufferList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28429,7 +28429,7 @@ class SpeechGrammarList extends NativeFieldWrapperClass2 with ListMixin<SpeechGr
|
||||||
|
|
||||||
SpeechGrammar operator[](int index) {
|
SpeechGrammar operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkSpeechGrammarList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkSpeechGrammarList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30474,7 +30474,7 @@ class TextTrackCueList extends NativeFieldWrapperClass2 with ListMixin<TextTrack
|
||||||
|
|
||||||
TextTrackCue operator[](int index) {
|
TextTrackCue operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkTextTrackCueList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkTextTrackCueList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30563,7 +30563,7 @@ class TextTrackList extends EventTarget with ListMixin<TextTrack>, ImmutableList
|
||||||
|
|
||||||
TextTrack operator[](int index) {
|
TextTrack operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkTextTrackList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkTextTrackList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30994,7 +30994,7 @@ class TouchList extends NativeFieldWrapperClass2 with ListMixin<Touch>, Immutabl
|
||||||
|
|
||||||
Touch operator[](int index) {
|
Touch operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkTouchList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkTouchList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31406,10 +31406,10 @@ class Url extends NativeFieldWrapperClass2 implements UrlUtils {
|
||||||
if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
|
if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
|
||||||
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
|
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
|
||||||
}
|
}
|
||||||
if ((blob_OR_source_OR_stream is MediaSource)) {
|
if ((blob_OR_source_OR_stream is MediaStream)) {
|
||||||
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
|
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
|
||||||
}
|
}
|
||||||
if ((blob_OR_source_OR_stream is MediaStream)) {
|
if ((blob_OR_source_OR_stream is MediaSource)) {
|
||||||
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
|
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
|
||||||
}
|
}
|
||||||
throw new ArgumentError("Incorrect number or type of arguments");
|
throw new ArgumentError("Incorrect number or type of arguments");
|
||||||
|
@ -35096,7 +35096,7 @@ class _ClientRectList extends NativeFieldWrapperClass2 with ListMixin<Rectangle>
|
||||||
|
|
||||||
Rectangle operator[](int index) {
|
Rectangle operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkClientRectList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkClientRectList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35180,7 +35180,7 @@ class _CssRuleList extends NativeFieldWrapperClass2 with ListMixin<CssRule>, Imm
|
||||||
|
|
||||||
CssRule operator[](int index) {
|
CssRule operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkCSSRuleList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkCSSRuleList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35250,7 +35250,7 @@ class _CssValueList extends _CSSValue with ListMixin<_CSSValue>, ImmutableListMi
|
||||||
|
|
||||||
_CSSValue operator[](int index) {
|
_CSSValue operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkCSSValueList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkCSSValueList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35592,7 +35592,7 @@ class _GamepadList extends NativeFieldWrapperClass2 with ListMixin<Gamepad>, Imm
|
||||||
|
|
||||||
Gamepad operator[](int index) {
|
Gamepad operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkGamepadList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkGamepadList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35836,7 +35836,7 @@ class _NamedNodeMap extends NativeFieldWrapperClass2 with ListMixin<Node>, Immut
|
||||||
|
|
||||||
Node operator[](int index) {
|
Node operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkNamedNodeMap.instance.item_Callback_1_(this, index);
|
return _blink.BlinkNamedNodeMap.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36114,7 +36114,7 @@ class _SpeechRecognitionResultList extends NativeFieldWrapperClass2 with ListMix
|
||||||
|
|
||||||
SpeechRecognitionResult operator[](int index) {
|
SpeechRecognitionResult operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkSpeechRecognitionResultList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkSpeechRecognitionResultList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36182,7 +36182,7 @@ class _StyleSheetList extends NativeFieldWrapperClass2 with ListMixin<StyleSheet
|
||||||
|
|
||||||
StyleSheet operator[](int index) {
|
StyleSheet operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkStyleSheetList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkStyleSheetList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,7 @@ class _ListIndicesIterable extends ListIterable<int> {
|
||||||
int get length => _backedList.length;
|
int get length => _backedList.length;
|
||||||
int elementAt(int index) {
|
int elementAt(int index) {
|
||||||
if (index < 0 || index >= length) {
|
if (index < 0 || index >= length) {
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2683,7 +2683,7 @@ class LengthList extends Interceptor with ListMixin<Length>, ImmutableListMixin<
|
||||||
Length operator[](int index) {
|
Length operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return this.getItem(index);
|
return this.getItem(index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, Length value) {
|
void operator[]=(int index, Length value) {
|
||||||
|
@ -3135,7 +3135,7 @@ class NumberList extends Interceptor with ListMixin<Number>, ImmutableListMixin<
|
||||||
Number operator[](int index) {
|
Number operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return this.getItem(index);
|
return this.getItem(index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, Number value) {
|
void operator[]=(int index, Number value) {
|
||||||
|
@ -3922,7 +3922,7 @@ class PathSegList extends Interceptor with ListMixin<PathSeg>, ImmutableListMixi
|
||||||
PathSeg operator[](int index) {
|
PathSeg operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return this.getItem(index);
|
return this.getItem(index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, PathSeg value) {
|
void operator[]=(int index, PathSeg value) {
|
||||||
|
@ -4617,7 +4617,7 @@ class StringList extends Interceptor with ListMixin<String>, ImmutableListMixin<
|
||||||
String operator[](int index) {
|
String operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return this.getItem(index);
|
return this.getItem(index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, String value) {
|
void operator[]=(int index, String value) {
|
||||||
|
@ -6077,7 +6077,7 @@ class TransformList extends Interceptor with ListMixin<Transform>, ImmutableList
|
||||||
Transform operator[](int index) {
|
Transform operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return this.getItem(index);
|
return this.getItem(index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, Transform value) {
|
void operator[]=(int index, Transform value) {
|
||||||
|
|
|
@ -2955,7 +2955,7 @@ class LengthList extends NativeFieldWrapperClass2 with ListMixin<Length>, Immuta
|
||||||
|
|
||||||
Length operator[](int index) {
|
Length operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return getItem(index);
|
return getItem(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3447,7 +3447,7 @@ class NumberList extends NativeFieldWrapperClass2 with ListMixin<Number>, Immuta
|
||||||
|
|
||||||
Number operator[](int index) {
|
Number operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return getItem(index);
|
return getItem(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4471,7 +4471,7 @@ class PathSegList extends NativeFieldWrapperClass2 with ListMixin<PathSeg>, Immu
|
||||||
|
|
||||||
PathSeg operator[](int index) {
|
PathSeg operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return getItem(index);
|
return getItem(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5241,7 +5241,7 @@ class StringList extends NativeFieldWrapperClass2 with ListMixin<String>, Immuta
|
||||||
|
|
||||||
String operator[](int index) {
|
String operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return getItem(index);
|
return getItem(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6753,7 +6753,7 @@ class TransformList extends NativeFieldWrapperClass2 with ListMixin<Transform>,
|
||||||
|
|
||||||
Transform operator[](int index) {
|
Transform operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return getItem(index);
|
return getItem(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ class SqlResultSetRowList extends Interceptor with ListMixin<Map>, ImmutableList
|
||||||
Map operator[](int index) {
|
Map operator[](int index) {
|
||||||
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
if (JS("bool", "# >>> 0 !== # || # >= #", index,
|
||||||
index, index, length))
|
index, index, length))
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return this.item(index);
|
return this.item(index);
|
||||||
}
|
}
|
||||||
void operator[]=(int index, Map value) {
|
void operator[]=(int index, Map value) {
|
||||||
|
|
|
@ -252,7 +252,7 @@ class SqlResultSetRowList extends NativeFieldWrapperClass2 with ListMixin<Map>,
|
||||||
|
|
||||||
Map operator[](int index) {
|
Map operator[](int index) {
|
||||||
if (index < 0 || index >= length)
|
if (index < 0 || index >= length)
|
||||||
throw new RangeError.range(index, 0, length);
|
throw new RangeError.index(index, this);
|
||||||
return _blink.BlinkSQLResultSetRowList.instance.item_Callback_1_(this, index);
|
return _blink.BlinkSQLResultSetRowList.instance.item_Callback_1_(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,6 +260,11 @@ abstract class QueueTest {
|
||||||
Expect.equals(N, queue.length);
|
Expect.equals(N, queue.length);
|
||||||
Expect.isFalse(queue.isEmpty);
|
Expect.isFalse(queue.isEmpty);
|
||||||
|
|
||||||
|
Expect.equals(0, queue.elementAt(0));
|
||||||
|
Expect.equals(N - 1, queue.elementAt(N - 1));
|
||||||
|
Expect.throws(() { queue.elementAt(-1); });
|
||||||
|
Expect.throws(() { queue.elementAt(N); });
|
||||||
|
|
||||||
Iterable skip1 = queue.skip(1);
|
Iterable skip1 = queue.skip(1);
|
||||||
Iterable take1 = queue.take(1);
|
Iterable take1 = queue.take(1);
|
||||||
Iterable mapped = queue.map((e) => -e);
|
Iterable mapped = queue.map((e) => -e);
|
||||||
|
|
|
@ -788,7 +788,7 @@ class Dart2JSBackend(HtmlDartGenerator):
|
||||||
' $TYPE operator[](int index) {\n'
|
' $TYPE operator[](int index) {\n'
|
||||||
' if (JS("bool", "# >>> 0 !== # || # >= #", index,\n'
|
' if (JS("bool", "# >>> 0 !== # || # >= #", index,\n'
|
||||||
' index, index, length))\n'
|
' index, index, length))\n'
|
||||||
' throw new RangeError.range(index, 0, length);\n'
|
' throw new RangeError.index(index, this);\n'
|
||||||
' return $INDEXED_GETTER;\n'
|
' return $INDEXED_GETTER;\n'
|
||||||
' }',
|
' }',
|
||||||
INDEXED_GETTER=indexed_getter,
|
INDEXED_GETTER=indexed_getter,
|
||||||
|
@ -1241,7 +1241,7 @@ class DartLibrary():
|
||||||
imports_emitter, map_emitter = emitters
|
imports_emitter, map_emitter = emitters
|
||||||
else:
|
else:
|
||||||
imports_emitter, map_emitter = emitters, None
|
imports_emitter, map_emitter = emitters, None
|
||||||
|
|
||||||
|
|
||||||
for path in sorted(self._paths):
|
for path in sorted(self._paths):
|
||||||
relpath = os.path.relpath(path, library_file_dir)
|
relpath = os.path.relpath(path, library_file_dir)
|
||||||
|
@ -1256,7 +1256,7 @@ class DartLibrary():
|
||||||
" '$IDL_NAME': () => $DART_NAME,\n",
|
" '$IDL_NAME': () => $DART_NAME,\n",
|
||||||
IDL_NAME=idl_name,
|
IDL_NAME=idl_name,
|
||||||
DART_NAME=dart_name)
|
DART_NAME=dart_name)
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,7 @@ def EncodeType(t):
|
||||||
class DartiumBackend(HtmlDartGenerator):
|
class DartiumBackend(HtmlDartGenerator):
|
||||||
"""Generates Dart implementation for one DOM IDL interface."""
|
"""Generates Dart implementation for one DOM IDL interface."""
|
||||||
|
|
||||||
def __init__(self, interface,
|
def __init__(self, interface,
|
||||||
cpp_library_emitter, options):
|
cpp_library_emitter, options):
|
||||||
super(DartiumBackend, self).__init__(interface, options, True)
|
super(DartiumBackend, self).__init__(interface, options, True)
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ class DartiumBackend(HtmlDartGenerator):
|
||||||
|
|
||||||
constructor_callback_cpp_name = 'constructorCallback'
|
constructor_callback_cpp_name = 'constructorCallback'
|
||||||
self._EmitConstructorInfrastructure(
|
self._EmitConstructorInfrastructure(
|
||||||
constructor_info, "", constructor_callback_cpp_name, '_create',
|
constructor_info, "", constructor_callback_cpp_name, '_create',
|
||||||
is_custom=True)
|
is_custom=True)
|
||||||
|
|
||||||
self._cpp_declarations_emitter.Emit(
|
self._cpp_declarations_emitter.Emit(
|
||||||
|
@ -686,10 +686,10 @@ class DartiumBackend(HtmlDartGenerator):
|
||||||
return IsOptional(argument)
|
return IsOptional(argument)
|
||||||
|
|
||||||
def EmitStaticFactoryOverload(self, constructor_info, name, arguments):
|
def EmitStaticFactoryOverload(self, constructor_info, name, arguments):
|
||||||
constructor_callback_cpp_name = name + 'constructorCallback'
|
constructor_callback_cpp_name = name + 'constructorCallback'
|
||||||
self._EmitConstructorInfrastructure(
|
self._EmitConstructorInfrastructure(
|
||||||
constructor_info, name, 'constructorCallback', name, arguments,
|
constructor_info, name, 'constructorCallback', name, arguments,
|
||||||
emit_to_native=True,
|
emit_to_native=True,
|
||||||
is_custom=False)
|
is_custom=False)
|
||||||
|
|
||||||
ext_attrs = self._interface.ext_attrs
|
ext_attrs = self._interface.ext_attrs
|
||||||
|
@ -1048,7 +1048,7 @@ class DartiumBackend(HtmlDartGenerator):
|
||||||
'\n'
|
'\n'
|
||||||
' $TYPE operator[](int index) {\n'
|
' $TYPE operator[](int index) {\n'
|
||||||
' if (index < 0 || index >= length)\n'
|
' if (index < 0 || index >= length)\n'
|
||||||
' throw new RangeError.range(index, 0, length);\n'
|
' throw new RangeError.index(index, this);\n'
|
||||||
' return $(DART_NATIVE_NAME)(this, index);\n'
|
' return $(DART_NATIVE_NAME)(this, index);\n'
|
||||||
' }\n\n'
|
' }\n\n'
|
||||||
' $TYPE _nativeIndexedGetter(int index) =>'
|
' $TYPE _nativeIndexedGetter(int index) =>'
|
||||||
|
@ -1106,7 +1106,7 @@ class DartiumBackend(HtmlDartGenerator):
|
||||||
'\n'
|
'\n'
|
||||||
' $TYPE operator[](int index) {\n'
|
' $TYPE operator[](int index) {\n'
|
||||||
' if (index < 0 || index >= length)\n'
|
' if (index < 0 || index >= length)\n'
|
||||||
' throw new RangeError.range(index, 0, length);\n'
|
' throw new RangeError.index(index, this);\n'
|
||||||
' return $INDEXED_GETTER(index);\n'
|
' return $INDEXED_GETTER(index);\n'
|
||||||
' }\n',
|
' }\n',
|
||||||
TYPE=dart_element_type,
|
TYPE=dart_element_type,
|
||||||
|
@ -1120,7 +1120,7 @@ class DartiumBackend(HtmlDartGenerator):
|
||||||
formals = ', '.join(['int index', '%s value' % element_type])
|
formals = ', '.join(['int index', '%s value' % element_type])
|
||||||
parameters = ['index', 'value']
|
parameters = ['index', 'value']
|
||||||
dart_declaration = 'void operator[]=(%s)' % formals
|
dart_declaration = 'void operator[]=(%s)' % formals
|
||||||
self._GenerateNativeBinding('numericIndexSetter', 3,
|
self._GenerateNativeBinding('numericIndexSetter', 3,
|
||||||
dart_declaration, False, return_type, parameters,
|
dart_declaration, False, return_type, parameters,
|
||||||
'Callback', True, False)
|
'Callback', True, False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue