Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit f238908

Browse files
JiaLiPassionmhevery
authored andcommitted
fix(format): update clang-format to 1.2.3
1 parent 915042d commit f238908

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1359
-1350
lines changed

lib/browser/define-property.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ function _tryDefineProperty(obj: any, prop: string, desc: any, originalConfigura
103103
} catch (error) {
104104
descJson = desc.toString();
105105
}
106-
console.log(`Attempting to configure '${prop}' with descriptor '${descJson
107-
}' on object '${obj}' and got error, giving up: ${error}`);
106+
console.log(`Attempting to configure '${prop}' with descriptor '${descJson}' on object '${
107+
obj}' and got error, giving up: ${error}`);
108108
}
109109
} else {
110110
throw error;

lib/browser/webapis-media-query.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Zone.__load_patch('mediaQuery', (global: any, Zone: ZoneType, api: _ZonePrivate)
5353
patchAddListener(mql);
5454
patchRemoveListener(mql);
5555
} else if (mql['addListener']) {
56-
// proto not exists, or proto has no addListener method
56+
// proto not exists, or proto has no addListener method
5757
// try to patch mql instance
5858
patchAddListener(mql);
5959
patchRemoveListener(mql);

lib/browser/webapis-resize-observer.ts

+42-37
Original file line numberDiff line numberDiff line change
@@ -45,44 +45,49 @@ Zone.__load_patch('ResizeObserver', (global: any, Zone: any, api: _ZonePrivate)
4545
return args.length > 0 ? new ResizeObserver(args[0]) : new ResizeObserver();
4646
});
4747

48-
api.patchMethod(ResizeObserver.prototype, 'observe', (delegate: Function) => (self: any, args: any[]) => {
49-
const target = args.length > 0 ? args[0] : null;
50-
if (!target) {
51-
return delegate.apply(self, args);
52-
}
53-
let targets = self[resizeObserverSymbol];
54-
if (!targets) {
55-
targets = self[resizeObserverSymbol] = [];
56-
}
57-
targets.push(target);
58-
target[resizeObserverSymbol] = Zone.current;
59-
return delegate.apply(self, args);
60-
});
48+
api.patchMethod(
49+
ResizeObserver.prototype, 'observe', (delegate: Function) => (self: any, args: any[]) => {
50+
const target = args.length > 0 ? args[0] : null;
51+
if (!target) {
52+
return delegate.apply(self, args);
53+
}
54+
let targets = self[resizeObserverSymbol];
55+
if (!targets) {
56+
targets = self[resizeObserverSymbol] = [];
57+
}
58+
targets.push(target);
59+
target[resizeObserverSymbol] = Zone.current;
60+
return delegate.apply(self, args);
61+
});
6162

62-
api.patchMethod(ResizeObserver.prototype, 'unobserve', (delegate: Function) => (self: any, args: any[]) => {
63-
const target = args.length > 0 ? args[0] : null;
64-
if (!target) {
65-
return delegate.apply(self, args);
66-
}
67-
let targets = self[resizeObserverSymbol];
68-
if (targets) {
69-
for (let i = 0; i < targets.length; i ++) {
70-
if (targets[i] === target) {
71-
targets.splice(i, 1);
72-
break;
63+
api.patchMethod(
64+
ResizeObserver.prototype, 'unobserve', (delegate: Function) => (self: any, args: any[]) => {
65+
const target = args.length > 0 ? args[0] : null;
66+
if (!target) {
67+
return delegate.apply(self, args);
7368
}
74-
}
75-
}
76-
target[resizeObserverSymbol] = undefined;
77-
return delegate.apply(self, args);
78-
});
69+
let targets = self[resizeObserverSymbol];
70+
if (targets) {
71+
for (let i = 0; i < targets.length; i++) {
72+
if (targets[i] === target) {
73+
targets.splice(i, 1);
74+
break;
75+
}
76+
}
77+
}
78+
target[resizeObserverSymbol] = undefined;
79+
return delegate.apply(self, args);
80+
});
7981

80-
api.patchMethod(ResizeObserver.prototype, 'disconnect', (delegate: Function) => (self: any, args: any[]) => {
81-
const targets = self[resizeObserverSymbol];
82-
if (targets) {
83-
targets.forEach((target: any) => {target[resizeObserverSymbol] = undefined;});
84-
self[resizeObserverSymbol] = undefined;
85-
}
86-
return delegate.apply(self, args);
87-
});
82+
api.patchMethod(
83+
ResizeObserver.prototype, 'disconnect', (delegate: Function) => (self: any, args: any[]) => {
84+
const targets = self[resizeObserverSymbol];
85+
if (targets) {
86+
targets.forEach((target: any) => {
87+
target[resizeObserverSymbol] = undefined;
88+
});
89+
self[resizeObserverSymbol] = undefined;
90+
}
91+
return delegate.apply(self, args);
92+
});
8893
});

