mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:01:42 +00:00
Changes to patch files to make them strong-clean
This is a partial list, there are still 8 issues remaining, most of them in js_number.dart, one that is not but the FE is not giving me a location for some reason. Change-Id: I2bd1d24256147e255f487e100ce800c3ba791ce5 Reviewed-on: https://dart-review.googlesource.com/42122 Reviewed-by: Stephen Adams <sra@google.com> Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
parent
0e4d4b3116
commit
e6e6efc3bc
|
@ -203,16 +203,25 @@ class Event {
|
|||
*/
|
||||
|
||||
/// Registers an event listener <em>callback</em> to an event.
|
||||
void addListener(Function callback) => JS('void', '#.addListener(#)',
|
||||
this._jsObject, convertDartClosureToJS(callback, this._callbackArity));
|
||||
void addListener(covariant Function callback) => JS(
|
||||
'void',
|
||||
'#.addListener(#)',
|
||||
this._jsObject,
|
||||
convertDartClosureToJS(callback, this._callbackArity));
|
||||
|
||||
/// Deregisters an event listener <em>callback</em> from an event.
|
||||
void removeListener(Function callback) => JS('void', '#.removeListener(#)',
|
||||
this._jsObject, convertDartClosureToJS(callback, this._callbackArity));
|
||||
void removeListener(covariant Function callback) => JS(
|
||||
'void',
|
||||
'#.removeListener(#)',
|
||||
this._jsObject,
|
||||
convertDartClosureToJS(callback, this._callbackArity));
|
||||
|
||||
/// Returns True if <em>callback</em> is registered to the event.
|
||||
bool hasListener(Function callback) => JS('bool', '#.hasListener(#)',
|
||||
this._jsObject, convertDartClosureToJS(callback, this._callbackArity));
|
||||
bool hasListener(covariant Function callback) => JS(
|
||||
'bool',
|
||||
'#.hasListener(#)',
|
||||
this._jsObject,
|
||||
convertDartClosureToJS(callback, this._callbackArity));
|
||||
|
||||
/// Returns true if any event listeners are registered to the event.
|
||||
bool hasListeners() => JS('bool', '#.hasListeners()', this._jsObject);
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
|
||||
part of _js_helper;
|
||||
|
||||
class ConstantMapView<K, V> extends UnmodifiableMapView implements ConstantMap {
|
||||
ConstantMapView(Map base) : super(base);
|
||||
class ConstantMapView<K, V> extends UnmodifiableMapView<K, V>
|
||||
implements ConstantMap<K, V> {
|
||||
ConstantMapView(Map<K, V> base) : super(base);
|
||||
}
|
||||
|
||||
abstract class ConstantMap<K, V> implements Map<K, V> {
|
||||
|
@ -65,7 +66,7 @@ abstract class ConstantMap<K, V> implements Map<K, V> {
|
|||
|
||||
void operator []=(K key, V val) => _throwUnmodifiable();
|
||||
V putIfAbsent(K key, V ifAbsent()) => _throwUnmodifiable();
|
||||
V remove(K key) => _throwUnmodifiable();
|
||||
V remove(Object key) => _throwUnmodifiable();
|
||||
void clear() => _throwUnmodifiable();
|
||||
void addAll(Map<K, V> other) => _throwUnmodifiable();
|
||||
|
||||
|
@ -112,7 +113,7 @@ class ConstantStringMap<K, V> extends ConstantMap<K, V> {
|
|||
final List<K> _keys;
|
||||
|
||||
int get length => JS('JSUInt31', '#', _length);
|
||||
List get _keysArray => JS('JSUnmodifiableArray', '#', _keys);
|
||||
List<K> get _keysArray => JS('JSUnmodifiableArray', '#', _keys);
|
||||
|
||||
bool containsValue(Object needle) {
|
||||
return values.any((V value) => value == needle);
|
||||
|
|
|
@ -419,7 +419,8 @@ class String {
|
|||
factory String.fromCharCodes(Iterable<int> charCodes,
|
||||
[int start = 0, int end]) {
|
||||
if (charCodes is JSArray) {
|
||||
return _stringFromJSArray(charCodes, start, end);
|
||||
JSArray<int> array = charCodes;
|
||||
return _stringFromJSArray(array, start, end);
|
||||
}
|
||||
if (charCodes is NativeUint8List) {
|
||||
return _stringFromUint8List(charCodes, start, end);
|
||||
|
|
|
@ -182,6 +182,8 @@ external T JS<T>(String typeDescription, String codeTemplate,
|
|||
external IsolateContext JS_CURRENT_ISOLATE_CONTEXT();
|
||||
|
||||
abstract class IsolateContext {
|
||||
int get id;
|
||||
|
||||
/// Holds a (native) JavaScript instance of Isolate, see
|
||||
/// finishIsolateConstructorFunction in emitter.dart.
|
||||
get isolateStatics;
|
||||
|
|
|
@ -44,7 +44,7 @@ class _Serializer {
|
|||
if (x is NativeByteBuffer) return serializeByteBuffer(x);
|
||||
if (x is NativeTypedData) return serializeTypedData(x);
|
||||
if (x is JSIndexable) return serializeJSIndexable(x);
|
||||
if (x is InternalMap) return serializeMap(x);
|
||||
if (x is InternalMap) return serializeMap(x as dynamic);
|
||||
|
||||
if (x is JSObject) return serializeJSObject(x);
|
||||
|
||||
|
|
|
@ -427,7 +427,7 @@ class JSArray<E> extends Interceptor implements List<E>, JSIndexable {
|
|||
if (length == 0) return;
|
||||
RangeError.checkNotNegative(skipCount, 'skipCount');
|
||||
|
||||
List otherList;
|
||||
List<E> otherList;
|
||||
int otherStart;
|
||||
// TODO(floitsch): Make this accept more.
|
||||
if (iterable is List) {
|
||||
|
|
|
@ -215,8 +215,10 @@ class JsIsolateMirror extends JsMirror implements IsolateMirror {
|
|||
bool get isCurrent => JS_CURRENT_ISOLATE_CONTEXT() == _isolateContext;
|
||||
|
||||
LibraryMirror get rootLibrary {
|
||||
return currentJsMirrorSystem.libraries.values
|
||||
.firstWhere((JsLibraryMirror library) => library._isRoot);
|
||||
return currentJsMirrorSystem.libraries.values.firstWhere((LibraryMirror l) {
|
||||
JsLibraryMirror library = l;
|
||||
return library._isRoot;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,7 +391,7 @@ class JsLibraryMirror extends JsDeclarationMirror
|
|||
InstanceMirror setField(Symbol fieldName, Object arg) {
|
||||
String name = n(fieldName);
|
||||
if (name.endsWith('=')) throw new ArgumentError('');
|
||||
var mirror = __functions[s('$name=')];
|
||||
dynamic mirror = __functions[s('$name=')];
|
||||
if (mirror == null) mirror = __variables[fieldName];
|
||||
if (mirror == null) {
|
||||
throw new NoSuchStaticMethodError.method(
|
||||
|
@ -1360,7 +1362,7 @@ class JsTypeBoundClassMirror extends JsDeclarationMirror
|
|||
|
||||
List<TypeMirror> get typeArguments {
|
||||
if (_cachedTypeArguments != null) return _cachedTypeArguments;
|
||||
List result = new List();
|
||||
var result = <TypeMirror>[];
|
||||
|
||||
addTypeArgument(String typeArgument) {
|
||||
int parsedIndex = int.parse(typeArgument, onError: (_) => -1);
|
||||
|
@ -1498,12 +1500,16 @@ class JsTypeBoundClassMirror extends JsDeclarationMirror
|
|||
var instance = _class._getInvokedInstance(
|
||||
constructorName, positionalArguments, namedArguments);
|
||||
return reflect(setRuntimeTypeInfo(
|
||||
instance, typeArguments.map((t) => t._asRuntimeType()).toList()));
|
||||
instance, typeArguments.map(_toRuntimeType).toList()));
|
||||
}
|
||||
|
||||
_asRuntimeType() {
|
||||
return [_class._jsConstructor]
|
||||
.addAll(typeArguments.map((t) => t._asRuntimeType()));
|
||||
return [_class._jsConstructor].addAll(typeArguments.map(_toRuntimeType));
|
||||
}
|
||||
|
||||
static _toRuntimeType(TypeMirror t) {
|
||||
JsTypeMirror typeMirror = t;
|
||||
return typeMirror._asRuntimeType();
|
||||
}
|
||||
|
||||
JsLibraryMirror get owner => _class.owner;
|
||||
|
@ -1744,9 +1750,9 @@ class JsClassMirror extends JsTypeMirror
|
|||
List<VariableMirror> _getFieldsWithOwner(DeclarationMirror fieldOwner) {
|
||||
var result = <VariableMirror>[];
|
||||
|
||||
var instanceFieldSpecfication = _fieldsDescriptor.split(';')[1];
|
||||
dynamic instanceFieldSpecfication = _fieldsDescriptor.split(';')[1];
|
||||
if (_fieldsMetadata != null) {
|
||||
instanceFieldSpecfication = [instanceFieldSpecfication]
|
||||
instanceFieldSpecfication = <dynamic>[instanceFieldSpecfication]
|
||||
..addAll(_fieldsMetadata);
|
||||
}
|
||||
parseCompactFieldSpecification(
|
||||
|
@ -2071,7 +2077,7 @@ class JsClassMirror extends JsTypeMirror
|
|||
|
||||
List<TypeVariableMirror> get typeVariables {
|
||||
if (_cachedTypeVariables != null) return _cachedTypeVariables;
|
||||
List result = new List();
|
||||
var result = new List<TypeVariableMirror>();
|
||||
List typeVariables =
|
||||
JS('JSExtendableArray|Null', '#.prototype["<>"]', _jsConstructor);
|
||||
if (typeVariables == null) return result;
|
||||
|
@ -2297,7 +2303,7 @@ class JsClosureMirror extends JsInstanceMirror implements ClosureMirror {
|
|||
Function.apply(reflectee, positionalArguments, namedArguments));
|
||||
}
|
||||
|
||||
TypeMirror get type {
|
||||
ClassMirror get type {
|
||||
// Classes that implement [call] do not subclass [Closure], but only
|
||||
// implement [Function], so are rejected by this test.
|
||||
if (reflectee is Closure) {
|
||||
|
@ -2403,7 +2409,7 @@ class JsMethodMirror extends JsDeclarationMirror implements MethodMirror {
|
|||
List<InstanceMirror> get metadata {
|
||||
if (_metadata == null) {
|
||||
var raw = extractMetadata(_jsFunction);
|
||||
var formals = new List(_parameterCount);
|
||||
var formals = new List<ParameterMirror>(_parameterCount);
|
||||
ReflectionInfo info = new ReflectionInfo(_jsFunction);
|
||||
if (info != null) {
|
||||
assert(_parameterCount ==
|
||||
|
@ -2733,7 +2739,7 @@ class JsFunctionTypeMirror extends BrokenClassMirror
|
|||
|
||||
List<ParameterMirror> get parameters {
|
||||
if (_cachedParameters != null) return _cachedParameters;
|
||||
List result = [];
|
||||
var result = <ParameterMirror>[];
|
||||
int parameterCount = 0;
|
||||
if (_hasArguments) {
|
||||
for (var type in _arguments) {
|
||||
|
@ -2898,7 +2904,7 @@ TypeMirror typeMirrorFromRuntimeTypeRepresentation(
|
|||
return 'dynamic';
|
||||
}
|
||||
}
|
||||
return typeArgument._mangledName;
|
||||
return (typeArgument as dynamic)._mangledName;
|
||||
}
|
||||
|
||||
representation =
|
||||
|
@ -2936,7 +2942,7 @@ List extractMetadata(victim) {
|
|||
return JSArray
|
||||
.markFixedList(JS('JSExtendableArray',
|
||||
r'#.$reflectionInfo.splice(#.$metadataIndex)', victim, victim))
|
||||
.map((int i) => getMetadata(i))
|
||||
.map((i) => getMetadata(i))
|
||||
.toList();
|
||||
}
|
||||
return const [];
|
||||
|
|
|
@ -82,7 +82,10 @@ class TypeVariable {
|
|||
const TypeVariable(this.owner, this.name, this.bound);
|
||||
}
|
||||
|
||||
getMangledTypeName(TypeImpl type) => type._typeName;
|
||||
getMangledTypeName(Type t) {
|
||||
TypeImpl type = t;
|
||||
return type._typeName;
|
||||
}
|
||||
|
||||
/// Sets the runtime type information on [target]. [rti] is a type
|
||||
/// representation of type 4 or 5, that is, either a JavaScript array or `null`.
|
||||
|
|
|
@ -450,7 +450,7 @@ class NativeByteData extends NativeTypedData implements ByteData {
|
|||
* Throws [RangeError] if [byteOffset] is negative, or
|
||||
* `byteOffset + 4` is greater than the length of this object.
|
||||
*/
|
||||
num getFloat32(int byteOffset, [Endian endian = Endian.big]) =>
|
||||
double getFloat32(int byteOffset, [Endian endian = Endian.big]) =>
|
||||
_getFloat32(byteOffset, Endian.little == endian);
|
||||
|
||||
@JSName('getFloat32')
|
||||
|
@ -465,7 +465,7 @@ class NativeByteData extends NativeTypedData implements ByteData {
|
|||
* Throws [RangeError] if [byteOffset] is negative, or
|
||||
* `byteOffset + 8` is greater than the length of this object.
|
||||
*/
|
||||
num getFloat64(int byteOffset, [Endian endian = Endian.big]) =>
|
||||
double getFloat64(int byteOffset, [Endian endian = Endian.big]) =>
|
||||
_getFloat64(byteOffset, Endian.little == endian);
|
||||
|
||||
@JSName('getFloat64')
|
||||
|
|
|
@ -190,7 +190,7 @@ class JsObject {
|
|||
// the arguments list passed to apply().
|
||||
// After that, use the JavaScript 'new' operator which overrides any binding
|
||||
// of 'this' with the new instance.
|
||||
var args = [null]..addAll(arguments.map(_convertToJS));
|
||||
var args = <dynamic>[null]..addAll(arguments.map(_convertToJS));
|
||||
var factoryFunction = JS('', '#.bind.apply(#, #)', constr, constr, args);
|
||||
// Without this line, calling factoryFunction as a constructor throws
|
||||
JS('String', 'String(#)', factoryFunction);
|
||||
|
@ -503,7 +503,8 @@ class JsArray<E> extends JsObject with ListMixin<E> {
|
|||
int length = end - start;
|
||||
if (length == 0) return;
|
||||
if (skipCount < 0) throw new ArgumentError(skipCount);
|
||||
var args = [start, length]..addAll(iterable.skip(skipCount).take(length));
|
||||
var args = <dynamic>[start, length]
|
||||
..addAll(iterable.skip(skipCount).take(length));
|
||||
callMethod('splice', args);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ callConstructor(Function constr, List arguments) {
|
|||
// the arguments list passed to apply().
|
||||
// After that, use the JavaScript 'new' operator which overrides any binding
|
||||
// of 'this' with the new instance.
|
||||
var args = [null]..addAll(arguments);
|
||||
var args = <dynamic>[null]..addAll(arguments);
|
||||
var factoryFunction = JS('', '#.bind.apply(#, #)', constr, constr, args);
|
||||
// Without this line, calling factoryFunction as a constructor throws
|
||||
JS('String', 'String(#)', factoryFunction);
|
||||
|
|
Loading…
Reference in a new issue