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:
@ -16,16 +16,18 @@ import {calcPossibleSecurityContexts} from '../../src/template_parser/binding_pa
|
||||
describe('BindingParser', () => {
|
||||
let registry: ElementSchemaRegistry;
|
||||
|
||||
beforeEach(inject(
|
||||
[ElementSchemaRegistry], (_registry: ElementSchemaRegistry) => { registry = _registry; }));
|
||||
beforeEach(inject([ElementSchemaRegistry], (_registry: ElementSchemaRegistry) => {
|
||||
registry = _registry;
|
||||
}));
|
||||
|
||||
describe('possibleSecurityContexts', () => {
|
||||
function hrefSecurityContexts(selector: string) {
|
||||
return calcPossibleSecurityContexts(registry, selector, 'href', false);
|
||||
}
|
||||
|
||||
it('should return a single security context if the selector as an element name',
|
||||
() => { expect(hrefSecurityContexts('a')).toEqual([SecurityContext.URL]); });
|
||||
it('should return a single security context if the selector as an element name', () => {
|
||||
expect(hrefSecurityContexts('a')).toEqual([SecurityContext.URL]);
|
||||
});
|
||||
|
||||
it('should return the possible security contexts if the selector has no element name', () => {
|
||||
expect(hrefSecurityContexts('[myDir]')).toEqual([
|
||||
@ -45,8 +47,9 @@ import {calcPossibleSecurityContexts} from '../../src/template_parser/binding_pa
|
||||
]);
|
||||
});
|
||||
|
||||
it('should return SecurityContext.NONE if there are no possible elements',
|
||||
() => { expect(hrefSecurityContexts('img:not(img)')).toEqual([SecurityContext.NONE]); });
|
||||
it('should return SecurityContext.NONE if there are no possible elements', () => {
|
||||
expect(hrefSecurityContexts('img:not(img)')).toEqual([SecurityContext.NONE]);
|
||||
});
|
||||
|
||||
it('should return the union of the possible security contexts if multiple selectors are specified',
|
||||
() => {
|
||||
|
@ -36,7 +36,7 @@ describe('expression AST absolute source spans', () => {
|
||||
beforeEach(inject([TemplateParser], (parser: TemplateParser) => {
|
||||
parse =
|
||||
(template: string, directives: CompileDirectiveSummary[] = [],
|
||||
pipes: CompilePipeSummary[] | null = null, schemas: SchemaMetadata[] = [],
|
||||
pipes: CompilePipeSummary[]|null = null, schemas: SchemaMetadata[] = [],
|
||||
preserveWhitespaces = true): TemplateAst[] => {
|
||||
if (pipes === null) {
|
||||
pipes = [];
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,9 @@ import {PreparsedElement, PreparsedElementType, preparseElement} from '../../src
|
||||
{
|
||||
describe('preparseElement', () => {
|
||||
let htmlParser: HtmlParser;
|
||||
beforeEach(inject([HtmlParser], (_htmlParser: HtmlParser) => { htmlParser = _htmlParser; }));
|
||||
beforeEach(inject([HtmlParser], (_htmlParser: HtmlParser) => {
|
||||
htmlParser = _htmlParser;
|
||||
}));
|
||||
|
||||
function preparse(html: string): PreparsedElement {
|
||||
return preparseElement(htmlParser.parse(html, 'TestComp').rootNodes[0] as Element);
|
||||
|
@ -15,12 +15,16 @@ type HumanizedExpressionSource = [string, AbsoluteSourceSpan];
|
||||
class ExpressionSourceHumanizer extends e.RecursiveAstVisitor implements t.TemplateAstVisitor {
|
||||
result: HumanizedExpressionSource[] = [];
|
||||
|
||||
private recordAst(ast: e.AST) { this.result.push([unparse(ast), ast.sourceSpan]); }
|
||||
private recordAst(ast: e.AST) {
|
||||
this.result.push([unparse(ast), ast.sourceSpan]);
|
||||
}
|
||||
|
||||
// This method is defined to reconcile the type of ExpressionSourceHumanizer
|
||||
// since both RecursiveAstVisitor and TemplateAstVisitor define the visit()
|
||||
// method in their interfaces.
|
||||
visit(node: e.AST|t.TemplateAst, context?: any) { node.visit(this, context); }
|
||||
visit(node: e.AST|t.TemplateAst, context?: any) {
|
||||
node.visit(this, context);
|
||||
}
|
||||
|
||||
visitASTWithSource(ast: e.ASTWithSource) {
|
||||
this.recordAst(ast);
|
||||
@ -128,17 +132,25 @@ class ExpressionSourceHumanizer extends e.RecursiveAstVisitor implements t.Templ
|
||||
}
|
||||
visitReference(ast: t.ReferenceAst) {}
|
||||
visitVariable(ast: t.VariableAst) {}
|
||||
visitEvent(ast: t.BoundEventAst) { ast.handler.visit(this); }
|
||||
visitElementProperty(ast: t.BoundElementPropertyAst) { ast.value.visit(this); }
|
||||
visitEvent(ast: t.BoundEventAst) {
|
||||
ast.handler.visit(this);
|
||||
}
|
||||
visitElementProperty(ast: t.BoundElementPropertyAst) {
|
||||
ast.value.visit(this);
|
||||
}
|
||||
visitAttr(ast: t.AttrAst) {}
|
||||
visitBoundText(ast: t.BoundTextAst) { ast.value.visit(this); }
|
||||
visitBoundText(ast: t.BoundTextAst) {
|
||||
ast.value.visit(this);
|
||||
}
|
||||
visitText(ast: t.TextAst) {}
|
||||
visitDirective(ast: t.DirectiveAst) {
|
||||
t.templateVisitAll(this, ast.hostEvents);
|
||||
t.templateVisitAll(this, ast.hostProperties);
|
||||
t.templateVisitAll(this, ast.inputs);
|
||||
}
|
||||
visitDirectiveProperty(ast: t.BoundDirectivePropertyAst) { ast.value.visit(this); }
|
||||
visitDirectiveProperty(ast: t.BoundDirectivePropertyAst) {
|
||||
ast.value.visit(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,8 +5,9 @@
|
||||
* 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 {CompileDirectiveMetadata, CompileEntryComponentMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileStylesheetMetadata, CompileTemplateMetadata, CompileTypeMetadata, ProxyClass, StaticSymbol, preserveWhitespacesDefault} from '@angular/compiler';
|
||||
import {CompileDirectiveMetadata, CompileEntryComponentMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileStylesheetMetadata, CompileTemplateMetadata, CompileTypeMetadata, preserveWhitespacesDefault, ProxyClass, StaticSymbol} from '@angular/compiler';
|
||||
import {ChangeDetectionStrategy, RendererType2, ViewEncapsulation} from '@angular/core';
|
||||
|
||||
import {noUndefined} from '../../../src/util';
|
||||
|
||||
export function createTypeMeta({reference, diDeps}: {reference: any, diDeps?: any[]}):
|
||||
@ -14,13 +15,28 @@ export function createTypeMeta({reference, diDeps}: {reference: any, diDeps?: an
|
||||
return {reference: reference, diDeps: diDeps || [], lifecycleHooks: []};
|
||||
}
|
||||
|
||||
export function compileDirectiveMetadataCreate(
|
||||
{isHost, type, isComponent, selector, exportAs, inputs, outputs, host, providers, viewProviders,
|
||||
queries, guards, viewQueries, entryComponents, template, componentViewType,
|
||||
rendererType}: Partial<Parameters<typeof CompileDirectiveMetadata.create>[0]>) {
|
||||
export function compileDirectiveMetadataCreate({
|
||||
isHost,
|
||||
type,
|
||||
isComponent,
|
||||
selector,
|
||||
exportAs,
|
||||
inputs,
|
||||
outputs,
|
||||
host,
|
||||
providers,
|
||||
viewProviders,
|
||||
queries,
|
||||
guards,
|
||||
viewQueries,
|
||||
entryComponents,
|
||||
template,
|
||||
componentViewType,
|
||||
rendererType
|
||||
}: Partial<Parameters<typeof CompileDirectiveMetadata.create>[0]>) {
|
||||
return CompileDirectiveMetadata.create({
|
||||
isHost: !!isHost,
|
||||
type: noUndefined(type) !,
|
||||
type: noUndefined(type)!,
|
||||
isComponent: !!isComponent,
|
||||
selector: noUndefined(selector),
|
||||
exportAs: noUndefined(exportAs),
|
||||
@ -34,17 +50,26 @@ export function compileDirectiveMetadataCreate(
|
||||
guards: guards || {},
|
||||
viewQueries: viewQueries || [],
|
||||
entryComponents: entryComponents || [],
|
||||
template: noUndefined(template) !,
|
||||
template: noUndefined(template)!,
|
||||
componentViewType: noUndefined(componentViewType),
|
||||
rendererType: noUndefined(rendererType),
|
||||
componentFactory: null,
|
||||
});
|
||||
}
|
||||
|
||||
export function compileTemplateMetadata(
|
||||
{encapsulation, template, templateUrl, styles, styleUrls, externalStylesheets, animations,
|
||||
ngContentSelectors, interpolation, isInline,
|
||||
preserveWhitespaces}: Partial<CompileTemplateMetadata>): CompileTemplateMetadata {
|
||||
export function compileTemplateMetadata({
|
||||
encapsulation,
|
||||
template,
|
||||
templateUrl,
|
||||
styles,
|
||||
styleUrls,
|
||||
externalStylesheets,
|
||||
animations,
|
||||
ngContentSelectors,
|
||||
interpolation,
|
||||
isInline,
|
||||
preserveWhitespaces
|
||||
}: Partial<CompileTemplateMetadata>): CompileTemplateMetadata {
|
||||
return new CompileTemplateMetadata({
|
||||
encapsulation: noUndefined(encapsulation),
|
||||
template: noUndefined(template),
|
||||
|
Reference in New Issue
Block a user