lib/common/events.ts

-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ export function patchEventTarget(
285285
const typeOfDelegate = typeof delegate;
286286
return (typeOfDelegate === 'function' && task.callback === delegate) ||
287287
(typeOfDelegate === 'object' && task.originalDelegate === delegate);
288-
289288
};
290289

291290
const compare =

lib/common/promise.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ Zone.__load_patch('ZoneAwarePromise', (global: any, Zone: ZoneType, api: _ZonePr
3434
if (rejection) {
3535
console.error(
3636
'Unhandled Promise rejection:',
37-
rejection instanceof Error ? rejection.message : rejection, '; Zone:',
38-
(<Zone>e.zone).name, '; Task:', e.task && (<Task>e.task).source, '; Value:', rejection,
39-
rejection instanceof Error ? rejection.stack : undefined);
37+
rejection instanceof Error ? rejection.message : rejection,
38+
'; Zone:', (<Zone>e.zone).name, '; Task:', e.task && (<Task>e.task).source,
39+
'; Value:', rejection, rejection instanceof Error ? rejection.stack : undefined);
4040
} else {
4141
console.error(e);
4242
}
@@ -239,8 +239,8 @@ Zone.__load_patch('ZoneAwarePromise', (global: any, Zone: ZoneType, api: _ZonePr
239239

240240
function scheduleResolveOrReject<R, U1, U2>(
241241
promise: ZoneAwarePromise<any>, zone: AmbientZone, chainPromise: ZoneAwarePromise<any>,
242-
onFulfilled?: ((value: R) => U1) | null | undefined,
243-
onRejected?: ((error: any) => U2) | null | undefined): void {
242+
onFulfilled?: ((value: R) => U1)|null|undefined,
243+
onRejected?: ((error: any) => U2)|null|undefined): void {
244244
clearRejectedNoCatch(promise);
245245
const promiseState = (promise as any)[symbolState];
246246
const delegate = promiseState ?

lib/extra/bluebird.ts

+17-16
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,23 @@ Zone.__load_patch('bluebird', (global: any, Zone: ZoneType, api: _ZonePrivate) =
1616
// patch method of Bluebird.prototype which not using `then` internally
1717
const bluebirdApis: string[] = ['then', 'spread', 'finally'];
1818
bluebirdApis.forEach(bapi => {
19-
api.patchMethod(Bluebird.prototype, bapi, (delegate: Function) => (self: any, args: any[]) => {
20-
const zone = Zone.current;
21-
for (let i = 0; i < args.length; i ++) {
22-
const func = args[i];
23-
if (typeof func === 'function') {
24-
args[i] = function() {
25-
const argSelf: any = this;
26-
const argArgs: any = arguments;
27-
zone.scheduleMicroTask('Promise.then', () => {
28-
return func.apply(argSelf, argArgs);
29-
});
30-
};
31-
}
32-
}
33-
return delegate.apply(self, args);
34-
});
19+
api.patchMethod(
20+
Bluebird.prototype, bapi, (delegate: Function) => (self: any, args: any[]) => {
21+
const zone = Zone.current;
22+
for (let i = 0; i < args.length; i++) {
23+
const func = args[i];
24+
if (typeof func === 'function') {
25+
args[i] = function() {
26+
const argSelf: any = this;
27+
const argArgs: any = arguments;
28+
zone.scheduleMicroTask('Promise.then', () => {
29+
return func.apply(argSelf, argArgs);
30+
});
31+
};
32+
}
33+
}
34+
return delegate.apply(self, args);
35+
});
3536
});
3637

3738
// override global promise

lib/extra/jsonp.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@ Zone.__load_patch('jsonp', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
6868
}
6969
});
7070

71-
api.patchMethod(options.jsonp, options.sendFuncName, (delegate: Function) => (self: any, args: any[]) => {
72-
global[api.symbol('jsonpTask')] = Zone.current.scheduleMacroTask('jsonp', noop, {}, (task: Task) => {
73-
return delegate.apply(self, args);
74-
}, noop);
75-
});
71+
api.patchMethod(
72+
options.jsonp, options.sendFuncName, (delegate: Function) => (self: any, args: any[]) => {
73+
global[api.symbol('jsonpTask')] =
74+
Zone.current.scheduleMacroTask('jsonp', noop, {}, (task: Task) => {
75+
return delegate.apply(self, args);
76+
}, noop);
77+
});
7678
};
7779
});

