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
@@ -213,45 +213,48 @@ class _DirectiveUpdating {
* Map from test id to _DirectiveUpdating.
* Definitions in this map define definitions which allow testing directive updating.
*/
static availableDefinitions: StringMap<string, _DirectiveUpdating> = {
'directNoDispatcher': new _DirectiveUpdating(
[_DirectiveUpdating.updateA('42', _DirectiveUpdating.basicRecords[0])],
[_DirectiveUpdating.basicRecords[0]]),
'groupChanges': new _DirectiveUpdating(
[
_DirectiveUpdating.updateA('1', _DirectiveUpdating.basicRecords[0]),
_DirectiveUpdating.updateB('2', _DirectiveUpdating.basicRecords[0]),
BindingRecord.createDirectiveOnChange(_DirectiveUpdating.basicRecords[0]),
_DirectiveUpdating.updateA('3', _DirectiveUpdating.basicRecords[1]),
BindingRecord.createDirectiveOnChange(_DirectiveUpdating.basicRecords[1])
],
[_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
'directiveOnCheck': new _DirectiveUpdating(
[BindingRecord.createDirectiveOnCheck(_DirectiveUpdating.basicRecords[0])],
[_DirectiveUpdating.basicRecords[0]]),
'directiveOnInit': new _DirectiveUpdating(
[BindingRecord.createDirectiveOnInit(_DirectiveUpdating.basicRecords[0])],
[_DirectiveUpdating.basicRecords[0]]),
'emptyWithDirectiveRecords': new _DirectiveUpdating(
[], [_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
'noCallbacks': new _DirectiveUpdating(
[_DirectiveUpdating.updateA('1', _DirectiveUpdating.recordNoCallbacks)],
[_DirectiveUpdating.recordNoCallbacks]),
'readingDirectives':
new _DirectiveUpdating(
[
BindingRecord.createForHostProperty(
new DirectiveIndex(0, 0), _getParser().parseBinding('a', 'location'), PROP_NAME)
],
static availableDefinitions:
StringMap<string, _DirectiveUpdating> = {
'directNoDispatcher': new _DirectiveUpdating(
[_DirectiveUpdating.updateA('42', _DirectiveUpdating.basicRecords[0])],
[_DirectiveUpdating.basicRecords[0]]),
'interpolation':
new _DirectiveUpdating(
[
BindingRecord.createForElementProperty(
_getParser().parseInterpolation('B{{a}}A', 'location'), 0, PROP_NAME)
],
[])
};
'groupChanges':
new _DirectiveUpdating(
[
_DirectiveUpdating.updateA('1', _DirectiveUpdating.basicRecords[0]),
_DirectiveUpdating.updateB('2', _DirectiveUpdating.basicRecords[0]),
BindingRecord.createDirectiveOnChange(_DirectiveUpdating.basicRecords[0]),
_DirectiveUpdating.updateA('3', _DirectiveUpdating.basicRecords[1]),
BindingRecord.createDirectiveOnChange(_DirectiveUpdating.basicRecords[1])
],
[_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
'directiveOnCheck': new _DirectiveUpdating(
[BindingRecord.createDirectiveOnCheck(_DirectiveUpdating.basicRecords[0])],
[_DirectiveUpdating.basicRecords[0]]),
'directiveOnInit': new _DirectiveUpdating(
[BindingRecord.createDirectiveOnInit(_DirectiveUpdating.basicRecords[0])],
[_DirectiveUpdating.basicRecords[0]]),
'emptyWithDirectiveRecords': new _DirectiveUpdating(
[], [_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
'noCallbacks': new _DirectiveUpdating(
[_DirectiveUpdating.updateA('1', _DirectiveUpdating.recordNoCallbacks)],
[_DirectiveUpdating.recordNoCallbacks]),
'readingDirectives':
new _DirectiveUpdating(
[
BindingRecord.createForHostProperty(new DirectiveIndex(0, 0),
_getParser().parseBinding('a', 'location'),
PROP_NAME)
],
[_DirectiveUpdating.basicRecords[0]]),
'interpolation':
new _DirectiveUpdating(
[
BindingRecord.createForElementProperty(
_getParser().parseInterpolation('B{{a}}A', 'location'), 0, PROP_NAME)
],
[])
};
}
/**
@@ -6,10 +6,9 @@ import {RecordType, ProtoRecord} from 'angular2/src/change_detection/proto_recor
import {DirectiveIndex} from 'angular2/src/change_detection/directive_record';
export function main() {
function r(
funcOrValue, args, contextIndex, selfIndex,
{lastInBinding, mode, name,
directiveIndex}: {lastInBinding?: any, mode?: any, name?: any, directiveIndex?: any} = {}) {
function r(funcOrValue, args, contextIndex, selfIndex,
{lastInBinding, mode, name, directiveIndex}:
{lastInBinding?: any, mode?: any, name?: any, directiveIndex?: any} = {}) {
if (isBlank(lastInBinding)) lastInBinding = false;
if (isBlank(mode)) mode = RecordType.PROPERTY;
if (isBlank(name)) name = "name";
@@ -158,8 +158,7 @@ export class Unparser implements AstVisitor {
visitMethodCall(ast: MethodCall) {
this._visit(ast.receiver);
this._expression += ast.receiver instanceof ImplicitReceiver ? `${ast.name}(` :
`.${ast.name}(`;
this._expression += ast.receiver instanceof ImplicitReceiver ? `${ast.name}(` : `.${ast.name}(`;
var isFirst = true;
ast.args.forEach(arg => {
if (!isFirst) this._expression += ', ';
@@ -58,9 +58,9 @@ export function main() {
rootProtoView = createRootProtoView(directiveResolver, MainComponent);
});
function createCompiler(
renderCompileResults: List<renderApi.ProtoViewDto | Promise<renderApi.ProtoViewDto>>,
protoViewFactoryResults: List<List<AppProtoView>>) {
function createCompiler(renderCompileResults:
List<renderApi.ProtoViewDto | Promise<renderApi.ProtoViewDto>>,
protoViewFactoryResults: List<List<AppProtoView>>) {
var urlResolver = new UrlResolver();
renderCompileRequests = [];
renderCompiler.spy('compile').andCallFake((view) => {
@@ -510,8 +510,8 @@ function createViewportElementBinder(nestedProtoView): ElementBinder {
return elBinder;
}
function createRenderProtoView(elementBinders = null,
type: renderApi.ViewType = null): renderApi.ProtoViewDto {
function createRenderProtoView(elementBinders = null, type: renderApi.ViewType = null):
renderApi.ProtoViewDto {
if (isBlank(type)) {
type = renderApi.ViewType.COMPONENT;
}
@@ -67,8 +67,8 @@ export class DomTestbed {
DOM.appendChild(DOM.querySelector(document, 'body'), this.rootEl);
}
compileAll(directivesOrViewDefinitions: List<DirectiveMetadata |
ViewDefinition>): Promise<List<ProtoViewDto>> {
compileAll(directivesOrViewDefinitions:
List<DirectiveMetadata | ViewDefinition>): Promise<List<ProtoViewDto>> {
return PromiseWrapper.all(ListWrapper.map(directivesOrViewDefinitions, (entry) => {
if (entry instanceof DirectiveMetadata) {
return this.compiler.compileHost(entry);