Skip to content

Commit 7844e3a

Browse files
committed
chore: dartfmt Dart code in the repo
1 parent a5638a9 commit 7844e3a

27 files changed

Lines changed: 254 additions & 334 deletions

File tree

modules/angular2/globals.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Globals are provided by lang.dart in Dart.
22
// This file exists to prevent global.ts from being transpiled.
3-
library angular2.globals;
3+
library angular2.globals;
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
library change_detectoin.change_detection_jit_generator;
22

33
class ChangeDetectorJITGenerator {
4-
ChangeDetectorJITGenerator(typeName, strategy, records, directiveMementos) {
5-
}
4+
ChangeDetectorJITGenerator(typeName, strategy, records, directiveMementos) {}
65

76
generate() {
87
throw "Jit Change Detection is not supported in Dart";
98
}
10-
}
9+
}

modules/angular2/src/core/compiler/base_query_list.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ class BaseQueryList extends Object with IterableMixin<Directive> {
1515
List _callbacks;
1616
bool _dirty;
1717

18-
BaseQueryList(): _results = [], _callbacks = [], _dirty = false;
18+
BaseQueryList()
19+
: _results = [],
20+
_callbacks = [],
21+
_dirty = false;
1922

2023
Iterator<Directive> get iterator => _results.iterator;
2124

modules/angular2/src/core/testability/get_testability.dart

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@ import 'dart:js' as js;
1010
// Proxies a Dart function that accepts up to 10 parameters.
1111
js.JsFunction _jsFunction(Function fn) {
1212
const Object X = __varargSentinel;
13-
return new js.JsFunction.withThis(
14-
(thisArg, [o1=X, o2=X, o3=X, o4=X, o5=X, o6=X, o7=X, o8=X, o9=X, o10=X]) {
15-
return __invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10);
16-
});
13+
return new js.JsFunction.withThis((thisArg, [o1 = X, o2 = X, o3 = X, o4 = X,
14+
o5 = X, o6 = X, o7 = X, o8 = X, o9 = X, o10 = X]) {
15+
return __invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10);
16+
});
1717
}
1818

19-
2019
const Object __varargSentinel = const Object();
2120

