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:
@ -5,7 +5,7 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {CompileReflector, DirectiveResolver, core} from '@angular/compiler';
|
||||
import {CompileReflector, core, DirectiveResolver} from '@angular/compiler';
|
||||
|
||||
/**
|
||||
* An implementation of {@link DirectiveResolver} that allows overriding
|
||||
@ -14,7 +14,9 @@ import {CompileReflector, DirectiveResolver, core} from '@angular/compiler';
|
||||
export class MockDirectiveResolver extends DirectiveResolver {
|
||||
private _directives = new Map<core.Type, core.Directive>();
|
||||
|
||||
constructor(reflector: CompileReflector) { super(reflector); }
|
||||
constructor(reflector: CompileReflector) {
|
||||
super(reflector);
|
||||
}
|
||||
|
||||
resolve(type: core.Type): core.Directive;
|
||||
resolve(type: core.Type, throwIfNotFound: true): core.Directive;
|
||||
|
@ -6,12 +6,14 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {CompileReflector, NgModuleResolver, core} from '@angular/compiler';
|
||||
import {CompileReflector, core, NgModuleResolver} from '@angular/compiler';
|
||||
|
||||
export class MockNgModuleResolver extends NgModuleResolver {
|
||||
private _ngModules = new Map<core.Type, core.NgModule>();
|
||||
|
||||
constructor(reflector: CompileReflector) { super(reflector); }
|
||||
constructor(reflector: CompileReflector) {
|
||||
super(reflector);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the {@link NgModule} for a module.
|
||||
@ -27,6 +29,6 @@ export class MockNgModuleResolver extends NgModuleResolver {
|
||||
* `NgModuleResolver`, see `setNgModule`.
|
||||
*/
|
||||
resolve(type: core.Type, throwIfNotFound = true): core.NgModule {
|
||||
return this._ngModules.get(type) || super.resolve(type, throwIfNotFound) !;
|
||||
return this._ngModules.get(type) || super.resolve(type, throwIfNotFound)!;
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,7 @@ export interface SourceLocation {
|
||||
}
|
||||
|
||||
export function originalPositionFor(
|
||||
sourceMap: SourceMap,
|
||||
genPosition: {line: number | null, column: number | null}): SourceLocation {
|
||||
sourceMap: SourceMap, genPosition: {line: number|null, column: number|null}): SourceLocation {
|
||||
const smc = new SourceMapConsumer(sourceMap);
|
||||
// Note: We don't return the original object as it also contains a `name` property
|
||||
// which is always null and we don't want to include that in our assertions...
|
||||
|
@ -6,17 +6,21 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {CompileReflector, PipeResolver, core} from '@angular/compiler';
|
||||
import {CompileReflector, core, PipeResolver} from '@angular/compiler';
|
||||
|
||||
export class MockPipeResolver extends PipeResolver {
|
||||
private _pipes = new Map<core.Type, core.Pipe>();
|
||||
|
||||
constructor(refector: CompileReflector) { super(refector); }
|
||||
constructor(refector: CompileReflector) {
|
||||
super(refector);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the {@link Pipe} for a pipe.
|
||||
*/
|
||||
setPipe(type: core.Type, metadata: core.Pipe): void { this._pipes.set(type, metadata); }
|
||||
setPipe(type: core.Type, metadata: core.Pipe): void {
|
||||
this._pipes.set(type, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link Pipe} for a pipe:
|
||||
@ -27,7 +31,7 @@ export class MockPipeResolver extends PipeResolver {
|
||||
resolve(type: core.Type, throwIfNotFound = true): core.Pipe {
|
||||
let metadata = this._pipes.get(type);
|
||||
if (!metadata) {
|
||||
metadata = super.resolve(type, throwIfNotFound) !;
|
||||
metadata = super.resolve(type, throwIfNotFound)!;
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
|
@ -23,7 +23,9 @@ export class MockResourceLoader extends ResourceLoader {
|
||||
return request.getPromise();
|
||||
}
|
||||
|
||||
hasPendingRequests() { return !!this._requests.length; }
|
||||
hasPendingRequests() {
|
||||
return !!this._requests.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an expectation for the given URL. Incoming requests will be checked against
|
||||
@ -43,7 +45,9 @@ export class MockResourceLoader extends ResourceLoader {
|
||||
* unlike expectations, unused definitions do not cause `verifyNoOutstandingExpectations`
|
||||
* to return an error.
|
||||
*/
|
||||
when(url: string, response: string) { this._definitions.set(url, response); }
|
||||
when(url: string, response: string) {
|
||||
this._definitions.set(url, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process pending requests and verify there are no outstanding expectations. Also fails
|
||||
@ -55,7 +59,7 @@ export class MockResourceLoader extends ResourceLoader {
|
||||
}
|
||||
|
||||
do {
|
||||
this._processRequest(this._requests.shift() !);
|
||||
this._processRequest(this._requests.shift()!);
|
||||
} while (this._requests.length > 0);
|
||||
|
||||
this.verifyNoOutstandingExpectations();
|
||||
@ -100,9 +104,9 @@ export class MockResourceLoader extends ResourceLoader {
|
||||
|
||||
class _PendingRequest {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
resolve !: (result: string) => void;
|
||||
resolve!: (result: string) => void;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
reject !: (error: any) => void;
|
||||
reject!: (error: any) => void;
|
||||
promise: Promise<string>;
|
||||
|
||||
constructor(public url: string) {
|
||||
@ -120,7 +124,9 @@ class _PendingRequest {
|
||||
}
|
||||
}
|
||||
|
||||
getPromise(): Promise<string> { return this.promise; }
|
||||
getPromise(): Promise<string> {
|
||||
return this.promise;
|
||||
}
|
||||
}
|
||||
|
||||
class _Expectation {
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ElementSchemaRegistry, core} from '@angular/compiler';
|
||||
import {core, ElementSchemaRegistry} from '@angular/compiler';
|
||||
|
||||
export class MockSchemaRegistry implements ElementSchemaRegistry {
|
||||
constructor(
|
||||
@ -25,15 +25,21 @@ export class MockSchemaRegistry implements ElementSchemaRegistry {
|
||||
return value === void 0 ? true : value;
|
||||
}
|
||||
|
||||
allKnownElementNames(): string[] { return Object.keys(this.existingElements); }
|
||||
allKnownElementNames(): string[] {
|
||||
return Object.keys(this.existingElements);
|
||||
}
|
||||
|
||||
securityContext(selector: string, property: string, isAttribute: boolean): core.SecurityContext {
|
||||
return core.SecurityContext.NONE;
|
||||
}
|
||||
|
||||
getMappedPropName(attrName: string): string { return this.attrPropMapping[attrName] || attrName; }
|
||||
getMappedPropName(attrName: string): string {
|
||||
return this.attrPropMapping[attrName] || attrName;
|
||||
}
|
||||
|
||||
getDefaultComponentElementName(): string { return 'ng-component'; }
|
||||
getDefaultComponentElementName(): string {
|
||||
return 'ng-component';
|
||||
}
|
||||
|
||||
validateProperty(name: string): {error: boolean, msg?: string} {
|
||||
if (this.invalidProperties.indexOf(name) > -1) {
|
||||
@ -54,9 +60,11 @@ export class MockSchemaRegistry implements ElementSchemaRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
normalizeAnimationStyleProperty(propName: string): string { return propName; }
|
||||
normalizeAnimationStyleProperty(propName: string): string {
|
||||
return propName;
|
||||
}
|
||||
normalizeAnimationStyleValue(camelCaseProp: string, userProvidedProp: string, val: string|number):
|
||||
{error: string, value: string} {
|
||||
return {error: null !, value: val.toString()};
|
||||
return {error: null!, value: val.toString()};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user