chore: clang-format after various changes.

This commit is contained in:
Martin Probst 2016-04-28 23:28:13 -07:00
parent 713e6d4aff
commit 365be6a309
14 changed files with 171 additions and 188 deletions

View File

@ -18,4 +18,4 @@ export {ROUTER_PROVIDERS} from './src/alt_router/router_providers';
import {RouterOutlet} from './src/alt_router/directives/router_outlet';
import {RouterLink} from './src/alt_router/directives/router_link';
export const ROUTER_DIRECTIVES: any[] = /*@ts2dart_const*/ [RouterOutlet, RouterLink];
export const ROUTER_DIRECTIVES: any[] = /*@ts2dart_const*/[RouterOutlet, RouterLink];

View File

@ -38,10 +38,10 @@ import {XHR} from 'angular2/compiler';
/**
* An array of providers that should be passed into `application()` when bootstrapping a component.
*/
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/ [
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/[
BROWSER_APP_COMMON_PROVIDERS,
COMPILER_PROVIDERS,
/*@ts2dart_Provider*/{provide: XHR, useClass: XHRImpl},
/*@ts2dart_Provider*/ {provide: XHR, useClass: XHRImpl},
];
export function browserPlatform(): PlatformRef {

View File

@ -53,24 +53,24 @@ export const TEST_BROWSER_STATIC_PLATFORM_PROVIDERS: Array<any /*Type | Provider
];
export const ADDITIONAL_TEST_BROWSER_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/ [
/*@ts2dart_Provider*/{provide: APP_ID, useValue: 'a'},
/*@ts2dart_const*/[
/*@ts2dart_Provider*/ {provide: APP_ID, useValue: 'a'},
ELEMENT_PROBE_PROVIDERS,
/*@ts2dart_Provider*/{provide: DirectiveResolver, useClass: MockDirectiveResolver},
/*@ts2dart_Provider*/{provide: ViewResolver, useClass: MockViewResolver},
/*@ts2dart_Provider*/ {provide: DirectiveResolver, useClass: MockDirectiveResolver},
/*@ts2dart_Provider*/ {provide: ViewResolver, useClass: MockViewResolver},
Log,
TestComponentBuilder,
/*@ts2dart_Provider*/{provide: NgZone, useFactory: createNgZone},
/*@ts2dart_Provider*/{provide: LocationStrategy, useClass: MockLocationStrategy},
/*@ts2dart_Provider*/{provide: AnimationBuilder, useClass: MockAnimationBuilder},
/*@ts2dart_Provider*/ {provide: NgZone, useFactory: createNgZone},
/*@ts2dart_Provider*/ {provide: LocationStrategy, useClass: MockLocationStrategy},
/*@ts2dart_Provider*/ {provide: AnimationBuilder, useClass: MockAnimationBuilder},
];
/**
* Default application providers for testing without a compiler.
*/
export const TEST_BROWSER_STATIC_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/ [
/*@ts2dart_const*/[
BROWSER_APP_COMMON_PROVIDERS,
/*@ts2dart_Provider*/{provide: XHR, useClass: XHRImpl},
/*@ts2dart_Provider*/ {provide: XHR, useClass: XHRImpl},
ADDITIONAL_TEST_BROWSER_PROVIDERS
];

View File

@ -39,23 +39,24 @@ function _createCompilerConfig() {
* A set of providers that provide `RuntimeCompiler` and its dependencies to use for
* template compilation.
*/
export const COMPILER_PROVIDERS: Array<any | Type | {[k: string]: any} | any[]> = /*@ts2dart_const*/ [
Lexer,
Parser,
HtmlParser,
TemplateParser,
DirectiveNormalizer,
CompileMetadataResolver,
DEFAULT_PACKAGE_URL_PROVIDER,
StyleCompiler,
ViewCompiler,
/*@ts2dart_Provider*/{provide: CompilerConfig, useFactory: _createCompilerConfig, deps: []},
RuntimeCompiler,
/*@ts2dart_Provider*/{provide: ComponentResolver, useExisting: RuntimeCompiler},
DomElementSchemaRegistry,
/*@ts2dart_Provider*/{provide: ElementSchemaRegistry, useExisting: DomElementSchemaRegistry},
UrlResolver,
ViewResolver,
DirectiveResolver,
PipeResolver
];
export const COMPILER_PROVIDERS: Array<any | Type | {[k: string]: any} | any[]> =
/*@ts2dart_const*/[
Lexer,
Parser,
HtmlParser,
TemplateParser,
DirectiveNormalizer,
CompileMetadataResolver,
DEFAULT_PACKAGE_URL_PROVIDER,
StyleCompiler,
ViewCompiler,
/*@ts2dart_Provider*/ {provide: CompilerConfig, useFactory: _createCompilerConfig, deps: []},
RuntimeCompiler,
/*@ts2dart_Provider*/ {provide: ComponentResolver, useExisting: RuntimeCompiler},
DomElementSchemaRegistry,
/*@ts2dart_Provider*/ {provide: ElementSchemaRegistry, useExisting: DomElementSchemaRegistry},
UrlResolver,
ViewResolver,
DirectiveResolver,
PipeResolver
];

View File

@ -437,10 +437,8 @@ export class ApplicationRef_ extends ApplicationRef {
export const PLATFORM_CORE_PROVIDERS =
/*@ts2dart_const*/[
PlatformRef_,
/*@ts2dart_const*/ (/* @ts2dart_Provider */ {
provide: PlatformRef,
useExisting: PlatformRef_
})
/*@ts2dart_const*/ (
/* @ts2dart_Provider */ {provide: PlatformRef, useExisting: PlatformRef_})
];
/**

View File

@ -69,7 +69,7 @@ export class ComponentRef_ extends ComponentRef {
onDestroy(callback: Function): void { this.hostView.onDestroy(callback); }
}
const EMPTY_CONTEXT = /*@ts2dart_const*/new Object();
const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object();
/*@ts2dart_const*/
export class ComponentFactory {

View File

@ -54,10 +54,10 @@ export const BROWSER_PLATFORM_MARKER =
*
* Used automatically by `bootstrap`, or can be passed to {@link platform}.
*/
export const BROWSER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/ [
/*@ts2dart_Provider*/{provide: BROWSER_PLATFORM_MARKER, useValue: true},
export const BROWSER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/[
/*@ts2dart_Provider*/ {provide: BROWSER_PLATFORM_MARKER, useValue: true},
PLATFORM_COMMON_PROVIDERS,
/*@ts2dart_Provider*/{provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true},
/*@ts2dart_Provider*/ {provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true},
];
function _exceptionHandler(): ExceptionHandler {
@ -99,7 +99,7 @@ export const BROWSER_APP_COMMON_PROVIDERS: Array<any /*Type | Provider | any[]*/
];
export const CACHED_TEMPLATE_PROVIDER: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/ [/*@ts2dart_Provider*/{provide: XHR, useClass: CachedXHR}];
/*@ts2dart_const*/[/*@ts2dart_Provider*/ {provide: XHR, useClass: CachedXHR}];
export function initDomAdapter() {
BrowserDomAdapter.makeCurrent();

View File

@ -37,10 +37,8 @@ export const WORKER_APP_PLATFORM_MARKER =
export const WORKER_APP_PLATFORM: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[
PLATFORM_COMMON_PROVIDERS,
/*@ts2dart_const*/ (/* @ts2dart_Provider */ {
provide: WORKER_APP_PLATFORM_MARKER,
useValue: true
})
/*@ts2dart_const*/ (
/* @ts2dart_Provider */ {provide: WORKER_APP_PLATFORM_MARKER, useValue: true})
];
export const WORKER_APP_APPLICATION_COMMON: Array<any /*Type | Provider | any[]*/> =

View File

@ -31,10 +31,8 @@ import {PlatformLocation} from 'angular2/platform/common';
*/
export const ROUTER_PROVIDERS: any[] = /*@ts2dart_const*/[
ROUTER_PROVIDERS_COMMON,
/*@ts2dart_const*/ (/* @ts2dart_Provider */ {
provide: PlatformLocation,
useClass: BrowserPlatformLocation
}),
/*@ts2dart_const*/ (
/* @ts2dart_Provider */ {provide: PlatformLocation, useClass: BrowserPlatformLocation}),
];
/**

View File

@ -251,29 +251,32 @@ export function main() {
expect(car).toBe(sportsCar);
});
it('should support multiProviders', () => {
var injector = createInjector([
it(
'should support multiProviders', () => {
var injector = createInjector([
Engine,
/* @ts2dart_Provider */ {provide: Car, useClass: SportsCar, multi: true},
/* @ts2dart_Provider */ {provide: Car, useClass: CarWithOptionalEngine, multi: true}
]);
var cars = injector.get(Car);
expect(cars.length).toEqual(2);
expect(cars[0]).toBeAnInstanceOf(SportsCar);
expect(cars[1]).toBeAnInstanceOf(CarWithOptionalEngine);
});
it('should support multiProviders that are created using useExisting', () => {
var injector = createInjector([
Engine,
SportsCar,
/* @ts2dart_Provider */ {provide: Car, useExisting: SportsCar, multi: true}
]);
var cars = injector.get(Car);
expect(cars.length).toEqual(2);
expect(cars[0]).toBeAnInstanceOf(SportsCar);
expect(cars[1]).toBeAnInstanceOf(CarWithOptionalEngine);
expect(cars.length).toEqual(1);
expect(cars[0]).toBe(injector.get(SportsCar));
});
it('should support multiProviders that are created using useExisting',
() => {
var injector = createInjector(
[Engine, SportsCar, /* @ts2dart_Provider */ {provide: Car, useExisting: SportsCar, multi: true}]);
var cars = injector.get(Car);
expect(cars.length).toEqual(1);
expect(cars[0]).toBe(injector.get(SportsCar));
});
it('should throw when the aliased provider does not exist', () => {
var injector = createInjector([provide('car', {useExisting: SportsCar})]);
var e = `No provider for ${stringify(SportsCar)}! (car -> ${stringify(SportsCar)})`;
@ -513,118 +516,111 @@ export function main() {
});
});
describe('resolve', () => {
it('should resolve and flatten', () => {
var providers = ReflectiveInjector.resolve([Engine, [BrokenEngine]]);
providers.forEach(function(b) {
if (isBlank(b)) return; // the result is a sparse array
expect(b instanceof ResolvedReflectiveProvider_).toBe(true);
});
});
describe('resolve',
() => {
it('should resolve and flatten', () => {
var providers = ReflectiveInjector.resolve([Engine, [BrokenEngine]]);
providers.forEach(function(b) {
if (isBlank(b)) return; // the result is a sparse array
expect(b instanceof ResolvedReflectiveProvider_).toBe(true);
});
});
it("should support multi providers", () => {
var provider = ReflectiveInjector.resolve([
it("should support multi providers",
() => {
var provider = ReflectiveInjector.resolve([
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
/* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true}
])[0];
expect(provider.key.token).toBe(Engine);
expect(provider.multiProvider).toEqual(true);
expect(provider.resolvedFactories.length).toEqual(2);
});
expect(provider.key.token).toBe(Engine);
expect(provider.multiProvider).toEqual(true);
expect(provider.resolvedFactories.length).toEqual(2);
});
it("should support providers as hash", () => {
var provider = ReflectiveInjector.resolve([
it("should support providers as hash",
() => {
var provider = ReflectiveInjector.resolve([
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
/* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true}
])[0];
expect(provider.key.token).toBe(Engine);
expect(provider.multiProvider).toEqual(true);
expect(provider.resolvedFactories.length).toEqual(2);
});
expect(provider.key.token).toBe(Engine);
expect(provider.multiProvider).toEqual(true);
expect(provider.resolvedFactories.length).toEqual(2);
});
it("should support multi providers with only one provider", () => {
var provider = ReflectiveInjector.resolve([
/* @ts2dart_Provider */ {
provide: Engine,
useClass: BrokenEngine,
multi: true
}
])[0];
it("should support multi providers with only one provider", () => {
var provider = ReflectiveInjector.resolve([
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true}
])[0];
expect(provider.key.token).toBe(Engine);
expect(provider.multiProvider).toEqual(true);
expect(provider.resolvedFactories.length).toEqual(1);
});
expect(provider.key.token).toBe(Engine);
expect(provider.multiProvider).toEqual(true);
expect(provider.resolvedFactories.length).toEqual(1);
});
it("should throw when mixing multi providers with regular providers",
() => {
expect(() => {
ReflectiveInjector.resolve([
/* @ts2dart_Provider */ {
provide: Engine,
useClass: BrokenEngine,
multi: true
},
Engine
]);
})
.toThrowErrorWith(
"Cannot mix multi providers and regular providers");
it("should throw when mixing multi providers with regular providers", () => {
expect(() => {
ReflectiveInjector.resolve([
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
Engine
]);
}).toThrowErrorWith("Cannot mix multi providers and regular providers");
expect(() => {
ReflectiveInjector.resolve(
expect(() => {
ReflectiveInjector.resolve(
[Engine, /* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true}]);
})
.toThrowErrorWith(
"Cannot mix multi providers and regular providers");
});
}).toThrowErrorWith("Cannot mix multi providers and regular providers");
});
it('should resolve forward references', () => {
var providers = ReflectiveInjector.resolve([
forwardRef(() => Engine),
[provide(forwardRef(() => BrokenEngine), {useClass: forwardRef(() => Engine)})],
provide(forwardRef(() => String),
{useFactory: () => 'OK', deps: [forwardRef(() => Engine)]})
]);
it('should resolve forward references', () => {
var providers = ReflectiveInjector.resolve([
forwardRef(() => Engine),
[provide(forwardRef(() => BrokenEngine), {useClass: forwardRef(() => Engine)})],
provide(forwardRef(() => String),
{useFactory: () => 'OK', deps: [forwardRef(() => Engine)]})
]);
var engineProvider = providers[0];
var brokenEngineProvider = providers[1];
var stringProvider = providers[2];
var engineProvider = providers[0];
var brokenEngineProvider = providers[1];
var stringProvider = providers[2];
expect(engineProvider.resolvedFactories[0].factory() instanceof Engine).toBe(true);
expect(brokenEngineProvider.resolvedFactories[0].factory() instanceof Engine).toBe(true);
expect(stringProvider.resolvedFactories[0].dependencies[0].key)
.toEqual(ReflectiveKey.get(Engine));
});
expect(engineProvider.resolvedFactories[0].factory() instanceof Engine).toBe(true);
expect(brokenEngineProvider.resolvedFactories[0].factory() instanceof Engine)
.toBe(true);
expect(stringProvider.resolvedFactories[0].dependencies[0].key)
.toEqual(ReflectiveKey.get(Engine));
});
it('should support overriding factory dependencies with dependency annotations', () => {
var providers = ReflectiveInjector.resolve([
provide("token",
{
useFactory: (e) => "result",
deps: [[new InjectMetadata("dep"), new CustomDependencyMetadata()]]
})
]);
it('should support overriding factory dependencies with dependency annotations',
() => {
var providers = ReflectiveInjector.resolve([
provide(
"token",
{
useFactory: (e) => "result",
deps: [[new InjectMetadata("dep"), new CustomDependencyMetadata()]]
})
]);
var provider = providers[0];
var provider = providers[0];
expect(provider.resolvedFactories[0].dependencies[0].key.token).toEqual("dep");
expect(provider.resolvedFactories[0].dependencies[0].properties)
.toEqual([new CustomDependencyMetadata()]);
});
expect(provider.resolvedFactories[0].dependencies[0].key.token).toEqual("dep");
expect(provider.resolvedFactories[0].dependencies[0].properties)
.toEqual([new CustomDependencyMetadata()]);
});
it('should allow declaring dependencies with flat arrays', () => {
var resolved = ReflectiveInjector.resolve(
[provide('token', {useFactory: e => e, deps: [new InjectMetadata("dep")]})]);
var nestedResolved = ReflectiveInjector.resolve(
[provide('token', {useFactory: e => e, deps: [[new InjectMetadata("dep")]]})]);
expect(resolved[0].resolvedFactories[0].dependencies[0].key.token)
.toEqual(nestedResolved[0].resolvedFactories[0].dependencies[0].key.token);
});
});
it('should allow declaring dependencies with flat arrays', () => {
var resolved = ReflectiveInjector.resolve(
[provide('token', {useFactory: e => e, deps: [new InjectMetadata("dep")]})]);
var nestedResolved = ReflectiveInjector.resolve(
[provide('token', {useFactory: e => e, deps: [[new InjectMetadata("dep")]]})]);
expect(resolved[0].resolvedFactories[0].dependencies[0].key.token)
.toEqual(nestedResolved[0].resolvedFactories[0].dependencies[0].key.token);
});
});
describe("displayName", () => {
it("should work", () => {

View File

@ -1071,7 +1071,7 @@ export function main() {
});
}
const ALL_DIRECTIVES = /*@ts2dart_const*/ [
const ALL_DIRECTIVES = /*@ts2dart_const*/[
forwardRef(() => TestDirective),
forwardRef(() => TestComponent),
forwardRef(() => AnotherComponent),
@ -1084,7 +1084,7 @@ const ALL_DIRECTIVES = /*@ts2dart_const*/ [
forwardRef(() => OrderCheckDirective1),
];
const ALL_PIPES = /*@ts2dart_const*/ [
const ALL_PIPES = /*@ts2dart_const*/[
forwardRef(() => CountingPipe),
forwardRef(() => CountingImpurePipe),
forwardRef(() => MultiArgPipe),

View File

@ -2273,11 +2273,7 @@ class PublicApi {
@Directive({
selector: '[public-api]',
providers: [
/* @ts2dart_Provider */ {
provide: PublicApi,
useExisting: PrivateImpl,
deps: []
}
/* @ts2dart_Provider */ {provide: PublicApi, useExisting: PrivateImpl, deps: []}
]
})
@Injectable()
@ -2379,10 +2375,8 @@ class DirectiveProvidingInjectableInView {
@Component({
selector: 'directive-providing-injectable',
providers:
[/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'host'}],
viewProviders:
[/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'view'}],
providers: [/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'host'}],
viewProviders: [/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'view'}],
template: ''
})
@Injectable()
@ -2433,10 +2427,7 @@ class EventBus {
@Directive({
selector: 'grand-parent-providing-event-bus',
providers: [
/* @ts2dart_Provider */ {
provide: EventBus,
useValue: new EventBus(null, "grandparent")
}
/* @ts2dart_Provider */ {provide: EventBus, useValue: new EventBus(null, "grandparent")}
]
})
class GrandParentProvidingEventBus {

View File

@ -49,7 +49,7 @@ import {
import {NgIf} from 'angular2/common';
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
const ALL_DIRECTIVES = /*@ts2dart_const*/ [
const ALL_DIRECTIVES = /*@ts2dart_const*/[
forwardRef(() => SimpleDirective),
forwardRef(() => CycleDirective),
forwardRef(() => SimpleComponent),
@ -83,7 +83,7 @@ const ALL_DIRECTIVES = /*@ts2dart_const*/ [
NgIf
];
const ALL_PIPES = /*@ts2dart_const*/ [
const ALL_PIPES = /*@ts2dart_const*/[
forwardRef(() => PipeNeedsChangeDetectorRef),
forwardRef(() => PipeNeedsService),
forwardRef(() => PurePipe),

View File

@ -64,24 +64,25 @@ function stripModulePrefix(relativePath: string): string {
function getSourceTree(options: AngularBuilderOptions) {
var tsInputTree = modulesFunnel(
[
'tsconfig-ts2dart.json',
'upgrade-ts2dart.d.ts',
'zone-ts2dart.d.ts',
'**/*.js',
'**/*.ts',
'**/*.dart'
], [
'rollup-test/**/*',
'angular1_router/**/*',
'angular2/upgrade/**/*',
'angular2/core/test/typings.d.ts',
'angular2/manual_typings/globals.d.ts',
'angular2/typings/es6-collections/es6-collections.d.ts',
'angular2/typings/es6-promise/es6-promise.d.ts',
'angular2/typings/tsd.d.ts',
'angular2/typings.d.ts',
]);
[
'tsconfig-ts2dart.json',
'upgrade-ts2dart.d.ts',
'zone-ts2dart.d.ts',
'**/*.js',
'**/*.ts',
'**/*.dart'
],
[
'rollup-test/**/*',
'angular1_router/**/*',
'angular2/upgrade/**/*',
'angular2/core/test/typings.d.ts',
'angular2/manual_typings/globals.d.ts',
'angular2/typings/es6-collections/es6-collections.d.ts',
'angular2/typings/es6-promise/es6-promise.d.ts',
'angular2/typings/tsd.d.ts',
'angular2/typings.d.ts',
]);
var transpiled = ts2dart(tsInputTree, {
generateLibraryName: true,
generateSourceMap: false,