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

@ -39,7 +39,8 @@ function _createCompilerConfig() {
* A set of providers that provide `RuntimeCompiler` and its dependencies to use for * A set of providers that provide `RuntimeCompiler` and its dependencies to use for
* template compilation. * template compilation.
*/ */
export const COMPILER_PROVIDERS: Array<any | Type | {[k: string]: any} | any[]> = /*@ts2dart_const*/ [ export const COMPILER_PROVIDERS: Array<any | Type | {[k: string]: any} | any[]> =
/*@ts2dart_const*/[
Lexer, Lexer,
Parser, Parser,
HtmlParser, HtmlParser,

View File

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

View File

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

View File

@ -251,7 +251,8 @@ export function main() {
expect(car).toBe(sportsCar); expect(car).toBe(sportsCar);
}); });
it('should support multiProviders', () => { it(
'should support multiProviders', () => {
var injector = createInjector([ var injector = createInjector([
Engine, Engine,
/* @ts2dart_Provider */ {provide: Car, useClass: SportsCar, multi: true}, /* @ts2dart_Provider */ {provide: Car, useClass: SportsCar, multi: true},
@ -264,10 +265,12 @@ export function main() {
expect(cars[1]).toBeAnInstanceOf(CarWithOptionalEngine); expect(cars[1]).toBeAnInstanceOf(CarWithOptionalEngine);
}); });
it('should support multiProviders that are created using useExisting', it('should support multiProviders that are created using useExisting', () => {
() => { var injector = createInjector([
var injector = createInjector( Engine,
[Engine, SportsCar, /* @ts2dart_Provider */ {provide: Car, useExisting: SportsCar, multi: true}]); SportsCar,
/* @ts2dart_Provider */ {provide: Car, useExisting: SportsCar, multi: true}
]);
var cars = injector.get(Car); var cars = injector.get(Car);
expect(cars.length).toEqual(1); expect(cars.length).toEqual(1);
@ -513,7 +516,8 @@ export function main() {
}); });
}); });
describe('resolve', () => { describe('resolve',
() => {
it('should resolve and flatten', () => { it('should resolve and flatten', () => {
var providers = ReflectiveInjector.resolve([Engine, [BrokenEngine]]); var providers = ReflectiveInjector.resolve([Engine, [BrokenEngine]]);
providers.forEach(function(b) { providers.forEach(function(b) {
@ -522,7 +526,8 @@ export function main() {
}); });
}); });
it("should support multi providers", () => { it("should support multi providers",
() => {
var provider = ReflectiveInjector.resolve([ var provider = ReflectiveInjector.resolve([
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true}, /* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
/* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true} /* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true}
@ -534,7 +539,8 @@ export function main() {
}); });
it("should support providers as hash", () => { it("should support providers as hash",
() => {
var provider = ReflectiveInjector.resolve([ var provider = ReflectiveInjector.resolve([
/* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true}, /* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
/* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true} /* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true}
@ -547,11 +553,7 @@ export function main() {
it("should support multi providers with only one provider", () => { it("should support multi providers with only one provider", () => {
var provider = ReflectiveInjector.resolve([ var provider = ReflectiveInjector.resolve([
/* @ts2dart_Provider */ { /* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true}
provide: Engine,
useClass: BrokenEngine,
multi: true
}
])[0]; ])[0];
expect(provider.key.token).toBe(Engine); expect(provider.key.token).toBe(Engine);
@ -559,27 +561,18 @@ export function main() {
expect(provider.resolvedFactories.length).toEqual(1); expect(provider.resolvedFactories.length).toEqual(1);
}); });
it("should throw when mixing multi providers with regular providers", it("should throw when mixing multi providers with regular providers", () => {
() => {
expect(() => { expect(() => {
ReflectiveInjector.resolve([ ReflectiveInjector.resolve([
/* @ts2dart_Provider */ { /* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
provide: Engine,
useClass: BrokenEngine,
multi: true
},
Engine Engine
]); ]);
}) }).toThrowErrorWith("Cannot mix multi providers and regular providers");
.toThrowErrorWith(
"Cannot mix multi providers and regular providers");
expect(() => { expect(() => {
ReflectiveInjector.resolve( ReflectiveInjector.resolve(
[Engine, /* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true}]); [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', () => { it('should resolve forward references', () => {
@ -595,14 +588,17 @@ export function main() {
var stringProvider = providers[2]; var stringProvider = providers[2];
expect(engineProvider.resolvedFactories[0].factory() instanceof Engine).toBe(true); expect(engineProvider.resolvedFactories[0].factory() instanceof Engine).toBe(true);
expect(brokenEngineProvider.resolvedFactories[0].factory() instanceof Engine).toBe(true); expect(brokenEngineProvider.resolvedFactories[0].factory() instanceof Engine)
.toBe(true);
expect(stringProvider.resolvedFactories[0].dependencies[0].key) expect(stringProvider.resolvedFactories[0].dependencies[0].key)
.toEqual(ReflectiveKey.get(Engine)); .toEqual(ReflectiveKey.get(Engine));
}); });
it('should support overriding factory dependencies with dependency annotations', () => { it('should support overriding factory dependencies with dependency annotations',
() => {
var providers = ReflectiveInjector.resolve([ var providers = ReflectiveInjector.resolve([
provide("token", provide(
"token",
{ {
useFactory: (e) => "result", useFactory: (e) => "result",
deps: [[new InjectMetadata("dep"), new CustomDependencyMetadata()]] deps: [[new InjectMetadata("dep"), new CustomDependencyMetadata()]]

View File

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

View File

@ -71,7 +71,8 @@ function getSourceTree(options: AngularBuilderOptions) {
'**/*.js', '**/*.js',
'**/*.ts', '**/*.ts',
'**/*.dart' '**/*.dart'
], [ ],
[
'rollup-test/**/*', 'rollup-test/**/*',
'angular1_router/**/*', 'angular1_router/**/*',
'angular2/upgrade/**/*', 'angular2/upgrade/**/*',