chore: run clang-format on code base.

This fixes several minor indentation issues (instanceof precendence,
type declaration specificity, template string length calculation).

This should also fix some flip-flop situations with template strings.
This commit is contained in:
Martin Probst
2015-07-10 11:29:41 +02:00
parent 45994a53ce
commit 3bf8c18c56
26 changed files with 128 additions and 138 deletions

View File

@ -241,12 +241,12 @@ export class DirectiveBinding extends ResolvedBinding {
var resolvedHostInjectables =
isPresent(ann.hostInjector) ? Injector.resolve(ann.hostInjector) : [];
var resolvedViewInjectables = ann instanceof Component && isPresent(ann.viewInjector) ?
Injector.resolve(ann.viewInjector) :
[];
Injector.resolve(ann.viewInjector) :
[];
var metadata = DirectiveMetadata.create({
id: stringify(rb.key.token),
type: ann instanceof
Component ? DirectiveMetadata.COMPONENT_TYPE : DirectiveMetadata.DIRECTIVE_TYPE,
type: ann instanceof Component ? DirectiveMetadata.COMPONENT_TYPE :
DirectiveMetadata.DIRECTIVE_TYPE,
selector: ann.selector,
compileChildren: ann.compileChildren,
events: ann.events,
@ -260,8 +260,7 @@ export class DirectiveBinding extends ResolvedBinding {
callOnInit: hasLifecycleHook(onInit, rb.key.token, ann),
callOnAllChangesDone: hasLifecycleHook(onAllChangesDone, rb.key.token, ann),
changeDetection: ann instanceof
Component ? ann.changeDetection : null,
changeDetection: ann instanceof Component ? ann.changeDetection : null,
exportAs: ann.exportAs
});
@ -452,10 +451,8 @@ export class ElementInjector extends TreeNode<ElementInjector> implements Depend
// we couple ourselves to the injector strategy to avoid polymoprhic calls
var injectorStrategy = <any>this._injector.internalStrategy;
this._strategy = injectorStrategy instanceof InjectorInlineStrategy ?
new ElementInjectorInlineStrategy(
injectorStrategy, this) :
new ElementInjectorDynamicStrategy(
injectorStrategy, this);
new ElementInjectorInlineStrategy(injectorStrategy, this) :
new ElementInjectorDynamicStrategy(injectorStrategy, this);
this.hydrated = false;
@ -961,7 +958,7 @@ class ElementInjectorDynamicStrategy implements _ElementInjectorStrategy {
for (var i = 0; i < p.bindings.length; i++) {
if (p.bindings[i] instanceof DirectiveBinding &&
(<DirectiveBinding>p.bindings[i]).callOnDestroy) {
(<DirectiveBinding>p.bindings[i]).callOnDestroy) {
ist.objs[i].onDestroy();
}
}

View File

@ -39,9 +39,9 @@ class BindingRecordsCreator {
return bindings;
}
getDirectiveRecords(
elementBinders: List<renderApi.ElementBinder>,
allDirectiveMetadatas: List<renderApi.DirectiveMetadata>): List<DirectiveRecord> {
getDirectiveRecords(elementBinders: List<renderApi.ElementBinder>,
allDirectiveMetadatas:
List<renderApi.DirectiveMetadata>): List<DirectiveRecord> {
var directiveRecords = [];
for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) {
@ -277,8 +277,8 @@ function _createVariableBindings(renderProtoView): Map<string, string> {
return variableBindings;
}
function _collectNestedProtoViewsVariableNames(
nestedPvsWithIndex: List<RenderProtoViewWithIndex>): List<List<string>> {
function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex: List<RenderProtoViewWithIndex>):
List<List<string>> {
var nestedPvVariableNames = ListWrapper.createFixedSize(nestedPvsWithIndex.length);
ListWrapper.forEach(nestedPvsWithIndex, (pvWithIndex) => {
var parentVariableNames =
@ -301,8 +301,8 @@ function _createVariableNames(parentVariableNames: List<string>, renderProtoView
return res;
}
export function createVariableLocations(
elementBinders: List<renderApi.ElementBinder>): Map<string, number> {
export function createVariableLocations(elementBinders: List<renderApi.ElementBinder>):
Map<string, number> {
var variableLocations = new Map();
for (var i = 0; i < elementBinders.length; i++) {
var binder = elementBinders[i];
@ -374,8 +374,8 @@ function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderE
}
function _createElementBinder(protoView: AppProtoView, boundElementIndex, renderElementBinder,
protoElementInjector, componentDirectiveBinding,
directiveBindings): ElementBinder {
protoElementInjector, componentDirectiveBinding, directiveBindings):
ElementBinder {
var parent = null;
if (renderElementBinder.parentIndex !== -1) {
parent = protoView.elementBinders[renderElementBinder.parentIndex];
@ -393,9 +393,9 @@ function _createElementBinder(protoView: AppProtoView, boundElementIndex, render
return elBinder;
}
export function createDirectiveVariableBindings(
renderElementBinder: renderApi.ElementBinder,
directiveBindings: List<DirectiveBinding>): Map<string, number> {
export function createDirectiveVariableBindings(renderElementBinder: renderApi.ElementBinder,
directiveBindings: List<DirectiveBinding>):
Map<string, number> {
var directiveVariableBindings = new Map();
MapWrapper.forEach(renderElementBinder.variableBindings, (templateName, exportAs) => {
var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs);