style(compiler): reformat of codebase with new clang-format version (#36520)

This commit reformats the packages/compiler tree using the new version of
clang-format.

PR Close #36520
This commit is contained in:
Alex Rickabaugh
2020-04-08 10:14:18 -07:00
committed by atscott
parent d5aa6b5bd6
commit cbed582a1a
193 changed files with 5904 additions and 4574 deletions

View File

@ -8,7 +8,7 @@
import {LIFECYCLE_HOOKS_VALUES, LifecycleHooks} from '@angular/compiler/src/lifecycle_reflector';
import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, Component, Directive, DoCheck, Injectable, NgModule, OnChanges, OnDestroy, OnInit, Pipe, SimpleChanges, ViewEncapsulation, ɵstringify as stringify} from '@angular/core';
import {TestBed, async, inject} from '@angular/core/testing';
import {async, inject, TestBed} from '@angular/core/testing';
import {CompileDiDependencyMetadata, identifierName} from '../src/compile_metadata';
import {CompileMetadataResolver} from '../src/metadata_resolver';
@ -20,7 +20,9 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
{
describe('CompileMetadataResolver', () => {
beforeEach(() => { TestBed.configureCompiler({providers: TEST_COMPILER_PROVIDERS}); });
beforeEach(() => {
TestBed.configureCompiler({providers: TEST_COMPILER_PROVIDERS});
});
it('should throw on the getDirectiveMetadata/getPipeMetadata methods if the module has not been loaded yet',
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
@ -70,8 +72,8 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
}
expect(() => resolver.loadNgModuleDirectiveAndPipeMetadata(SomeModule, true))
.toThrowError(
`Can't compile synchronously as ${stringify(ComponentWithExternalResources)} is still being loaded!`);
.toThrowError(`Can't compile synchronously as ${
stringify(ComponentWithExternalResources)} is still being loaded!`);
}));
it('should read external metadata when sync=false',
@ -106,7 +108,7 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
resolver.loadNgModuleDirectiveAndPipeMetadata(SomeModule, false).then(() => {
const value: string =
resolver.getDirectiveMetadata(ComponentWithoutModuleId).template !.templateUrl !;
resolver.getDirectiveMetadata(ComponentWithoutModuleId).template !.templateUrl!;
const expectedEndValue = './someUrl';
expect(value.endsWith(expectedEndValue)).toBe(true);
});
@ -217,7 +219,7 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
it('should throw with descriptive error message when null is passed to declarations',
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
@NgModule({declarations: [null !]})
@NgModule({declarations: [null!]})
class ModuleWithNullDeclared {
}
expect(() => resolver.loadNgModuleDirectiveAndPipeMetadata(ModuleWithNullDeclared, true))
@ -227,7 +229,7 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
it('should throw with descriptive error message when null is passed to imports',
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
@NgModule({imports: [null !]})
@NgModule({imports: [null!]})
class ModuleWithNullImported {
}
expect(() => resolver.loadNgModuleDirectiveAndPipeMetadata(ModuleWithNullImported, true))
@ -248,7 +250,7 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
it('should throw with descriptive error message when encounter invalid provider',
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
@NgModule({providers: [{provide: SimpleService, useClass: undefined !}]})
@NgModule({providers: [{provide: SimpleService, useClass: undefined!}]})
class SomeModule {
}
@ -258,7 +260,7 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
it('should throw with descriptive error message when provider is undefined',
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
@NgModule({providers: [undefined !]})
@NgModule({providers: [undefined!]})
class SomeModule {
}
@ -290,10 +292,10 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
it('should throw with descriptive error message when null or undefined is passed to module bootstrap',
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
@NgModule({bootstrap: [null !]})
@NgModule({bootstrap: [null!]})
class ModuleWithNullBootstrap {
}
@NgModule({bootstrap: [undefined !]})
@NgModule({bootstrap: [undefined!]})
class ModuleWithUndefinedBootstrap {
}
@ -347,7 +349,6 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
it(`should throw an error when a Pipe is added to module's bootstrap list`,
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
@Pipe({name: 'pipe'})
class MyPipe {
}
@ -362,7 +363,6 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
it(`should throw an error when a Service is added to module's bootstrap list`,
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
@NgModule({declarations: [], bootstrap: [SimpleService]})
class ModuleWithServiceInBootstrap {
}
@ -373,7 +373,6 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
it('should generate an error when a dependency could not be resolved',
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
// Override the errorCollector so that error gets collected instead of
// being thrown.
(resolver as any)._errorCollector = (error: Error, type?: any) => {
@ -390,12 +389,11 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
class AppModule {
}
const moduleMetadata = resolver.getNgModuleMetadata(AppModule) !;
const moduleMetadata = resolver.getNgModuleMetadata(AppModule)!;
expect(moduleMetadata).toBeTruthy();
expect(moduleMetadata.declaredDirectives.length).toBe(1);
const directive = moduleMetadata.declaredDirectives[0];
const directiveMetadata =
resolver.getNonNormalizedDirectiveMetadata(directive.reference) !;
const directiveMetadata = resolver.getNonNormalizedDirectiveMetadata(directive.reference)!;
expect(directiveMetadata).toBeTruthy();
const {metadata} = directiveMetadata;
const diDeps: CompileDiDependencyMetadata[] = metadata.type.diDeps;
@ -405,7 +403,6 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
it(`should throw an error when a Directive is added to module's bootstrap list`,
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
@Directive({selector: 'directive'})
class MyDirective {
}
@ -420,7 +417,6 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
it(`should not throw an error when a Component is added to module's bootstrap list`,
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
@Component({template: ''})
class MyComp {
}
@ -439,7 +435,9 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
class InvalidModule {
}
expect(() => { resolver.getNgModuleMetadata(InvalidModule); })
expect(() => {
resolver.getNgModuleMetadata(InvalidModule);
})
.toThrowError(
`Unexpected value '[object Object]' imported by the module 'InvalidModule'. Please add a @NgModule annotation.`);
}));
@ -447,7 +445,6 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
it('should dedupe declarations in NgModule',
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
@Component({template: ''})
class MyComp {
}
@ -456,7 +453,7 @@ import {TEST_COMPILER_PROVIDERS} from './test_bindings';
class MyModule {
}
const modMeta = resolver.getNgModuleMetadata(MyModule) !;
const modMeta = resolver.getNgModuleMetadata(MyModule)!;
expect(modMeta.declaredDirectives.length).toBe(1);
expect(modMeta.declaredDirectives[0].reference).toBe(MyComp);
}));
@ -495,9 +492,9 @@ class ComponentWithExternalResources {
styles: ['someStyle'],
interpolation: ['{{', '}}']
})
class ComponentWithEverythingInline implements OnChanges,
OnInit, DoCheck, OnDestroy, AfterContentInit, AfterContentChecked, AfterViewInit,
AfterViewChecked {
class ComponentWithEverythingInline implements OnChanges, OnInit, DoCheck, OnDestroy,
AfterContentInit, AfterContentChecked, AfterViewInit,
AfterViewChecked {
ngOnChanges(changes: SimpleChanges): void {}
ngOnInit(): void {}
ngDoCheck(): void {}
@ -526,12 +523,12 @@ class MyBrokenComp2 {
class SimpleService {
}
@Component({selector: 'my-broken-comp', template: '', providers: [SimpleService, null !, [null]]})
@Component({selector: 'my-broken-comp', template: '', providers: [SimpleService, null!, [null]]})
class MyBrokenComp3 {
}
@Component(
{selector: 'my-broken-comp', template: '', viewProviders: [null !, SimpleService, [null]]})
{selector: 'my-broken-comp', template: '', viewProviders: [null!, SimpleService, [null]]})
class MyBrokenComp4 {
}