Skip to content

Commit c02f2bd

Browse files
committed
chore: adjust formatting to new clang-format.
- fixes wrapping for object literal keys called `template`. - spacing in destructuring expressions. - changes to keep trailing return types of functions closer to their function declaration. - better formatting of string literals. Closes angular#4828
1 parent 4a1b873 commit c02f2bd

50 files changed

Lines changed: 246 additions & 237 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/angular2/src/core/application.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export {
1818
} from './application_ref';
1919

2020
/// See [commonBootstrap] for detailed documentation.
21-
export function bootstrap(appComponentType: /*Type*/ any,
22-
appProviders: Array<Type | Provider | any[]> = null):
23-
Promise<ComponentRef> {
21+
export function bootstrap(
22+
appComponentType: /*Type*/ any,
23+
appProviders: Array<Type | Provider | any[]> = null): Promise<ComponentRef> {
2424
var providers = [compilerProviders()];
2525
if (isPresent(appProviders)) {
2626
providers.push(appProviders);

modules/angular2/src/core/application_common.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ export function platform(providers?: Array<Type | Provider | any[]>): PlatformRe
218218
*
219219
* Returns a `Promise` of {@link ComponentRef}.
220220
*/
221-
export function commonBootstrap(appComponentType: /*Type*/ any,
222-
appProviders: Array<Type | Provider | any[]> = null):
223-
Promise<ComponentRef> {
221+
export function commonBootstrap(
222+
appComponentType: /*Type*/ any,
223+
appProviders: Array<Type | Provider | any[]> = null): Promise<ComponentRef> {
224224
var p = platform();
225225
var bindings = [applicationCommonProviders(), applicationDomProviders()];
226226
if (isPresent(appProviders)) {

modules/angular2/src/core/application_ref.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ export abstract class PlatformRef {
203203
* new application. Once this promise resolves, the application will be
204204
* constructed in the same manner as a normal `application()`.
205205
*/
206-
abstract asyncApplication(bindingFn: (zone: NgZone) => Promise<Array<Type | Provider | any[]>>):
207-
Promise<ApplicationRef>;
206+
abstract asyncApplication(bindingFn: (zone: NgZone) =>
207+
Promise<Array<Type | Provider | any[]>>): Promise<ApplicationRef>;
208208

209209
/**
210210
* Destroy the Angular platform and all Angular applications on the page.
@@ -228,8 +228,8 @@ export class PlatformRef_ extends PlatformRef {
228228
return app;
229229
}
230230

231-
asyncApplication(bindingFn: (zone: NgZone) =>
232-
Promise<Array<Type | Provider | any[]>>): Promise<ApplicationRef> {
231+
asyncApplication(bindingFn: (zone: NgZone) => Promise<Array<Type | Provider | any[]>>):
232+
Promise<ApplicationRef> {
233233
var zone = createNgZone();
234234
var completer = PromiseWrapper.completer();
235235
zone.run(() => {
@@ -314,8 +314,8 @@ export abstract class ApplicationRef {
314314
* app.bootstrap(SecondRootComponent, [provide(OverrideBinding, {useClass: OverriddenBinding})]);
315315
* ```
316316
*/
317-
abstract bootstrap(componentType: Type, providers?: Array<Type | Provider | any[]>):
318-
Promise<ComponentRef>;
317+
abstract bootstrap(componentType: Type,
318+
providers?: Array<Type | Provider | any[]>): Promise<ComponentRef>;
319319

320320
/**
321321
* Retrieve the application {@link Injector}.

modules/angular2/src/core/change_detection/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export var CHANGE_DETECTION_STRATEGY_VALUES = [
5151
ChangeDetectionStrategy.OnPushObserve
5252
];
5353

54-
export function isDefaultChangeDetectionStrategy(changeDetectionStrategy: ChangeDetectionStrategy):
55-
boolean {
54+
export function isDefaultChangeDetectionStrategy(
55+
changeDetectionStrategy: ChangeDetectionStrategy): boolean {
5656
return isBlank(changeDetectionStrategy) ||
5757
changeDetectionStrategy === ChangeDetectionStrategy.Default;
5858
}

modules/angular2/src/core/compiler/command_compiler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ class CodegenCommandFactory implements CommandFactory<string> {
200200
}
201201
}
202202

203-
function visitAndReturnContext(visitor: TemplateAstVisitor, asts: TemplateAst[], context: any):
204-
any {
203+
function visitAndReturnContext(visitor: TemplateAstVisitor, asts: TemplateAst[],
204+
context: any): any {
205205
templateVisitAll(visitor, asts, context);
206206
return context;
207207
}

modules/angular2/src/core/compiler/directive_metadata.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ export class CompileDirectiveMetadata {
159159
hostListeners: hostListeners,
160160
hostProperties: hostProperties,
161161
hostAttributes: hostAttributes,
162-
lifecycleHooks: isPresent(lifecycleHooks) ? lifecycleHooks : [], template: template
162+
lifecycleHooks: isPresent(lifecycleHooks) ? lifecycleHooks : [],
163+
template: template
163164
});
164165
}
165166

modules/angular2/src/core/compiler/html_parser.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ function parseText(text: Text, indexInParent: number, parentSourceInfo: string):
4040
`${parentSourceInfo} > #text(${value}):nth-child(${indexInParent})`);
4141
}
4242

43-
function parseAttr(element: Element, parentSourceInfo: string, attrName: string, attrValue: string):
44-
HtmlAttrAst {
43+
function parseAttr(element: Element, parentSourceInfo: string, attrName: string,
44+
attrValue: string): HtmlAttrAst {
4545
// TODO(tbosch): add source row/column source info from parse5 / package:html
4646
var lowerCaseAttrName = attrName.toLowerCase();
4747
return new HtmlAttrAst(lowerCaseAttrName, attrValue,
4848
`${parentSourceInfo}[${lowerCaseAttrName}=${attrValue}]`);
4949
}
5050

51-
function parseElement(element: Element, indexInParent: number, parentSourceInfo: string):
52-
HtmlElementAst {
51+
function parseElement(element: Element, indexInParent: number,
52+
parentSourceInfo: string): HtmlElementAst {
5353
// normalize nodename always as lower case so that following build steps
5454
// can rely on this
5555
var nodeName = DOM.nodeName(element).toLowerCase();

modules/angular2/src/core/compiler/style_url_resolver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export function isStyleUrlResolvable(url: string): boolean {
2424
* Rewrites stylesheets by resolving and removing the @import urls that
2525
* are either relative or don't have a `package:` scheme
2626
*/
27-
export function extractStyleUrls(resolver: UrlResolver, baseUrl: string, cssText: string):
28-
StyleWithImports {
27+
export function extractStyleUrls(resolver: UrlResolver, baseUrl: string,
28+
cssText: string): StyleWithImports {
2929
var foundUrls = [];
3030
var modifiedCssText = StringWrapper.replaceAllMapped(cssText, _cssImportRe, (m) => {
3131
var url = isPresent(m[1]) ? m[1] : m[2];

modules/angular2/src/core/compiler/template_compiler.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export class TemplateCompiler {
5050
this._appId = appId;
5151
}
5252

53-
normalizeDirectiveMetadata(directive:
54-
CompileDirectiveMetadata): Promise<CompileDirectiveMetadata> {
53+
normalizeDirectiveMetadata(directive: CompileDirectiveMetadata):
54+
Promise<CompileDirectiveMetadata> {
5555
if (!directive.isComponent) {
5656
// For non components there is nothing to be normalized yet.
5757
return PromiseWrapper.resolve(directive);
@@ -70,7 +70,8 @@ export class TemplateCompiler {
7070
hostListeners: directive.hostListeners,
7171
hostProperties: directive.hostProperties,
7272
hostAttributes: directive.hostAttributes,
73-
lifecycleHooks: directive.lifecycleHooks, template: normalizedTemplate
73+
lifecycleHooks: directive.lifecycleHooks,
74+
template: normalizedTemplate
7475
}));
7576
}
7677

modules/angular2/src/core/di/provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,8 @@ function _extractToken(typeOrFunc, metadata /*any[] | any*/, params: any[][]): D
686686
}
687687
}
688688

689-
function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps):
690-
Dependency {
689+
function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility,
690+
depProps): Dependency {
691691
return new Dependency(Key.get(token), optional, lowerBoundVisibility, upperBoundVisibility,
692692
depProps);
693693
}

0 commit comments

Comments
 (0)