lib/jasmine/jasmine.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@
177177
(jasmine as any).QueueRunner = (function(_super) {
178178
__extends(ZoneQueueRunner, _super);
179179
function ZoneQueueRunner(attrs: {
180-
onComplete: Function; userContext?: any;
180+
onComplete: Function;
181+
userContext?: any;
181182
timeout?: {setTimeout: Function; clearTimeout: Function};
182183
onException?: (error: any) => void;
183184
}) {

lib/mocha/mocha.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
testZone = rootZone.fork(new ProxyZoneSpec());
162162
});
163163

164-
this.on('fail', (test:any, err: any) => {
164+
this.on('fail', (test: any, err: any) => {
165165
const proxyZoneSpec = testZone && testZone.get('ProxyZoneSpec');
166166
if (proxyZoneSpec && err) {
167167
err.message += proxyZoneSpec.getAndClearPendingTasksInfo();
@@ -170,8 +170,5 @@
170170

171171
return originalRun.call(this, fn);
172172
};
173-
174-
175173
})(Mocha.Runner.prototype.runTest, Mocha.Runner.prototype.run);
176-
177174
})(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);

lib/node/node.ts

-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ Zone.__load_patch(
111111
});
112112
};
113113
}
114-
115114
});
116115

117116

lib/rxjs/rxjs-fake-async.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88

99
import {Scheduler} from 'rxjs/Scheduler';
10-
import {async} from 'rxjs/scheduler/async';
1110
import {asap} from 'rxjs/scheduler/asap';
11+
import {async} from 'rxjs/scheduler/async';
1212

