X Tutup
Skip to content

Commit f999d5a

Browse files
committed
chore: move to clang-format 1.0.17.
clang-format 1.0.17 substantially improves formatting for fat arrow functions and array literal detection. It also fixes a number of minor formatting issues.
1 parent f74d772 commit f999d5a

File tree

56 files changed

+501
-532
lines changed

Some content is hidden

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

56 files changed

+501
-532
lines changed

gulpfile.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,8 @@ gulp.task('build/pubbuild.dart', pubbuild(gulp, gulpPlugins, {
223223
// formatting
224224

225225
function doCheckFormat() {
226-
return gulp.src(['Brocfile*.js', 'modules/**/*.ts', 'tools/**/*.ts', '!**/typings/**/*.d.ts',
227-
// skipped due to https://github.com/angular/clang-format/issues/4
228-
'!tools/broccoli/tree-differ.ts',
229-
// skipped due to https://github.com/angular/gulp-clang-format/issues/3
230-
'!tools/broccoli/broccoli-typescript.ts' ])
231-
.pipe(format.checkFormat('file'));
226+
return gulp.src(['Brocfile*.js', 'modules/**/*.ts', 'tools/**/*.ts', '!**/typings/**/*.d.ts'])
227+
.pipe(format.checkFormat('file'));
232228
}
233229

234230
gulp.task('check-format', function() {

modules/angular2/router.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ export var routerInjectables: List<any> = [
3535
Pipeline,
3636
BrowserLocation,
3737
Location,
38-
bind(Router).toFactory((registry, pipeline, location, appRoot) =>
39-
{ return new RootRouter(registry, pipeline, location, appRoot);},
40-
[RouteRegistry, Pipeline, Location, appComponentTypeToken])
38+
bind(Router)
39+
.toFactory((registry, pipeline, location,
40+
appRoot) => { return new RootRouter(registry, pipeline, location, appRoot);},
41+
[RouteRegistry, Pipeline, Location, appComponentTypeToken])
4142
];

modules/angular2/src/change_detection/change_detection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export var iterableDiff: List<PipeFactory> = [new IterableChangesFactory(), new
3333
*
3434
* @exportedAs angular2/pipes
3535
*/
36-
export var async: List<
37-
PipeFactory> = [new ObservablePipeFactory(), new PromisePipeFactory(), new NullPipeFactory()];
36+
export var async: List<PipeFactory> =
37+
[new ObservablePipeFactory(), new PromisePipeFactory(), new NullPipeFactory()];
3838

3939
/**
4040
* Uppercase text transform.

modules/angular2/src/change_detection/coalesce.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ function _selfRecord(r: ProtoRecord, contextIndex: number, selfIndex: number): P
4545

4646
function _findMatching(r: ProtoRecord, rs: List<ProtoRecord>) {
4747
return ListWrapper.find(rs, (rr) => rr.mode !== RECORD_TYPE_DIRECTIVE_LIFECYCLE &&
48-
rr.mode === r.mode && rr.funcOrValue === r.funcOrValue &&
49-
rr.contextIndex === r.contextIndex &&
50-
ListWrapper.equals(rr.args, r.args));
48+
rr.mode === r.mode && rr.funcOrValue === r.funcOrValue &&
49+
rr.contextIndex === r.contextIndex &&
50+
ListWrapper.equals(rr.args, r.args));
5151
}
5252

5353
function _replaceIndices(r: ProtoRecord, selfIndex: number, indexMap: Map<any, any>) {

modules/angular2/src/core/application.ts

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,38 +71,37 @@ function _injectorBindings(appComponentType): List<Type | Binding | List<any>> {
7171
.toValue(DOM.defaultDoc()),
7272
bind(appComponentTypeToken).toValue(appComponentType),
7373
bind(appComponentRefToken)
74-
.toAsyncFactory((dynamicComponentLoader, injector, testability, registry) =>
75-
{
74+
.toAsyncFactory(
75+
(dynamicComponentLoader, injector, testability, registry) => {
7676

77-
// TODO(rado): investigate whether to support bindings on root component.
78-
return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector)
79-
.then((componentRef) => {
80-
var domView = resolveInternalDomView(componentRef.hostView.render);
81-
// We need to do this here to ensure that we create Testability and
82-
// it's ready on the window for users.
83-
registry.registerApplication(domView.boundElements[0], testability);
77+
// TODO(rado): investigate whether to support bindings on root component.
78+
return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector)
79+
.then((componentRef) => {
80+
var domView = resolveInternalDomView(componentRef.hostView.render);
81+
// We need to do this here to ensure that we create Testability and
82+
// it's ready on the window for users.
83+
registry.registerApplication(domView.boundElements[0], testability);
8484

85-
return componentRef;
86-
});
87-
},
88-
[DynamicComponentLoader, Injector, Testability, TestabilityRegistry]),
85+
return componentRef;
86+
});
87+
},
88+
[DynamicComponentLoader, Injector, Testability, TestabilityRegistry]),
8989

9090
bind(appComponentType).toFactory((ref) => ref.instance, [appComponentRefToken]),
9191
bind(LifeCycle)
9292
.toFactory((exceptionHandler) => new LifeCycle(exceptionHandler, null, assertionsEnabled()),
9393
[ExceptionHandler]),
9494
bind(EventManager)
9595
.toFactory(
96-
(ngZone) =>
97-
{
96+
(ngZone) => {
9897
var plugins =
9998
[new HammerGesturesPlugin(), new KeyEventsPlugin(), new DomEventsPlugin()];
10099
return new EventManager(plugins, ngZone);
101100
},
102101
[NgZone]),
103102
bind(ShadowDomStrategy)
104103
.toFactory((styleUrlResolver, doc) =>
105-
new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head),
104+
new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head),
106105
[StyleUrlResolver, DOCUMENT_TOKEN]),
107106
DomRenderer,
108107
DefaultDomCompiler,
@@ -293,8 +292,7 @@ export function bootstrap(appComponentType: Type,
293292

294293
PromiseWrapper.then(
295294
appInjector.asyncGet(appComponentRefToken),
296-
(componentRef) =>
297-
{
295+
(componentRef) => {
298296
var appChangeDetector = internalView(componentRef.hostView).changeDetector;
299297
// retrieve life cycle: may have already been created if injected in root component
300298
var lc = appInjector.get(LifeCycle);

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,9 @@ export class Compiler {
9494

9595
var directiveMetadata = componentBinding.metadata;
9696
return this._render.compileHost(directiveMetadata)
97-
.then((hostRenderPv) =>
98-
{
99-
return this._compileNestedProtoViews(componentBinding, hostRenderPv,
100-
[componentBinding]);
101-
})
97+
.then((hostRenderPv) => {
98+
return this._compileNestedProtoViews(componentBinding, hostRenderPv, [componentBinding]);
99+
})
102100
.then((appProtoView) => { return new ProtoViewRef(appProtoView); });
103101
}
104102

modules/angular2/src/dom/parse5_adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export class Parse5DomAdapter extends DomAdapter {
239239
createTextNode(text: string) { throw _notImplemented('createTextNode'); }
240240
createScriptTag(attrName: string, attrValue: string) {
241241
return treeAdapter.createElement("script", 'http://www.w3.org/1999/xhtml',
242-
[{name: attrName, value: attrValue}]);
242+
[{name: attrName, value: attrValue}]);
243243
}
244244
createStyleElement(css: string) {
245245
var style = this.createElement('style');

modules/angular2/src/test_lib/test_injector.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function _getAppBindings() {
8686
.toValue(appDoc),
8787
bind(ShadowDomStrategy)
8888
.toFactory((styleUrlResolver, doc) =>
89-
new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head),
89+
new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head),
9090
[StyleUrlResolver, DOCUMENT_TOKEN]),
9191
DomRenderer,
9292
DefaultDomCompiler,
@@ -118,14 +118,14 @@ function _getAppBindings() {
118118
TestComponentBuilder,
119119
bind(NgZone).toClass(MockNgZone),
120120
bind(EventManager)
121-
.toFactory((zone) =>
122-
{
123-
var plugins = [
124-
new DomEventsPlugin(),
125-
];
126-
return new EventManager(plugins, zone);
127-
},
128-
[NgZone]),
121+
.toFactory(
122+
(zone) => {
123+
var plugins = [
124+
new DomEventsPlugin(),
125+
];
126+
return new EventManager(plugins, zone);
127+
},
128+
[NgZone]),
129129
];
130130
}
131131

modules/angular2/src/test_lib/test_lib.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,10 @@ export class SpyObject {
334334
}
335335

336336
function elementText(n) {
337-
var hasNodes = (n) =>
338-
{
337+
var hasNodes = (n) => {
339338
var children = DOM.childNodes(n);
340339
return children && children.length > 0;
341-
}
340+
};
342341

343342
if (n instanceof Array) {
344343
return n.map((nn) => elementText(nn)).join("");

modules/angular2/test/change_detection/change_detector_spec.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,22 @@ export function main() {
239239
{
240240
"dynamic": (bindingRecords, variableBindings = null, directiveRecords = null,
241241
registry = null, strategy = null) =>
242-
new DynamicProtoChangeDetector(
243-
registry,
244-
new ChangeDetectorDefinition(
245-
null, strategy, isBlank(variableBindings) ? [] : variableBindings,
246-
isBlank(bindingRecords) ? [] : bindingRecords,
247-
isBlank(directiveRecords) ? [] : directiveRecords)),
248-
249-
"JIT":
250-
(bindingRecords, variableBindings = null, directiveRecords = null, registry = null,
251-
strategy = null) =>
252-
new JitProtoChangeDetector(
253-
registry, new ChangeDetectorDefinition(
254-
null, strategy, isBlank(variableBindings) ? [] :
255-
variableBindings,
256-
isBlank(bindingRecords) ? [] : bindingRecords,
257-
isBlank(directiveRecords) ? [] : directiveRecords))
242+
new DynamicProtoChangeDetector(
243+
registry, new ChangeDetectorDefinition(
244+
null, strategy,
245+
isBlank(variableBindings) ? [] : variableBindings,
246+
isBlank(bindingRecords) ? [] : bindingRecords,
247+
isBlank(directiveRecords) ? [] : directiveRecords)),
248+
249+
"JIT": (bindingRecords, variableBindings = null, directiveRecords = null, registry = null,
250+
strategy = null) =>
251+
new JitProtoChangeDetector(
252+
registry, new ChangeDetectorDefinition(
253+
null,
254+
strategy, isBlank(variableBindings) ? [] :
255+
variableBindings,
256+
isBlank(bindingRecords) ? [] : bindingRecords,
257+
isBlank(directiveRecords) ? [] : directiveRecords))
258258

259259
},
260260
(createProtoChangeDetector, name) => {

0 commit comments

Comments
 (0)
X Tutup