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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -77,8 +77,8 @@ export class TestBed {
* @return {Promise<ViewProxy>} * @return {Promise<ViewProxy>}
*/ */
createView(component: Type, createView(component: Type,
{context = null, {context = null, html = null}: {context?: any,
html = null}: {context?: any, html?: string} = {}): Promise<ViewProxy> { html?: string} = {}): Promise<ViewProxy> {
if (isBlank(component) && isBlank(context)) { if (isBlank(component) && isBlank(context)) {
throw new BaseException('You must specified at least a component or a 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 // Reset the test bindings before each test
jsmBeforeEach(() => { testBindings = []; }); jsmBeforeEach(() => { testBindings = []; });
function _describe(jsmFn, ... args) { function _describe(jsmFn, ...args) {
var parentRunner = runnerStack.length === 0 ? null : runnerStack[runnerStack.length - 1]; var parentRunner = runnerStack.length === 0 ? null : runnerStack[runnerStack.length - 1];
var runner = new BeforeEachRunner(parentRunner); var runner = new BeforeEachRunner(parentRunner);
runnerStack.push(runner); runnerStack.push(runner);
var suite = jsmFn(... args); var suite = jsmFn(...args);
runnerStack.pop(); runnerStack.pop();
return suite; return suite;
} }
export function describe(... args) { export function describe(...args) {
return _describe(jsmDescribe, ... args); return _describe(jsmDescribe, ...args);
} }
export function ddescribe(... args) { export function ddescribe(...args) {
return _describe(jsmDDescribe, ... args); return _describe(jsmDDescribe, ...args);
} }
export function xdescribe(... args) { export function xdescribe(...args) {
return _describe(jsmXDescribe, ... args); return _describe(jsmXDescribe, ...args);
} }
export function beforeEach(fn) { export function beforeEach(fn) {
@ -123,7 +123,7 @@ export function beforeEachBindings(fn) {
jsmBeforeEach(() => { jsmBeforeEach(() => {
var bindings = fn(); var bindings = fn();
if (!bindings) return; if (!bindings) return;
testBindings = [... testBindings, ... bindings]; testBindings = [...testBindings, ...bindings];
}); });
} }
@ -142,7 +142,7 @@ function _it(jsmFn, name, fn) {
return new AsyncTestCompleter(done); return new AsyncTestCompleter(done);
}); });
var injector = createTestInjector([... testBindings, completerBinding]); var injector = createTestInjector([...testBindings, completerBinding]);
runner.run(injector); runner.run(injector);
if (!(fn instanceof FunctionWithParamTokens)) { if (!(fn instanceof FunctionWithParamTokens)) {

View File

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

View File

@ -9,11 +9,11 @@ var glob = require('glob');
export interface MultiCopyOptions { export interface MultiCopyOptions {
/** The path of the file to copy. */ /** 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. */ /** 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`. */ /** List of glob patterns to *not* copy to, matched against the matches from `targetPatterns`. */
exclude?: string[], exclude?: string[];
} }
/** /**