22-
2321
__invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10) {
2422
var args = [o1, o2, o3, o4, o5, o6, o7, o8, o9, o10];
2523
while (args.length > 0 && identical(args.last, __varargSentinel)) {
@@ -28,7 +26,6 @@ __invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10) {
2826
return _jsify(Function.apply(fn, args));
2927
}
3028

31-
3229
// Helper function to JSify a Dart object. While this is *required* to JSify
3330
// the result of a scope.eval(), other uses are not required and are used to
3431
// work around http://dartbug.com/17752 in a convenient way (that bug affects
@@ -44,8 +41,9 @@ _jsify(var obj) {
4441
return _jsFunction(obj);
4542
}
4643
if ((obj is Map) || (obj is Iterable)) {
47-
var mappedObj = (obj is Map) ?
48-
new Map.fromIterables(obj.keys, obj.values.map(_jsify)) : obj.map(_jsify);
44+
var mappedObj = (obj is Map)
45+
? new Map.fromIterables(obj.keys, obj.values.map(_jsify))
46+
: obj.map(_jsify);
4947
if (obj is List) {
5048
return new js.JsArray.from(mappedObj);
5149
} else {
@@ -75,19 +73,18 @@ class PublicTestability implements _JsObjectProxyable {
7573

7674
js.JsObject _toJsObject() {
7775
return _jsify({
78-
'findBindings': (bindingString, [exactMatch, allowNonElementNodes]) =>
79-
findBindings(bindingString, exactMatch, allowNonElementNodes),
80-
'whenStable': (callback) =>
81-
whenStable(() => callback.apply([])),
76+
'findBindings': (bindingString, [exactMatch, allowNonElementNodes]) =>
77+
findBindings(bindingString, exactMatch, allowNonElementNodes),
78+
'whenStable': (callback) => whenStable(() => callback.apply([])),
8279
})..['_dart_'] = this;
8380
}
8481
}
8582

8683
class GetTestability {
8784
static addToWindow(TestabilityRegistry registry) {
8885
js.context['getAngularTestability'] = _jsify((Element elem) {
89-
Testability testability = registry.findTestabilityInTree(elem);
90-
return _jsify(new PublicTestability(testability));
91-
});
86+
Testability testability = registry.findTestabilityInTree(elem);
87+
return _jsify(new PublicTestability(testability));
88+
});
9289
}
9390
}

modules/angular2/src/core/zone/vm_turn_zone.dart

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class VmTurnZone {
5252
* @param {Function} onScheduleMicrotask
5353
* @param {Function} onErrorHandler called when an exception is thrown by a macro or micro task
5454
*/
55-
initCallbacks({Function onTurnStart, Function onTurnDone, Function onScheduleMicrotask, Function onErrorHandler}) {
55+
initCallbacks({Function onTurnStart, Function onTurnDone,
56+
Function onScheduleMicrotask, Function onErrorHandler}) {
5657
this._onTurnStart = onTurnStart;
5758
this._onTurnDone = onTurnDone;
5859
this._onScheduleMicrotask = onScheduleMicrotask;
@@ -111,17 +112,19 @@ class VmTurnZone {
111112
}
112113

113114
async.Zone _createInnerZone(async.Zone zone) {
114-
return zone.fork(specification: new async.ZoneSpecification(
115-
run: _onRun,
116-
runUnary: _onRunUnary,
117-
scheduleMicrotask: _onMicrotask
118-
));
115+
return zone.fork(
116+
specification: new async.ZoneSpecification(
117+
run: _onRun,
118+
runUnary: _onRunUnary,
119+
scheduleMicrotask: _onMicrotask));
119120
}
120121

121-
dynamic _onRunBase(async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn()) {
122+
dynamic _onRunBase(
123+
async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn()) {
122124
_nestedRunCounter++;
123125
try {
124-
if (_nestedRunCounter == 1 && _onTurnStart != null) delegate.run(zone, _onTurnStart);
126+
if (_nestedRunCounter == 1 && _onTurnStart != null) delegate.run(
127+
zone, _onTurnStart);
125128
return fn();
126129
} catch (e, s) {
127130
if (_onErrorHandler != null && _nestedRunCounter == 1) {
@@ -131,21 +134,24 @@ class VmTurnZone {
131134
}
132135
} finally {
133136
_nestedRunCounter--;
134-
if (_nestedRunCounter == 0 && _onTurnDone != null) _finishTurn(zone, delegate);
137+
if (_nestedRunCounter == 0 && _onTurnDone != null) _finishTurn(
138+
zone, delegate);
135139
}
136140
}
137141

138-
dynamic _onRun(async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn()) =>
139-
_onRunBase(self, delegate, zone, () => delegate.run(zone, fn));
142+
dynamic _onRun(async.Zone self, async.ZoneDelegate delegate, async.Zone zone,
143+
fn()) => _onRunBase(self, delegate, zone, () => delegate.run(zone, fn));
140144

141-
dynamic _onRunUnary(async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn(args), args) =>
145+
dynamic _onRunUnary(async.Zone self, async.ZoneDelegate delegate,
146+
async.Zone zone, fn(args), args) =>
142147
_onRunBase(self, delegate, zone, () => delegate.runUnary(zone, fn, args));
143148

144149
void _finishTurn(zone, delegate) {
145150
delegate.run(zone, _onTurnDone);
146151
}
147152

148-
_onMicrotask(async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn) {
153+
_onMicrotask(
154+
async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn) {
149155
if (this._onScheduleMicrotask != null) {
150156
_onScheduleMicrotask(fn);
151157
} else {

modules/angular2/src/di/decorators.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ library angular2.di.decorators;
22

33
/* This file is empty because, Dart does not have decorators. */
44

5-
export 'annotations.dart';
5+
export 'annotations.dart';

modules/angular2/src/facade/async.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ class PromiseWrapper {
3333
}
3434

3535
class ObservableWrapper {
36-
static StreamSubscription subscribe(Stream s, Function onNext, [onError, onComplete]) {
37-
return s.listen(onNext, onError: onError, onDone: onComplete, cancelOnError: true);
36+
static StreamSubscription subscribe(Stream s, Function onNext,
37+
[onError, onComplete]) {
38+
return s.listen(onNext,
39+
onError: onError, onDone: onComplete, cancelOnError: true);
3840
}
3941

4042
static bool isObservable(obs) {
@@ -65,14 +67,10 @@ class EventEmitter extends Stream {
6567
_controller = new StreamController.broadcast();
6668
}
6769

68-
StreamSubscription listen(void onData(String line), {
69-
void onError(Error error),
70-
void onDone(),
71-
bool cancelOnError }) {
70+
StreamSubscription listen(void onData(String line),
71+
{void onError(Error error), void onDone(), bool cancelOnError}) {
7272
return _controller.stream.listen(onData,
73-
onError: onError,
74-
onDone: onDone,
75-
cancelOnError: cancelOnError);
73+
onError: onError, onDone: onDone, cancelOnError: cancelOnError);
7674
}
7775

7876
void add(value) {
@@ -88,7 +86,6 @@ class EventEmitter extends Stream {
8886
}
8987
}
9088

91-
9289
class _Completer {
9390
final Completer c;
9491

modules/angular2/src/facade/browser.dart

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ library angular2.src.facade.browser;
66

77
import 'dart:js' show context;
88

9-
export 'dart:html' show
10-
document,
11-
location,
12-
window,
13-
Element,
14-
Node,
15-
MouseEvent,
16-
KeyboardEvent,
17-
Event;
9+
export 'dart:html'
10+
show
11+
document,
12+
location,
13+
window,
14+
Element,
15+
Node,
16+
MouseEvent,
17+
KeyboardEvent,
18+
Event;
1819

1920
final _gc = context['gc'];
2021

modules/angular2/src/facade/collection.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class StringMapWrapper {
7070
map[key] = value;
7171
}
7272
static void delete(Map m, k) {
73-
m.remove(k);
73+
m.remove(k);
7474
}
7575
static void forEach(Map m, fn(v, k)) {
7676
m.forEach((k, v) => fn(v, k));
@@ -96,7 +96,8 @@ class ListWrapper {
9696
static bool contains(List m, k) => m.contains(k);
9797
static List map(list, fn(item)) => list.map(fn).toList();
9898
static List filter(List list, bool fn(item)) => list.where(fn).toList();
99-
static int indexOf(List list, value, [int startIndex = 0]) => list.indexOf(value, startIndex);
99+
static int indexOf(List list, value, [int startIndex = 0]) =>
100+
list.indexOf(value, startIndex);
100101
static int lastIndexOf(List list, value, [int startIndex = null]) =>
101102
list.lastIndexOf(value, startIndex == null ? list.length : startIndex);
102103
static find(List list, bool fn(item)) =>
@@ -115,7 +116,9 @@ class ListWrapper {
115116
l.add(e);
116117
}
117118
static List concat(List a, List b) {
118-
return []..addAll(a)..addAll(b);
119+
return []
120+
..addAll(a)
121+
..addAll(b);
119122
}
120123
static bool isList(l) => l is List;
121124
static void insert(List l, int index, value) {
@@ -154,7 +157,7 @@ class ListWrapper {
154157
l.removeRange(from, to);
155158
return sub;
156159
}
157-
static void sort(List l, compareFn(a,b)) {
160+
static void sort(List l, compareFn(a, b)) {
158161
l.sort(compareFn);
159162
}
160163

modules/angular2/src/facade/lang.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ class RegExpWrapper {
123123
static RegExp create(regExpStr, [String flags = '']) {
124124
bool multiLine = flags.contains('m');
125125
bool caseSensitive = !flags.contains('i');
126-
return new RegExp(regExpStr, multiLine: multiLine, caseSensitive: caseSensitive);
126+
return new RegExp(regExpStr,
127+
multiLine: multiLine, caseSensitive: caseSensitive);
127128
}
128129
static Match firstMatch(RegExp regExp, String input) {
129130
return regExp.firstMatch(input);
@@ -147,7 +148,7 @@ class _JSLikeMatch {
147148

148149
_JSLikeMatch(this._m);
149150

150-
String operator[](index) => _m[index];
151+
String operator [](index) => _m[index];
151152
int get index => _m.start;
152153
int get length => _m.groupCount + 1;
153154
}

0 commit comments

Comments
 (0)