style(dart): Format Dart source with dart_style 0.1.8

This commit is contained in:
Tim Blasi
2015-05-29 10:42:47 -07:00
parent eb2784eb81
commit ffb219fb91
17 changed files with 190 additions and 171 deletions

View File

@ -13,20 +13,16 @@ bool hasLifecycleHook(LifecycleEvent e, type, Directive annotation) {
if (e == onChange) {
interface = OnChange;
} else if (e == onDestroy) {
interface = OnDestroy;
} else if (e == onAllChangesDone) {
interface = OnAllChangesDone;
} else if (e == onCheck) {
interface = OnCheck;
} else if (e == onInit) {
interface = OnInit;
}
return interfaces.contains(interface);
}
}
}

View File

@ -52,15 +52,13 @@ class NgZone {
_mountZone = Zone.current;
if (enableLongStackTrace) {
_innerZone = Chain.capture(
() => _createInnerZone(Zone.current),
_innerZone = Chain.capture(() => _createInnerZone(Zone.current),
onError: _onErrorWithLongStackTrace);
} else {
_innerZone = _createInnerZone(
Zone.current,
handleUncaughtError: (Zone self, ZoneDelegate parent, Zone zone, error, StackTrace trace) =>
_onErrorWithoutLongStackTrace(error, trace)
);
_innerZone = _createInnerZone(Zone.current,
handleUncaughtError: (Zone self, ZoneDelegate parent, Zone zone,
error,
StackTrace trace) => _onErrorWithoutLongStackTrace(error, trace));
}
}
@ -75,7 +73,8 @@ class NgZone {
* @param {Function} onTurnDone called at the end of a VM turn if code has executed in the inner zone
* @param {Function} onErrorHandler called when an exception is thrown by a macro or micro task
*/
void initCallbacks({Function onTurnStart, Function onTurnDone, Function onErrorHandler}) {
void initCallbacks(
{Function onTurnStart, Function onTurnDone, Function onErrorHandler}) {
_onTurnStart = onTurnStart;
_onTurnDone = onTurnDone;
_onErrorHandler = onErrorHandler;
@ -158,10 +157,10 @@ class NgZone {
}
dynamic _runUnary(Zone self, ZoneDelegate parent, Zone zone, fn(arg), arg) =>
_run(self, parent, zone, () => fn(arg));
_run(self, parent, zone, () => fn(arg));
dynamic _runBinary(Zone self, ZoneDelegate parent, Zone zone, fn(arg1, arg2), arg1, arg2) =>
_run(self, parent, zone, () => fn(arg1, arg2));
dynamic _runBinary(Zone self, ZoneDelegate parent, Zone zone, fn(arg1, arg2),
arg1, arg2) => _run(self, parent, zone, () => fn(arg1, arg2));
void _scheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, fn) {
_pendingMicrotasks++;
@ -196,14 +195,12 @@ class NgZone {
Zone _createInnerZone(Zone zone, {handleUncaughtError}) {
return zone.fork(
specification: new ZoneSpecification(
scheduleMicrotask: _scheduleMicrotask,
run: _run,
runUnary: _runUnary,
runBinary: _runBinary,
handleUncaughtError: handleUncaughtError
),
zoneValues: {'_innerZone': true}
);
specification: new ZoneSpecification(
scheduleMicrotask: _scheduleMicrotask,
run: _run,
runUnary: _runUnary,
runBinary: _runBinary,
handleUncaughtError: handleUncaughtError),
zoneValues: {'_innerZone': true});
}
}

View File

@ -135,7 +135,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
MouseEvent createMouseEvent(String eventType) =>
new MouseEvent(eventType, canBubble: true);
Event createEvent(String eventType) => new Event(eventType, canBubble: true);
void preventDefault(Event evt) {
void preventDefault(Event evt) {
evt.preventDefault();
}
String getInnerHTML(Element el) => el.innerHtml;

View File

@ -76,7 +76,7 @@ class Html5LibDomAdapter implements DomAdapter {
createEvent(eventType) {
throw 'not implemented';
}
preventDefault(evt) {
preventDefault(evt) {
throw 'not implemented';
}
getInnerHTML(el) {

View File

@ -6,13 +6,8 @@ export 'dart:async' show Future, Stream, StreamController, StreamSubscription;
class PromiseWrapper {
static Future resolve(obj) => new Future.value(obj);
static Future reject(obj, stackTrace) => new Future.error(
obj,
stackTrace != null
? stackTrace
: obj is Error
? obj.stackTrace
: null);
static Future reject(obj, stackTrace) => new Future.error(obj,
stackTrace != null ? stackTrace : obj is Error ? obj.stackTrace : null);
static Future<List> all(List<Future> promises) => Future.wait(promises);
@ -35,15 +30,17 @@ class PromiseWrapper {
}
class TimerWrapper {
static Timer setTimeout(fn(), int millis)
=> new Timer(new Duration(milliseconds: millis), fn);
static Timer setTimeout(fn(), int millis) =>
new Timer(new Duration(milliseconds: millis), fn);
static void clearTimeout(Timer timer) {
timer.cancel();
}
static Timer setInterval(fn(), int millis) {
var interval = new Duration(milliseconds: millis);
return new Timer.periodic(interval, (Timer timer) { fn(); });
return new Timer.periodic(interval, (Timer timer) {
fn();
});
}
static void clearInterval(Timer timer) {
timer.cancel();

View File

@ -57,7 +57,9 @@ class ReflectionCapabilities {
List _convertParameter(ParameterMirror p) {
var t = p.type;
var res = (!t.hasReflectedType || t.reflectedType == dynamic) ? [] : [t.reflectedType];
var res = (!t.hasReflectedType || t.reflectedType == dynamic)
? []
: [t.reflectedType];
res.addAll(p.metadata.map((m) => m.reflectee));
return res;
}

View File

@ -8,10 +8,7 @@ import './xhr.dart' show XHR;
@Injectable()
class XHRImpl extends XHR {
Future<String> get(String url) {
return HttpRequest
.request(url)
.then((HttpRequest req) => req.responseText,
onError: (_) => new Future.error('Failed to load $url'));
return HttpRequest.request(url).then((HttpRequest req) => req.responseText,
onError: (_) => new Future.error('Failed to load $url'));
}
}

View File

@ -1,2 +1,3 @@
library angular2.e2e_util;
// empty as this file is node.js specific and should not be transpiled to dart
// empty as this file is node.js specific and should not be transpiled to dart

View File

@ -24,24 +24,33 @@ Function fakeAsync(Function fn) {
}
return ([a0 = _u, a1 = _u, a2 = _u, a3 = _u, a4 = _u, a5 = _u, a6 = _u,
a7 = _u, a8 = _u, a9 = _u]) {
a7 = _u, a8 = _u, a9 = _u]) {
// runZoned() to install a custom exception handler that re-throws
return runZoned(() {
new quiver.FakeAsync().run((quiver.FakeAsync async) {
try {
_fakeAsync = async;
List args = [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9]
.takeWhile((a) => a != _u).toList();
return Function.apply(fn , args);
List args = [
a0,
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9
].takeWhile((a) => a != _u).toList();
return Function.apply(fn, args);
} finally {
_fakeAsync = null;
}
});
},
zoneSpecification: new ZoneSpecification(
handleUncaughtError: (self, parent, zone, error, stackTrace)
=> throw error
));
zoneSpecification: new ZoneSpecification(
handleUncaughtError: (self, parent, zone, error, stackTrace) =>
throw error));
};
}

View File

@ -1,2 +1,3 @@
library angular2.perf_util;
// empty as this file is node.js specific and should not be transpiled to dart
// empty as this file is node.js specific and should not be transpiled to dart

View File

@ -190,7 +190,6 @@ class _DirectiveMetadataVisitor extends Object
'$propertyName.', '$expression' /* source */);
}
list.addAll(evaluated);
}
void _populateProperties(Expression propertiesValue) {