build: reformat repo to new clang@1.4.0 (#36613)

PR Close #36613
This commit is contained in:
Joey Perrott
2020-04-13 16:40:21 -07:00
committed by atscott
parent 5e80e7e216
commit 698b0288be
1160 changed files with 31667 additions and 24000 deletions

View File

@ -8,7 +8,7 @@
import './util/ng_jit_mode';
import {Observable, Observer, Subscription, merge} from 'rxjs';
import {merge, Observable, Observer, Subscription} from 'rxjs';
import {share} from 'rxjs/operators';
import {ApplicationInitStatus} from './application_init';
@ -80,7 +80,7 @@ export function compileNgModuleFactory__POST_R3__<M>(
return Promise.resolve(moduleFactory);
}
const compilerProviders = _mergeArrays(compilerOptions.map(o => o.providers !));
const compilerProviders = _mergeArrays(compilerOptions.map(o => o.providers!));
// In case there are no compiler providers, we just return the module factory as
// there won't be any resource loader. This can happen with Ivy, because AOT compiled
@ -157,9 +157,8 @@ export function createPlatform(injector: Injector): PlatformRef {
* @publicApi
*/
export function createPlatformFactory(
parentPlatformFactory: ((extraProviders?: StaticProvider[]) => PlatformRef) | null,
name: string, providers: StaticProvider[] = []): (extraProviders?: StaticProvider[]) =>
PlatformRef {
parentPlatformFactory: ((extraProviders?: StaticProvider[]) => PlatformRef)|null, name: string,
providers: StaticProvider[] = []): (extraProviders?: StaticProvider[]) => PlatformRef {
const desc = `Platform: ${name}`;
const marker = new InjectionToken(desc);
return (extraProviders: StaticProvider[] = []) => {
@ -320,10 +319,12 @@ export class PlatformRef {
throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
}
moduleRef.onDestroy(() => remove(this._modules, moduleRef));
ngZone !.runOutsideAngular(
() => ngZone !.onError.subscribe(
{next: (error: any) => { exceptionHandler.handleError(error); }}));
return _callAndReportToErrorHandler(exceptionHandler, ngZone !, () => {
ngZone!.runOutsideAngular(() => ngZone!.onError.subscribe({
next: (error: any) => {
exceptionHandler.handleError(error);
}
}));
return _callAndReportToErrorHandler(exceptionHandler, ngZone!, () => {
const initStatus: ApplicationInitStatus = moduleRef.injector.get(ApplicationInitStatus);
initStatus.runInitializers();
return initStatus.donePromise.then(() => {
@ -356,7 +357,8 @@ export class PlatformRef {
*
*/
bootstrapModule<M>(
moduleType: Type<M>, compilerOptions: (CompilerOptions&BootstrapOptions)|
moduleType: Type<M>,
compilerOptions: (CompilerOptions&BootstrapOptions)|
Array<CompilerOptions&BootstrapOptions> = []): Promise<NgModuleRef<M>> {
const options = optionsReducer({}, compilerOptions);
return compileNgModuleFactory(this.injector, options, moduleType)
@ -371,7 +373,10 @@ export class PlatformRef {
moduleRef.instance.ngDoBootstrap(appRef);
} else {
throw new Error(
`The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
`The module ${
stringify(
moduleRef.instance
.constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
`Please define one of these.`);
}
this._modules.push(moduleRef);
@ -380,13 +385,17 @@ export class PlatformRef {
/**
* Register a listener to be called when the platform is disposed.
*/
onDestroy(callback: () => void): void { this._destroyListeners.push(callback); }
onDestroy(callback: () => void): void {
this._destroyListeners.push(callback);
}
/**
* Retrieve the platform {@link Injector}, which is the parent injector for
* every Angular application on the page and provides singleton providers.
*/
get injector(): Injector { return this._injector; }
get injector(): Injector {
return this._injector;
}
/**
* Destroy the Angular platform and all Angular applications on the page.
@ -400,11 +409,13 @@ export class PlatformRef {
this._destroyed = true;
}
get destroyed() { return this._destroyed; }
get destroyed() {
return this._destroyed;
}
}
function getNgZone(
ngZoneOption: NgZone | 'zone.js' | 'noop' | undefined, ngZoneEventCoalescing: boolean): NgZone {
ngZoneOption: NgZone|'zone.js'|'noop'|undefined, ngZoneEventCoalescing: boolean): NgZone {
let ngZone: NgZone;
if (ngZoneOption === 'noop') {
@ -438,7 +449,7 @@ function _callAndReportToErrorHandler(
}
}
function optionsReducer<T extends Object>(dst: any, objs: T | T[]): T {
function optionsReducer<T extends Object>(dst: any, objs: T|T[]): T {
if (Array.isArray(objs)) {
dst = objs.reduce(optionsReducer, dst);
} else {
@ -566,7 +577,7 @@ export class ApplicationRef {
* @see [Usage notes](#is-stable-examples) for examples and caveats when using this API.
*/
// TODO(issue/24571): remove '!'.
public readonly isStable !: Observable<boolean>;
public readonly isStable!: Observable<boolean>;
/** @internal */
constructor(
@ -576,8 +587,13 @@ export class ApplicationRef {
private _initStatus: ApplicationInitStatus) {
this._enforceNoNewChanges = isDevMode();
this._zone.onMicrotaskEmpty.subscribe(
{next: () => { this._zone.run(() => { this.tick(); }); }});
this._zone.onMicrotaskEmpty.subscribe({
next: () => {
this._zone.run(() => {
this.tick();
});
}
});
const isCurrentlyStable = new Observable<boolean>((observer: Observer<boolean>) => {
this._stable = this._zone.isStable && !this._zone.hasPendingMacrotasks &&
@ -612,7 +628,9 @@ export class ApplicationRef {
NgZone.assertInAngularZone();
if (this._stable) {
this._stable = false;
this._zone.runOutsideAngular(() => { observer.next(false); });
this._zone.runOutsideAngular(() => {
observer.next(false);
});
}
});
@ -622,7 +640,7 @@ export class ApplicationRef {
};
});
(this as{isStable: Observable<boolean>}).isStable =
(this as {isStable: Observable<boolean>}).isStable =
merge(isCurrentlyStable, isStable.pipe(share()));
}
@ -653,7 +671,7 @@ export class ApplicationRef {
componentFactory = componentOrFactory;
} else {
componentFactory =
this._componentFactoryResolver.resolveComponentFactory(componentOrFactory) !;
this._componentFactoryResolver.resolveComponentFactory(componentOrFactory)!;
}
this.componentTypes.push(componentFactory.componentType);
@ -663,7 +681,9 @@ export class ApplicationRef {
const selectorOrNode = rootSelectorOrNode || componentFactory.selector;
const compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
compRef.onDestroy(() => { this._unloadComponent(compRef); });
compRef.onDestroy(() => {
this._unloadComponent(compRef);
});
const testability = compRef.injector.get(Testability, null);
if (testability) {
compRef.injector.get(TestabilityRegistry)
@ -755,7 +775,9 @@ export class ApplicationRef {
/**
* Returns the number of attached views.
*/
get viewCount() { return this._views.length; }
get viewCount() {
return this._views.length;
}
}
function remove<T>(list: T[], el: T): void {