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 0a69a2832b
commit 83a9159063
193 changed files with 5904 additions and 4574 deletions

View File

@ -7,7 +7,7 @@
*/
import * as o from './output/output_ast';
import {OutputContext, error} from './util';
import {error, OutputContext} from './util';
const CONSTANT_PREFIX = '_c';
@ -21,7 +21,12 @@ const CONSTANT_PREFIX = '_c';
*/
const UNKNOWN_VALUE_KEY = o.variable('<unknown>');
export const enum DefinitionKind {Injector, Directive, Component, Pipe}
export const enum DefinitionKind {
Injector,
Directive,
Component,
Pipe
}
/**
* Context to use when producing a key.
@ -43,7 +48,7 @@ class FixupExpression extends o.Expression {
private original: o.Expression;
// TODO(issue/24571): remove '!'.
shared !: boolean;
shared!: boolean;
constructor(public resolved: o.Expression) {
super(resolved.type);
@ -64,7 +69,9 @@ class FixupExpression extends o.Expression {
return e instanceof FixupExpression && this.resolved.isEquivalent(e.resolved);
}
isConstant() { return true; }
isConstant() {
return true;
}
fixup(expression: o.Expression) {
this.resolved = expression;
@ -169,7 +176,7 @@ export class ConstantPool {
const resultExpressions = values.map(
(e, index) => e.isConstant() ? this.getConstLiteral(e, true) : o.variable(`a${index}`));
const parameters =
resultExpressions.filter(isVariable).map(e => new o.FnParam(e.name !, o.DYNAMIC_TYPE));
resultExpressions.filter(isVariable).map(e => new o.FnParam(e.name!, o.DYNAMIC_TYPE));
const pureFunctionDeclaration =
o.fn(parameters, [new o.ReturnStatement(resultMap(resultExpressions))], o.INFERRED_TYPE);
const name = this.freshName();
@ -190,7 +197,9 @@ export class ConstantPool {
* a digit so the prefix should be a constant string (not based on user input) and
* must not end in a digit.
*/
uniqueName(prefix: string): string { return `${prefix}${this.nextNameIndex++}`; }
uniqueName(prefix: string): string {
return `${prefix}${this.nextNameIndex++}`;
}
private definitionsOf(kind: DefinitionKind): Map<any, FixupExpression> {
switch (kind) {
@ -222,7 +231,9 @@ export class ConstantPool {
return '<unknown>';
}
private freshName(): string { return this.uniqueName(CONSTANT_PREFIX); }
private freshName(): string {
return this.uniqueName(CONSTANT_PREFIX);
}
private keyOf(expression: o.Expression) {
return expression.visitExpression(new KeyVisitor(), KEY_CONTEXT);
@ -259,7 +270,9 @@ class KeyVisitor implements o.ExpressionVisitor {
`EX:${ast.value.runtime.name}`;
}
visitReadVarExpr(node: o.ReadVarExpr) { return `VAR:${node.name}`; }
visitReadVarExpr(node: o.ReadVarExpr) {
return `VAR:${node.name}`;
}
visitTypeofExpr(node: o.TypeofExpr, context: any): string {
return `TYPEOF:${node.expr.visitExpression(this, context)}`;
@ -284,7 +297,7 @@ class KeyVisitor implements o.ExpressionVisitor {
visitLocalizedString = invalid;
}
function invalid<T>(this: o.ExpressionVisitor, arg: o.Expression | o.Statement): never {
function invalid<T>(this: o.ExpressionVisitor, arg: o.Expression|o.Statement): never {
throw new Error(
`Invalid state: Visitor ${this.constructor.name} doesn't handle ${arg.constructor.name}`);
}