chore: reformat the code base using the clang-format 1.0.15.

This commit is contained in:
Martin Probst 2015-05-27 11:52:35 -07:00
parent 96f629d441
commit 2c25055828
10 changed files with 117 additions and 139 deletions

View File

@ -752,29 +752,20 @@ export class Directive extends Injectable {
hostInjector: List<any>;
constructor({
selector,
properties,
events,
hostListeners,
hostProperties,
hostAttributes,
hostActions,
lifecycle,
hostInjector,
compileChildren = true,
}:{
selector?:string,
properties?:any,
events?:List<string>,
selector, properties, events, hostListeners, hostProperties, hostAttributes,
hostActions, lifecycle, hostInjector, compileChildren = true,
}: {
selector?: string,
properties?: any,
events?: List<string>,
hostListeners?: StringMap<string, string>,
hostProperties?: StringMap<string, string>,
hostAttributes?: StringMap<string, string>,
hostActions?: StringMap<string, string>,
lifecycle?:List<LifecycleEvent>,
hostInjector?:List<any>,
compileChildren?:boolean
}={})
{
lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>,
compileChildren?: boolean
} = {}) {
super();
this.selector = selector;
this.properties = properties;
@ -995,36 +986,23 @@ export class Component extends Directive {
*/
viewInjector: List<any>;
constructor({
selector,
properties,
events,
hostListeners,
hostProperties,
hostAttributes,
hostActions,
appInjector,
lifecycle,
hostInjector,
viewInjector,
changeDetection = DEFAULT,
compileChildren = true
}:{
selector?:string,
properties?:Object,
events?:List<string>,
hostListeners?:Map<string,string>,
hostProperties?:any,
hostAttributes?:any,
hostActions?:any,
appInjector?:List<any>,
lifecycle?:List<LifecycleEvent>,
hostInjector?:List<any>,
viewInjector?:List<any>,
changeDetection?:string,
compileChildren?:boolean
}={})
{
constructor({selector, properties, events, hostListeners, hostProperties, hostAttributes,
hostActions, appInjector, lifecycle, hostInjector, viewInjector,
changeDetection = DEFAULT, compileChildren = true}: {
selector?: string,
properties?: Object,
events?: List<string>,
hostListeners?: Map<string, string>,
hostProperties?: any,
hostAttributes?: any,
hostActions?: any,
appInjector?: List<any>,
lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>,
viewInjector?: List<any>,
changeDetection?: string,
compileChildren?: boolean
} = {}) {
super({
selector: selector,
properties: properties,

View File

@ -84,18 +84,12 @@ export class View {
*/
renderer: string;
constructor({
templateUrl,
template,
directives,
renderer
}: {
constructor({templateUrl, template, directives, renderer}: {
templateUrl?: string,
template?: string,
directives?: List<Type | any | List<any>>,
renderer?: string
} = {})
{
} = {}) {
this.templateUrl = templateUrl;
this.template = template;
this.directives = directives;

View File

@ -196,8 +196,13 @@ export class Binding {
dependencies: List<any>;
constructor(token, {toClass, toValue, toAlias, toFactory, toAsyncFactory, deps}: {
toClass ?: Type, toValue ?: any, toAlias ?: any, toFactory ?: Function,
toAsyncFactory ?: Function, deps ?: List<any>}) {
toClass?: Type,
toValue?: any,
toAlias?: any,
toFactory?: Function,
toAsyncFactory?: Function,
deps?: List<any>
}) {
this.token = token;
this.toClass = toClass;
this.toValue = toValue;

View File

@ -2,7 +2,7 @@ var _global: BrowserNodeGlobal = <any>(typeof window === 'undefined' ? global :
export {_global as global};
export var Type = Function;
export type Type = new (... args: any[]) => any;
export type Type = new (...args: any[]) => any;
export class BaseException extends Error {
message;
@ -116,7 +116,7 @@ export class StringWrapper {
}
static replaceAllMapped(s: string, from: RegExp, cb: Function): string {
return s.replace(from, function(... matches) {
return s.replace(from, function(...matches) {
// Remove offset & string from the result array
matches.splice(-2, 2);
// The callback receives match, p1, ..., pn

View File

@ -44,17 +44,19 @@ export class ElementBinder {
textBindings: List<ASTWithSource>;
readAttributes: Map<string, string>;
constructor({
index, parentIndex, distanceToParent,
directives, nestedProtoView,
propertyBindings, variableBindings,
eventBindings, textBindings,
readAttributes
}:{index?:number, parentIndex?:number, distanceToParent?:number,
directives?:List<DirectiveBinder>, nestedProtoView?:ProtoViewDto,
propertyBindings?:Map<string, ASTWithSource>, variableBindings?:Map<string, ASTWithSource>,
eventBindings?:List<EventBinding>, textBindings?:List<ASTWithSource>,
readAttributes?:Map<string, string>}={}) {
constructor({index, parentIndex, distanceToParent, directives, nestedProtoView, propertyBindings,
variableBindings, eventBindings, textBindings, readAttributes}: {
index?: number,
parentIndex?: number,
distanceToParent?: number,
directives?: List<DirectiveBinder>,
nestedProtoView?: ProtoViewDto,
propertyBindings?: Map<string, ASTWithSource>,
variableBindings?: Map<string, ASTWithSource>,
eventBindings?: List<EventBinding>,
textBindings?: List<ASTWithSource>,
readAttributes?: Map<string, string>
} = {}) {
this.index = index;
this.parentIndex = parentIndex;
this.distanceToParent = distanceToParent;
@ -77,11 +79,11 @@ export class DirectiveBinder {
// with a local name
eventBindings: List<EventBinding>;
hostPropertyBindings: Map<string, ASTWithSource>;
constructor({
directiveIndex, propertyBindings, eventBindings, hostPropertyBindings
}:{
directiveIndex?:number, propertyBindings?:Map<string, ASTWithSource>,
eventBindings?:List<EventBinding>, hostPropertyBindings?:Map<string, ASTWithSource>
constructor({directiveIndex, propertyBindings, eventBindings, hostPropertyBindings}: {
directiveIndex?: number,
propertyBindings?: Map<string, ASTWithSource>,
eventBindings?: List<EventBinding>,
hostPropertyBindings?: Map<string, ASTWithSource>
}) {
this.directiveIndex = directiveIndex;
this.propertyBindings = propertyBindings;
@ -107,11 +109,11 @@ export class ProtoViewDto {
variableBindings: Map<string, string>;
type: number;
constructor({
render, elementBinders, variableBindings, type
}:{
render?:RenderProtoViewRef, elementBinders?:List<ElementBinder>,
variableBindings?:Map<string, string>, type?:number
constructor({render, elementBinders, variableBindings, type}: {
render?: RenderProtoViewRef,
elementBinders?: List<ElementBinder>,
variableBindings?: Map<string, string>,
type?: number
}) {
this.render = render;
this.elementBinders = elementBinders;
@ -138,16 +140,24 @@ export class DirectiveMetadata {
callOnChange: boolean;
callOnAllChangesDone: boolean;
changeDetection: string;
constructor({
id, selector, compileChildren, events, hostListeners, hostProperties,
hostAttributes, hostActions, properties, readAttributes, type,
callOnDestroy, callOnChange, callOnAllChangesDone,
changeDetection
}:{
id?:string, selector?:string, compileChildren?:boolean, events?:List<string>, hostListeners?:Map<string, string>, hostProperties?:Map<string, string>,
hostAttributes?:Map<string, string>, hostActions?:Map<string, string>, properties?:Map<string, string>, readAttributes?:List<string>, type?:number,
callOnDestroy?:boolean, callOnChange?:boolean, callOnAllChangesDone?:boolean,
changeDetection?:string
constructor({id, selector, compileChildren, events, hostListeners, hostProperties, hostAttributes,
hostActions, properties, readAttributes, type, callOnDestroy, callOnChange,
callOnAllChangesDone, changeDetection}: {
id?: string,
selector?: string,
compileChildren?: boolean,
events?: List<string>,
hostListeners?: Map<string, string>,
hostProperties?: Map<string, string>,
hostAttributes?: Map<string, string>,
hostActions?: Map<string, string>,
properties?: Map<string, string>,
readAttributes?: List<string>,
type?: number,
callOnDestroy?: boolean,
callOnChange?: boolean,
callOnAllChangesDone?: boolean,
changeDetection?: string
}) {
this.id = id;
this.selector = selector;
@ -179,10 +189,11 @@ export class ViewDefinition {
template: string;
directives: List<DirectiveMetadata>;
constructor({
componentId, absUrl, template, directives
}:{
componentId?:string, absUrl?:string, template?:string, directives?:List<DirectiveMetadata>
constructor({componentId, absUrl, template, directives}: {
componentId?: string,
absUrl?: string,
template?: string,
directives?: List<DirectiveMetadata>
}) {
this.componentId = componentId;
this.absUrl = absUrl;

View File

@ -16,19 +16,9 @@ export class ElementBinder {
propertySetters: Map<string, SetterFn>;
hostActions: Map<string, AST>;
constructor({
textNodeIndices,
contentTagSelector,
nestedProtoView,
componentId,
eventLocals,
localEvents,
globalEvents,
hostActions,
parentIndex,
distanceToParent,
propertySetters
}:{
constructor({textNodeIndices, contentTagSelector, nestedProtoView, componentId, eventLocals,
localEvents, globalEvents, hostActions, parentIndex, distanceToParent,
propertySetters}: {
contentTagSelector?: string,
textNodeIndices?: List<number>,
nestedProtoView?: protoViewModule.DomProtoView,
@ -36,8 +26,8 @@ export class ElementBinder {
localEvents?: List<Event>,
globalEvents?: List<Event>,
componentId?: string,
parentIndex?:number,
distanceToParent?:number,
parentIndex?: number,
distanceToParent?: number,
propertySetters?: Map<string, SetterFn>,
hostActions?: Map<string, AST>
} = {}) {

View File

@ -77,8 +77,8 @@ export class TestBed {
* @return {Promise<ViewProxy>}
*/
createView(component: Type,
{context = null,
html = null}: {context?: any, html?: string} = {}): Promise<ViewProxy> {
{context = null, html = null}: {context?: any,
html?: string} = {}): Promise<ViewProxy> {
if (isBlank(component) && isBlank(context)) {
throw new BaseException('You must specified at least a component or a context');
}

View File

@ -72,25 +72,25 @@ class BeforeEachRunner {
// Reset the test bindings before each test
jsmBeforeEach(() => { testBindings = []; });
function _describe(jsmFn, ... args) {
function _describe(jsmFn, ...args) {
var parentRunner = runnerStack.length === 0 ? null : runnerStack[runnerStack.length - 1];
var runner = new BeforeEachRunner(parentRunner);
runnerStack.push(runner);
var suite = jsmFn(... args);
var suite = jsmFn(...args);
runnerStack.pop();
return suite;
}
export function describe(... args) {
return _describe(jsmDescribe, ... args);
export function describe(...args) {
return _describe(jsmDescribe, ...args);
}
export function ddescribe(... args) {
return _describe(jsmDDescribe, ... args);
export function ddescribe(...args) {
return _describe(jsmDDescribe, ...args);
}
export function xdescribe(... args) {
return _describe(jsmXDescribe, ... args);
export function xdescribe(...args) {
return _describe(jsmXDescribe, ...args);
}
export function beforeEach(fn) {
@ -123,7 +123,7 @@ export function beforeEachBindings(fn) {
jsmBeforeEach(() => {
var bindings = fn();
if (!bindings) return;
testBindings = [... testBindings, ... bindings];
testBindings = [...testBindings, ...bindings];
});
}
@ -142,7 +142,7 @@ function _it(jsmFn, name, fn) {
return new AsyncTestCompleter(done);
});
var injector = createTestInjector([... testBindings, completerBinding]);
var injector = createTestInjector([...testBindings, completerBinding]);
runner.run(injector);
if (!(fn instanceof FunctionWithParamTokens)) {

View File

@ -1,7 +1,7 @@
import {global} from 'angular2/src/facade/lang';
export function makeDecorator(annotationCls) {
return function(... args) {
return function(...args) {
var Reflect = global.Reflect;
if (!(Reflect && Reflect.getMetadata)) {
throw 'reflect-metadata shim is required when using class decorators';
@ -20,7 +20,7 @@ export function makeDecorator(annotationCls) {
}
export function makeParamDecorator(annotationCls): any {
return function(... args) {
return function(...args) {
var Reflect = global.Reflect;
if (!(Reflect && Reflect.getMetadata)) {
throw 'reflect-metadata shim is required when using parameter decorators';

View File

@ -9,11 +9,11 @@ var glob = require('glob');
export interface MultiCopyOptions {
/** The path of the file to copy. */
srcPath: string,
srcPath: string;
/** A list of glob patterns of folders to copy to, matched against the input tree. */
targetPatterns: string[],
targetPatterns: string[];
/** List of glob patterns to *not* copy to, matched against the matches from `targetPatterns`. */
exclude?: string[],
exclude?: string[];
}
/**