chore: dartfmt Dart code in the repo

This commit is contained in:
Kevin Moore
2015-05-08 19:51:19 -07:00
parent a5638a940c
commit 7844e3a275
27 changed files with 252 additions and 332 deletions

View File

@ -15,7 +15,10 @@ class BaseQueryList extends Object with IterableMixin<Directive> {
List _callbacks;
bool _dirty;
BaseQueryList(): _results = [], _callbacks = [], _dirty = false;
BaseQueryList()
: _results = [],
_callbacks = [],
_dirty = false;
Iterator<Directive> get iterator => _results.iterator;

View File

@ -10,16 +10,14 @@ import 'dart:js' as js;
// Proxies a Dart function that accepts up to 10 parameters.
js.JsFunction _jsFunction(Function fn) {
const Object X = __varargSentinel;
return new js.JsFunction.withThis(
(thisArg, [o1=X, o2=X, o3=X, o4=X, o5=X, o6=X, o7=X, o8=X, o9=X, o10=X]) {
return __invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10);
});
return new js.JsFunction.withThis((thisArg, [o1 = X, o2 = X, o3 = X, o4 = X,
o5 = X, o6 = X, o7 = X, o8 = X, o9 = X, o10 = X]) {
return __invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10);
});
}
const Object __varargSentinel = const Object();
__invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10) {
var args = [o1, o2, o3, o4, o5, o6, o7, o8, o9, o10];
while (args.length > 0 && identical(args.last, __varargSentinel)) {
@ -28,7 +26,6 @@ __invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10) {
return _jsify(Function.apply(fn, args));
}
// Helper function to JSify a Dart object. While this is *required* to JSify
// the result of a scope.eval(), other uses are not required and are used to
// work around http://dartbug.com/17752 in a convenient way (that bug affects
@ -44,8 +41,9 @@ _jsify(var obj) {
return _jsFunction(obj);
}
if ((obj is Map) || (obj is Iterable)) {
var mappedObj = (obj is Map) ?
new Map.fromIterables(obj.keys, obj.values.map(_jsify)) : obj.map(_jsify);
var mappedObj = (obj is Map)
? new Map.fromIterables(obj.keys, obj.values.map(_jsify))
: obj.map(_jsify);
if (obj is List) {
return new js.JsArray.from(mappedObj);
} else {
@ -75,10 +73,9 @@ class PublicTestability implements _JsObjectProxyable {
js.JsObject _toJsObject() {
return _jsify({
'findBindings': (bindingString, [exactMatch, allowNonElementNodes]) =>
findBindings(bindingString, exactMatch, allowNonElementNodes),
'whenStable': (callback) =>
whenStable(() => callback.apply([])),
'findBindings': (bindingString, [exactMatch, allowNonElementNodes]) =>
findBindings(bindingString, exactMatch, allowNonElementNodes),
'whenStable': (callback) => whenStable(() => callback.apply([])),
})..['_dart_'] = this;
}
}
@ -86,8 +83,8 @@ class PublicTestability implements _JsObjectProxyable {
class GetTestability {
static addToWindow(TestabilityRegistry registry) {
js.context['getAngularTestability'] = _jsify((Element elem) {
Testability testability = registry.findTestabilityInTree(elem);
return _jsify(new PublicTestability(testability));
});
Testability testability = registry.findTestabilityInTree(elem);
return _jsify(new PublicTestability(testability));
});
}
}

View File

@ -52,7 +52,8 @@ class VmTurnZone {
* @param {Function} onScheduleMicrotask
* @param {Function} onErrorHandler called when an exception is thrown by a macro or micro task
*/
initCallbacks({Function onTurnStart, Function onTurnDone, Function onScheduleMicrotask, Function onErrorHandler}) {
initCallbacks({Function onTurnStart, Function onTurnDone,
Function onScheduleMicrotask, Function onErrorHandler}) {
this._onTurnStart = onTurnStart;
this._onTurnDone = onTurnDone;
this._onScheduleMicrotask = onScheduleMicrotask;
@ -111,17 +112,19 @@ class VmTurnZone {
}
async.Zone _createInnerZone(async.Zone zone) {
return zone.fork(specification: new async.ZoneSpecification(
run: _onRun,
runUnary: _onRunUnary,
scheduleMicrotask: _onMicrotask
));
return zone.fork(
specification: new async.ZoneSpecification(
run: _onRun,
runUnary: _onRunUnary,
scheduleMicrotask: _onMicrotask));
}
dynamic _onRunBase(async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn()) {
dynamic _onRunBase(
async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn()) {
_nestedRunCounter++;
try {
if (_nestedRunCounter == 1 && _onTurnStart != null) delegate.run(zone, _onTurnStart);
if (_nestedRunCounter == 1 && _onTurnStart != null) delegate.run(
zone, _onTurnStart);
return fn();
} catch (e, s) {
if (_onErrorHandler != null && _nestedRunCounter == 1) {
@ -131,21 +134,24 @@ class VmTurnZone {
}
} finally {
_nestedRunCounter--;
if (_nestedRunCounter == 0 && _onTurnDone != null) _finishTurn(zone, delegate);
if (_nestedRunCounter == 0 && _onTurnDone != null) _finishTurn(
zone, delegate);
}
}
dynamic _onRun(async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn()) =>
_onRunBase(self, delegate, zone, () => delegate.run(zone, fn));
dynamic _onRun(async.Zone self, async.ZoneDelegate delegate, async.Zone zone,
fn()) => _onRunBase(self, delegate, zone, () => delegate.run(zone, fn));
dynamic _onRunUnary(async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn(args), args) =>
dynamic _onRunUnary(async.Zone self, async.ZoneDelegate delegate,
async.Zone zone, fn(args), args) =>
_onRunBase(self, delegate, zone, () => delegate.runUnary(zone, fn, args));
void _finishTurn(zone, delegate) {
delegate.run(zone, _onTurnDone);
}
_onMicrotask(async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn) {
_onMicrotask(
async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn) {
if (this._onScheduleMicrotask != null) {
_onScheduleMicrotask(fn);
} else {