1313
Zone.__load_patch('rxjs.Scheduler.now', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
1414
api.patchMethod(Scheduler, 'now', (delegate: Function) => (self: any, args: any[]) => {

lib/rxjs/rxjs.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ import {rxSubscriber} from 'rxjs/symbol/rxSubscriber';
3030
const empty = {
3131
closed: true,
3232
next(value: any): void{},
33-
error(err: any): void{throw err;},
34-
complete(): void{}
33+
error(err: any): void {
34+
throw err;
35+
},
36+
complete(): void {}
3537
};
3638

3739
function toSubscriber<T>(

lib/testing/fake-async.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ Zone.__load_patch('fakeasync', (global: any, Zone: ZoneType, api: _ZonePrivate)
3333
}
3434

3535
/**
36-
* Wraps a function to be executed in the fakeAsync zone:
37-
* - microtasks are manually executed by calling `flushMicrotasks()`,
38-
* - timers are synchronous, `tick()` simulates the asynchronous passage of time.
39-
*
40-
* If there are any pending timers at the end of the function, an exception will be thrown.
41-
*
42-
* Can be used to wrap inject() calls.
43-
*
44-
* ## Example
45-
*
46-
* {@example core/testing/ts/fake_async.ts region='basic'}
47-
*
48-
* @param fn
49-
* @returns The function wrapped to be executed in the fakeAsync zone
50-
*
51-
* @experimental
52-
*/
36+
* Wraps a function to be executed in the fakeAsync zone:
37+
* - microtasks are manually executed by calling `flushMicrotasks()`,
38+
* - timers are synchronous, `tick()` simulates the asynchronous passage of time.
39+
*
40+
* If there are any pending timers at the end of the function, an exception will be thrown.
41+
*
42+
* Can be used to wrap inject() calls.
43+
*
44+
* ## Example
45+
*
46+
* {@example core/testing/ts/fake_async.ts region='basic'}
47+
*
48+
* @param fn
49+
* @returns The function wrapped to be executed in the fakeAsync zone
50+
*
51+
* @experimental
52+
*/
5353
function fakeAsync(fn: Function): (...args: any[]) => any {
5454
// Not using an arrow function to preserve context passed from call site
5555
return function(...args: any[]) {

lib/testing/promise-testing.ts

+23-23
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
/**
10-
* Promise for async/fakeAsync zoneSpec test
11-
* can support async operation which not supported by zone.js
12-
* such as
13-
* it ('test jsonp in AsyncZone', async() => {
14-
* new Promise(res => {
15-
* jsonp(url, (data) => {
16-
* // success callback
17-
* res(data);
18-
* });
19-
* }).then((jsonpResult) => {
20-
* // get jsonp result.
21-
*
22-
* // user will expect AsyncZoneSpec wait for
23-
* // then, but because jsonp is not zone aware
24-
* // AsyncZone will finish before then is called.
25-
* });
26-
* });
27-
*/
9+
/**
10+
* Promise for async/fakeAsync zoneSpec test
11+
* can support async operation which not supported by zone.js
12+
* such as
13+
* it ('test jsonp in AsyncZone', async() => {
14+
* new Promise(res => {
15+
* jsonp(url, (data) => {
16+
* // success callback
17+
* res(data);
18+
* });
19+
* }).then((jsonpResult) => {
20+
* // get jsonp result.
21+
*
22+
* // user will expect AsyncZoneSpec wait for
23+
* // then, but because jsonp is not zone aware
24+
* // AsyncZone will finish before then is called.
25+
* });
26+
* });
27+
*/
2828
Zone.__load_patch('promisefortest', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
2929
const symbolState: string = api.symbol('state');
3030
const UNRESOLVED: null = null;
3131
const symbolParentUnresolved = api.symbol('parentUnresolved');
32-
32+
3333
// patch Promise.prototype.then to keep an internal
3434
// number for tracking unresolved chained promise
3535
// we will decrease this number when the parent promise
@@ -44,15 +44,15 @@ Zone.__load_patch('promisefortest', (global: any, Zone: ZoneType, api: _ZonePriv
4444
}
4545
oriThen = (Promise as any)[Zone.__symbol__('ZonePromiseThen')] = Promise.prototype.then;
4646
Promise.prototype.then = function() {
47-
const chained = oriThen.apply(this, arguments);
47+
const chained = oriThen.apply(this, arguments);
4848
if (this[symbolState] === UNRESOLVED) {
4949
// parent promise is unresolved.
5050
const asyncTestZoneSpec = Zone.current.get('AsyncTestZoneSpec');
5151
if (asyncTestZoneSpec) {
52-
asyncTestZoneSpec.unresolvedChainedPromiseCount ++;
52+
asyncTestZoneSpec.unresolvedChainedPromiseCount++;
5353
chained[symbolParentUnresolved] = true;
5454
}
55-
}
55+
}
5656
return chained;
5757
};
5858
};

0 commit comments

Comments
 (0)