chore: remove const Provider() in favor of /* @ts2dart_Provider */ {provide:}

This commit is contained in:
Misko Hevery 2016-04-25 22:25:21 -07:00 committed by Martin Probst
parent 3aa322a9c6
commit a8e277b067
59 changed files with 304 additions and 233 deletions

View File

@ -47,7 +47,7 @@ function createNgZone(): NgZone {
* Default platform providers for testing without a compiler. * Default platform providers for testing without a compiler.
*/ */
export const TEST_BROWSER_STATIC_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> = export const TEST_BROWSER_STATIC_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/ [ /*@ts2dart_const*/[
PLATFORM_COMMON_PROVIDERS, PLATFORM_COMMON_PROVIDERS,
/*@ts2dart_Provider*/{provide: PLATFORM_INITIALIZER, useValue: initBrowserTests, multi: true} /*@ts2dart_Provider*/{provide: PLATFORM_INITIALIZER, useValue: initBrowserTests, multi: true}
]; ];

View File

@ -49,9 +49,9 @@ function initServerTests() {
* Default platform providers for testing. * Default platform providers for testing.
*/ */
export const TEST_SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> = export const TEST_SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/ [ /*@ts2dart_const*/[
PLATFORM_COMMON_PROVIDERS, PLATFORM_COMMON_PROVIDERS,
/*@ts2dart_Provider*/{provide: PLATFORM_INITIALIZER, useValue: initServerTests, multi: true} /*@ts2dart_Provider*/ {provide: PLATFORM_INITIALIZER, useValue: initServerTests, multi: true}
]; ];
function appDoc() { function appDoc() {
@ -66,26 +66,26 @@ function appDoc() {
* Default application providers for testing. * Default application providers for testing.
*/ */
export const TEST_SERVER_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = export const TEST_SERVER_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/ [ /*@ts2dart_const*/[
// TODO(julie: when angular2/platform/server is available, use that instead of making our own // TODO(julie: when angular2/platform/server is available, use that instead of making our own
// list here. // list here.
APPLICATION_COMMON_PROVIDERS, APPLICATION_COMMON_PROVIDERS,
COMPILER_PROVIDERS, COMPILER_PROVIDERS,
/*@ts2dart_Provider*/{provide: DOCUMENT, useFactory: appDoc}, /* @ts2dart_Provider */ {provide: DOCUMENT, useFactory: appDoc},
/*@ts2dart_Provider*/{provide: DomRootRenderer, useClass: DomRootRenderer_}, /* @ts2dart_Provider */ {provide: DomRootRenderer, useClass: DomRootRenderer_},
/*@ts2dart_Provider*/{provide: RootRenderer, useExisting: DomRootRenderer}, /* @ts2dart_Provider */ {provide: RootRenderer, useExisting: DomRootRenderer},
EventManager, EventManager,
/*@ts2dart_Provider*/{provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true}, /* @ts2dart_Provider */ {provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true},
/*@ts2dart_Provider*/{provide: XHR, useClass: XHR}, /* @ts2dart_Provider */ {provide: XHR, useClass: XHR},
/*@ts2dart_Provider*/{provide: APP_ID, useValue: 'a'}, /* @ts2dart_Provider */ {provide: APP_ID, useValue: 'a'},
/*@ts2dart_Provider*/{provide: SharedStylesHost, useExisting: DomSharedStylesHost}, /* @ts2dart_Provider */ {provide: SharedStylesHost, useExisting: DomSharedStylesHost},
DomSharedStylesHost, DomSharedStylesHost,
ELEMENT_PROBE_PROVIDERS, ELEMENT_PROBE_PROVIDERS,
/*@ts2dart_Provider*/{provide: DirectiveResolver, useClass: MockDirectiveResolver}, /* @ts2dart_Provider */ {provide: DirectiveResolver, useClass: MockDirectiveResolver},
/*@ts2dart_Provider*/{provide: ViewResolver, useClass: MockViewResolver}, /* @ts2dart_Provider */ {provide: ViewResolver, useClass: MockViewResolver},
Log, Log,
TestComponentBuilder, TestComponentBuilder,
/*@ts2dart_Provider*/{provide: NgZone, useFactory: createNgZone}, /* @ts2dart_Provider */ {provide: NgZone, useFactory: createNgZone},
/*@ts2dart_Provider*/{provide: LocationStrategy, useClass: MockLocationStrategy}, /* @ts2dart_Provider */ {provide: LocationStrategy, useClass: MockLocationStrategy},
/*@ts2dart_Provider*/{provide: AnimationBuilder, useClass: MockAnimationBuilder}, /* @ts2dart_Provider */ {provide: AnimationBuilder, useClass: MockAnimationBuilder},
]; ];

View File

@ -57,7 +57,7 @@ export function bootstrapRender(
var app = ReflectiveInjector.resolveAndCreate( var app = ReflectiveInjector.resolveAndCreate(
[ [
WORKER_RENDER_APPLICATION, WORKER_RENDER_APPLICATION,
new Provider(WORKER_SCRIPT, {useValue: workerScriptUri}), /* @ts2dart_Provider */ {provide: WORKER_SCRIPT, useValue: workerScriptUri},
isPresent(customProviders) ? customProviders : [] isPresent(customProviders) ? customProviders : []
], ],
workerRenderPlatform().injector); workerRenderPlatform().injector);

View File

@ -1,5 +1,4 @@
import {TEMPLATE_TRANSFORMS} from 'angular2/compiler'; import {TEMPLATE_TRANSFORMS} from 'angular2/compiler';
import {Provider} from 'angular2/core';
import {RouterLinkTransform} from 'angular2/src/router/directives/router_link_transform'; import {RouterLinkTransform} from 'angular2/src/router/directives/router_link_transform';
export {RouterLinkTransform} from 'angular2/src/router/directives/router_link_transform'; export {RouterLinkTransform} from 'angular2/src/router/directives/router_link_transform';
@ -31,5 +30,8 @@ export {RouterLinkTransform} from 'angular2/src/router/directives/router_link_tr
* ``` * ```
*/ */
export const ROUTER_LINK_DSL_PROVIDER = export const ROUTER_LINK_DSL_PROVIDER =
/*@ts2dart_const*/ /*@ts2dart_const*/ /* @ts2dart_Provider */ {
new Provider(TEMPLATE_TRANSFORMS, {useClass: RouterLinkTransform, multi: true}); provide: TEMPLATE_TRANSFORMS,
useClass: RouterLinkTransform,
multi: true
};

View File

@ -2,8 +2,11 @@ import {Directive, Renderer, ElementRef, Self, forwardRef, Provider} from 'angul
import {NG_VALUE_ACCESSOR, ControlValueAccessor} from './control_value_accessor'; import {NG_VALUE_ACCESSOR, ControlValueAccessor} from './control_value_accessor';
export const CHECKBOX_VALUE_ACCESSOR = /*@ts2dart_const*/ new Provider( export const CHECKBOX_VALUE_ACCESSOR: any = /*@ts2dart_const*/ {
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => CheckboxControlValueAccessor), multi: true}); provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => CheckboxControlValueAccessor),
multi: true
};
/** /**
* The accessor for writing a value and listening to changes on a checkbox input element. * The accessor for writing a value and listening to changes on a checkbox input element.

View File

@ -2,8 +2,12 @@ import {Directive, ElementRef, Renderer, Self, forwardRef, Provider} from 'angul
import {NG_VALUE_ACCESSOR, ControlValueAccessor} from './control_value_accessor'; import {NG_VALUE_ACCESSOR, ControlValueAccessor} from './control_value_accessor';
import {isBlank} from 'angular2/src/facade/lang'; import {isBlank} from 'angular2/src/facade/lang';
export const DEFAULT_VALUE_ACCESSOR = /*@ts2dart_const*/ new Provider( export const DEFAULT_VALUE_ACCESSOR: any = /*@ts2dart_const*/
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => DefaultValueAccessor), multi: true}); /* @ts2dart_Provider */ {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => DefaultValueAccessor),
multi: true
};
/** /**
* The default accessor for writing a value and listening to changes that is used by the * The default accessor for writing a value and listening to changes that is used by the

View File

@ -18,9 +18,11 @@ import {Form} from './form_interface';
import {NG_VALIDATORS, NG_ASYNC_VALIDATORS} from '../validators'; import {NG_VALIDATORS, NG_ASYNC_VALIDATORS} from '../validators';
import {AsyncValidatorFn, ValidatorFn} from './validators'; import {AsyncValidatorFn, ValidatorFn} from './validators';
export const controlGroupProvider = export const controlGroupProvider: any =
/*@ts2dart_const*/ /*@ts2dart_const*/ /* @ts2dart_Provider */ {
new Provider(ControlContainer, {useExisting: forwardRef(() => NgControlGroup)}); provide: ControlContainer,
useExisting: forwardRef(() => NgControlGroup)
};
/** /**
* Creates and binds a control group to a DOM element. * Creates and binds a control group to a DOM element.

View File

@ -30,8 +30,11 @@ import {NG_VALIDATORS, NG_ASYNC_VALIDATORS} from '../validators';
import {ValidatorFn, AsyncValidatorFn} from './validators'; import {ValidatorFn, AsyncValidatorFn} from './validators';
export const controlNameBinding = export const controlNameBinding: any =
/*@ts2dart_const*/ new Provider(NgControl, {useExisting: forwardRef(() => NgControlName)}); /*@ts2dart_const*/ /* @ts2dart_Provider */ {
provide: NgControl,
useExisting: forwardRef(() => NgControlName)
};
/** /**
* Creates and binds a control with a specified name to a DOM element. * Creates and binds a control with a specified name to a DOM element.

View File

@ -15,8 +15,11 @@ import {AbstractControl, ControlGroup, Control} from '../model';
import {setUpControl, setUpControlGroup, composeValidators, composeAsyncValidators} from './shared'; import {setUpControl, setUpControlGroup, composeValidators, composeAsyncValidators} from './shared';
import {Validators, NG_VALIDATORS, NG_ASYNC_VALIDATORS} from '../validators'; import {Validators, NG_VALIDATORS, NG_ASYNC_VALIDATORS} from '../validators';
const formDirectiveProvider = export const formDirectiveProvider: any =
/*@ts2dart_const*/ new Provider(ControlContainer, {useExisting: forwardRef(() => NgForm)}); /*@ts2dart_const*/ /* @ts2dart_Provider */ {
provide: ControlContainer,
useExisting: forwardRef(() => NgForm)
};
/** /**
* If `NgForm` is bound in a component, `<form>` elements in that component will be * If `NgForm` is bound in a component, `<form>` elements in that component will be

View File

@ -24,8 +24,11 @@ import {
} from './shared'; } from './shared';
import {ValidatorFn, AsyncValidatorFn} from './validators'; import {ValidatorFn, AsyncValidatorFn} from './validators';
const formControlBinding = export const formControlBinding: any =
/*@ts2dart_const*/ new Provider(NgControl, {useExisting: forwardRef(() => NgFormControl)}); /*@ts2dart_const*/ /* @ts2dart_Provider */ {
provide: NgControl,
useExisting: forwardRef(() => NgFormControl)
};
/** /**
* Binds an existing {@link Control} to a DOM element. * Binds an existing {@link Control} to a DOM element.

View File

@ -20,9 +20,11 @@ import {Control, ControlGroup} from '../model';
import {setUpControl, setUpControlGroup, composeValidators, composeAsyncValidators} from './shared'; import {setUpControl, setUpControlGroup, composeValidators, composeAsyncValidators} from './shared';
import {Validators, NG_VALIDATORS, NG_ASYNC_VALIDATORS} from '../validators'; import {Validators, NG_VALIDATORS, NG_ASYNC_VALIDATORS} from '../validators';
export const formDirectiveProvider = export const formDirectiveProvider: any =
/*@ts2dart_const*/ /*@ts2dart_const*/ /* @ts2dart_Provider */ {
new Provider(ControlContainer, {useExisting: forwardRef(() => NgFormModel)}); provide: ControlContainer,
useExisting: forwardRef(() => NgFormModel)
};
/** /**
* Binds an existing control group to a DOM element. * Binds an existing control group to a DOM element.

View File

@ -22,8 +22,11 @@ import {
} from './shared'; } from './shared';
import {ValidatorFn, AsyncValidatorFn} from './validators'; import {ValidatorFn, AsyncValidatorFn} from './validators';
export const formControlBinding = export const formControlBinding: any =
/*@ts2dart_const*/ new Provider(NgControl, {useExisting: forwardRef(() => NgModel)}); /*@ts2dart_const*/ /* @ts2dart_Provider */ {
provide: NgControl,
useExisting: forwardRef(() => NgModel)
};
/** /**
* Binds a domain model to a form control. * Binds a domain model to a form control.

View File

@ -21,7 +21,7 @@ import {looseIdentical, isPresent} from 'angular2/src/facade/lang';
import {ListWrapper} from 'angular2/src/facade/collection'; import {ListWrapper} from 'angular2/src/facade/collection';
export const RADIO_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ { export const RADIO_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
povide: NG_VALUE_ACCESSOR, provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => RadioControlValueAccessor), useExisting: forwardRef(() => RadioControlValueAccessor),
multi: true multi: true
}; };

View File

@ -62,12 +62,11 @@ export interface AsyncValidatorFn {
* *
* {@example common/forms/ts/validators/validators.ts region='min'} * {@example common/forms/ts/validators/validators.ts region='min'}
*/ */
export const MIN_LENGTH_VALIDATOR: any = /*@ts2dart_const*/ export const MIN_LENGTH_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
/*@ts2dart_Provider*/ { provide: NG_VALIDATORS,
provide: NG_VALIDATORS, useExisting: forwardRef(() => MinLengthValidator),
useExisting: forwardRef(() => MinLengthValidator), multi: true
multi: true };
};
/** /**
* A directive which installs the {@link MinLengthValidator} for any `ngControl`, * A directive which installs the {@link MinLengthValidator} for any `ngControl`,
@ -94,12 +93,11 @@ export class MinLengthValidator implements Validator {
* *
* {@example common/forms/ts/validators/validators.ts region='max'} * {@example common/forms/ts/validators/validators.ts region='max'}
*/ */
export const MAX_LENGTH_VALIDATOR: any = /*@ts2dart_const*/ export const MAX_LENGTH_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
/*@ts2dart_Provider*/ { provide: NG_VALIDATORS,
provide: NG_VALIDATORS, useExisting: forwardRef(() => MaxLengthValidator),
useExisting: forwardRef(() => MaxLengthValidator), multi: true
multi: true };
};
/** /**
* A directive which installs the {@link MaxLengthValidator} for any `ngControl, `ngFormControl`, * A directive which installs the {@link MaxLengthValidator} for any `ngControl, `ngFormControl`,
@ -132,12 +130,11 @@ export class MaxLengthValidator implements Validator {
* <input [ngControl]="fullName" pattern="[a-zA-Z ]*"> * <input [ngControl]="fullName" pattern="[a-zA-Z ]*">
* ``` * ```
*/ */
export const PATTERN_VALIDATOR: any = /*@ts2dart_const*/ export const PATTERN_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
/*@ts2dart_Provider*/ { provide: NG_VALIDATORS,
provide: NG_VALIDATORS, useExisting: forwardRef(() => PatternValidator),
useExisting: forwardRef(() => PatternValidator), multi: true
multi: true };
};
@Directive({ @Directive({
selector: '[pattern][ngControl],[pattern][ngFormControl],[pattern][ngModel]', selector: '[pattern][ngControl],[pattern][ngFormControl],[pattern][ngModel]',
providers: [PATTERN_VALIDATOR] providers: [PATTERN_VALIDATOR]

View File

@ -83,7 +83,6 @@ var defaultLocale: string = 'en-US';
* *
* {@example core/pipes/ts/date_pipe/date_pipe_example.ts region='DatePipe'} * {@example core/pipes/ts/date_pipe/date_pipe_example.ts region='DatePipe'}
*/ */
/* @ts2dart_const */
@Pipe({name: 'date', pure: true}) @Pipe({name: 'date', pure: true})
@Injectable() @Injectable()
export class DatePipe implements PipeTransform { export class DatePipe implements PipeTransform {

View File

@ -35,7 +35,6 @@ var interpolationExp: RegExp = RegExpWrapper.create('#');
* ``` * ```
* *
*/ */
/* @ts2dart_const */
@Pipe({name: 'i18nPlural', pure: true}) @Pipe({name: 'i18nPlural', pure: true})
@Injectable() @Injectable()
export class I18nPluralPipe implements PipeTransform { export class I18nPluralPipe implements PipeTransform {

View File

@ -32,7 +32,6 @@ import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
* } * }
* ``` * ```
*/ */
/* @ts2dart_const */
@Pipe({name: 'i18nSelect', pure: true}) @Pipe({name: 'i18nSelect', pure: true})
@Injectable() @Injectable()
export class I18nSelectPipe implements PipeTransform { export class I18nSelectPipe implements PipeTransform {

View File

@ -9,7 +9,6 @@ import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
* *
* {@example core/pipes/ts/lowerupper_pipe/lowerupper_pipe_example.ts region='LowerUpperPipe'} * {@example core/pipes/ts/lowerupper_pipe/lowerupper_pipe_example.ts region='LowerUpperPipe'}
*/ */
/* @ts2dart_const */
@Pipe({name: 'lowercase'}) @Pipe({name: 'lowercase'})
@Injectable() @Injectable()
export class LowerCasePipe implements PipeTransform { export class LowerCasePipe implements PipeTransform {

View File

@ -19,7 +19,6 @@ var _re = RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$');
/** /**
* Internal base class for numeric pipes. * Internal base class for numeric pipes.
*/ */
/* @ts2dart_const */
@Injectable() @Injectable()
export class NumberPipe { export class NumberPipe {
/** @internal */ /** @internal */
@ -81,7 +80,6 @@ export class NumberPipe {
* *
* {@example core/pipes/ts/number_pipe/number_pipe_example.ts region='NumberPipe'} * {@example core/pipes/ts/number_pipe/number_pipe_example.ts region='NumberPipe'}
*/ */
/* @ts2dart_const */
@Pipe({name: 'number'}) @Pipe({name: 'number'})
@Injectable() @Injectable()
export class DecimalPipe extends NumberPipe implements PipeTransform { export class DecimalPipe extends NumberPipe implements PipeTransform {
@ -106,7 +104,6 @@ export class DecimalPipe extends NumberPipe implements PipeTransform {
* *
* {@example core/pipes/ts/number_pipe/number_pipe_example.ts region='PercentPipe'} * {@example core/pipes/ts/number_pipe/number_pipe_example.ts region='PercentPipe'}
*/ */
/* @ts2dart_const */
@Pipe({name: 'percent'}) @Pipe({name: 'percent'})
@Injectable() @Injectable()
export class PercentPipe extends NumberPipe implements PipeTransform { export class PercentPipe extends NumberPipe implements PipeTransform {
@ -135,7 +132,6 @@ export class PercentPipe extends NumberPipe implements PipeTransform {
* *
* {@example core/pipes/ts/number_pipe/number_pipe_example.ts region='CurrencyPipe'} * {@example core/pipes/ts/number_pipe/number_pipe_example.ts region='CurrencyPipe'}
*/ */
/* @ts2dart_const */
@Pipe({name: 'currency'}) @Pipe({name: 'currency'})
@Injectable() @Injectable()
export class CurrencyPipe extends NumberPipe implements PipeTransform { export class CurrencyPipe extends NumberPipe implements PipeTransform {

View File

@ -9,7 +9,6 @@ import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
* *
* {@example core/pipes/ts/lowerupper_pipe/lowerupper_pipe_example.ts region='LowerUpperPipe'} * {@example core/pipes/ts/lowerupper_pipe/lowerupper_pipe_example.ts region='LowerUpperPipe'}
*/ */
/* @ts2dart_const */
@Pipe({name: 'uppercase'}) @Pipe({name: 'uppercase'})
@Injectable() @Injectable()
export class UpperCasePipe implements PipeTransform { export class UpperCasePipe implements PipeTransform {

View File

@ -13,7 +13,6 @@ export {DirectiveResolver} from './directive_resolver';
export {PipeResolver} from './pipe_resolver'; export {PipeResolver} from './pipe_resolver';
import {assertionsEnabled, Type} from 'angular2/src/facade/lang'; import {assertionsEnabled, Type} from 'angular2/src/facade/lang';
import {provide, Provider} from 'angular2/src/core/di';
import {TemplateParser} from 'angular2/src/compiler/template_parser'; import {TemplateParser} from 'angular2/src/compiler/template_parser';
import {HtmlParser} from 'angular2/src/compiler/html_parser'; import {HtmlParser} from 'angular2/src/compiler/html_parser';
import {DirectiveNormalizer} from 'angular2/src/compiler/directive_normalizer'; import {DirectiveNormalizer} from 'angular2/src/compiler/directive_normalizer';
@ -40,7 +39,7 @@ 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 | Provider | any[]> = /*@ts2dart_const*/ [ export const COMPILER_PROVIDERS: Array<any | Type | {[k: string]: any} | any[]> = /*@ts2dart_const*/ [
Lexer, Lexer,
Parser, Parser,
HtmlParser, HtmlParser,

View File

@ -37,6 +37,7 @@ import {
} from 'angular2/src/core/di/metadata'; } from 'angular2/src/core/di/metadata';
import {AttributeMetadata, QueryMetadata} from 'angular2/src/core/metadata/di'; import {AttributeMetadata, QueryMetadata} from 'angular2/src/core/metadata/di';
import {ReflectorReader} from 'angular2/src/core/reflection/reflector_reader'; import {ReflectorReader} from 'angular2/src/core/reflection/reflector_reader';
import {isProviderLiteral, createProvider} from '../core/di/provider_util';
@Injectable() @Injectable()
export class CompileMetadataResolver { export class CompileMetadataResolver {
@ -292,6 +293,8 @@ export class CompileMetadataResolver {
return this.getProvidersMetadata(provider); return this.getProvidersMetadata(provider);
} else if (provider instanceof Provider) { } else if (provider instanceof Provider) {
return this.getProviderMetadata(provider); return this.getProviderMetadata(provider);
} else if (isProviderLiteral(provider)) {
return this.getProviderMetadata(createProvider(provider));
} else { } else {
return this.getTypeMetadata(provider, staticTypeModuleUrl(provider)); return this.getTypeMetadata(provider, staticTypeModuleUrl(provider));
} }

View File

@ -8,7 +8,7 @@ import {
} from 'angular2/src/facade/lang'; } from 'angular2/src/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
const _EMPTY_ATTR_VALUE = ''; const _EMPTY_ATTR_VALUE = /*@ts2dart_const*/ '';
// TODO: Can't use `const` here as // TODO: Can't use `const` here as
// in Dart this is not transpiled into `final` yet... // in Dart this is not transpiled into `final` yet...

View File

@ -4,13 +4,7 @@ import {
SetWrapper, SetWrapper,
MapWrapper MapWrapper
} from 'angular2/src/facade/collection'; } from 'angular2/src/facade/collection';
import { import {RegExpWrapper, isPresent, StringWrapper, isBlank, isArray} from 'angular2/src/facade/lang';
RegExpWrapper,
isPresent,
StringWrapper,
isBlank,
isArray
} from 'angular2/src/facade/lang';
import {Injectable, Inject, OpaqueToken, Optional} from 'angular2/core'; import {Injectable, Inject, OpaqueToken, Optional} from 'angular2/core';
import {Console} from 'angular2/src/core/console'; import {Console} from 'angular2/src/core/console';
import {BaseException} from 'angular2/src/facade/exceptions'; import {BaseException} from 'angular2/src/facade/exceptions';
@ -113,7 +107,7 @@ var TEXT_CSS_SELECTOR = CssSelector.parse('*')[0];
* *
* This is currently an internal-only feature and not meant for general use. * This is currently an internal-only feature and not meant for general use.
*/ */
export const TEMPLATE_TRANSFORMS = /*@ts2dart_const*/ new OpaqueToken('TemplateTransforms'); export const TEMPLATE_TRANSFORMS: any = /*@ts2dart_const*/ new OpaqueToken('TemplateTransforms');
export class TemplateParseError extends ParseError { export class TemplateParseError extends ParseError {
constructor(message: string, span: ParseSourceSpan, level: ParseErrorLevel) { constructor(message: string, span: ParseSourceSpan, level: ParseErrorLevel) {

View File

@ -26,7 +26,10 @@ export function createOfflineCompileUrlResolver(): UrlResolver {
/** /**
* A default provider for {@link PACKAGE_ROOT_URL} that maps to '/'. * A default provider for {@link PACKAGE_ROOT_URL} that maps to '/'.
*/ */
export var DEFAULT_PACKAGE_URL_PROVIDER = new Provider(PACKAGE_ROOT_URL, {useValue: "/"}); export var DEFAULT_PACKAGE_URL_PROVIDER = {
provide: PACKAGE_ROOT_URL,
useValue: "/"
};
/** /**
* Used by the {@link Compiler} when resolving HTML and CSS template URLs. * Used by the {@link Compiler} when resolving HTML and CSS template URLs.

View File

@ -1,5 +1,4 @@
import {Type} from 'angular2/src/facade/lang'; import {Type} from 'angular2/src/facade/lang';
import {provide, Provider, Injector, OpaqueToken} from 'angular2/src/core/di';
import {APP_ID_RANDOM_PROVIDER} from './application_tokens'; import {APP_ID_RANDOM_PROVIDER} from './application_tokens';
import {APPLICATION_CORE_PROVIDERS} from './application_ref'; import {APPLICATION_CORE_PROVIDERS} from './application_ref';
import { import {
@ -18,13 +17,13 @@ let __unused: Type; // avoid unused import when Type union types are erased
* A default set of providers which should be included in any Angular * A default set of providers which should be included in any Angular
* application, regardless of the platform it runs onto. * application, regardless of the platform it runs onto.
*/ */
export const APPLICATION_COMMON_PROVIDERS: Array<any | Type | Provider | any[]> = export const APPLICATION_COMMON_PROVIDERS: Array<Type | {[k: string]: any} | any[]> =
/*@ts2dart_const*/[ /*@ts2dart_const*/[
APPLICATION_CORE_PROVIDERS, APPLICATION_CORE_PROVIDERS,
/*@ts2dart_const*/ {provide: ComponentResolver, useClass: ReflectorComponentResolver}, /* @ts2dart_Provider */ {provide: ComponentResolver, useClass: ReflectorComponentResolver},
APP_ID_RANDOM_PROVIDER, APP_ID_RANDOM_PROVIDER,
ViewUtils, ViewUtils,
/*@ts2dart_const*/ {provide: IterableDiffers, useValue: defaultIterableDiffers}, /* @ts2dart_Provider */ {provide: IterableDiffers, useValue: defaultIterableDiffers},
/*@ts2dart_const*/ {provide: KeyValueDiffers, useValue: defaultKeyValueDiffers}, /* @ts2dart_Provider */ {provide: KeyValueDiffers, useValue: defaultKeyValueDiffers},
/*@ts2dart_const*/ {provide: DynamicComponentLoader, useClass: DynamicComponentLoader_}, /* @ts2dart_Provider */ {provide: DynamicComponentLoader, useClass: DynamicComponentLoader_}
]; ];

View File

@ -435,13 +435,19 @@ export class ApplicationRef_ extends ApplicationRef {
* @internal * @internal
*/ */
export const PLATFORM_CORE_PROVIDERS = export const PLATFORM_CORE_PROVIDERS =
/*@ts2dart_const*/[PlatformRef_, new Provider(PlatformRef, {useExisting: PlatformRef_})]; /*@ts2dart_const*/[
PlatformRef_,
/*@ts2dart_const*/ (/* @ts2dart_Provider */ {
provide: PlatformRef,
useExisting: PlatformRef_
})
];
/** /**
* @internal * @internal
*/ */
export const APPLICATION_CORE_PROVIDERS = /*@ts2dart_const*/[ export const APPLICATION_CORE_PROVIDERS = /*@ts2dart_const*/[
new Provider(NgZone, {useFactory: createNgZone, deps: []}), /* @ts2dart_Provider */ {provide: NgZone, useFactory: createNgZone, deps: []},
ApplicationRef_, ApplicationRef_,
new Provider(ApplicationRef, {useExisting: ApplicationRef_}) /* @ts2dart_Provider */ {provide: ApplicationRef, useExisting: ApplicationRef_}
]; ];

View File

@ -10,7 +10,7 @@ import {Math, StringWrapper} from 'angular2/src/facade/lang';
* a custom value via a DI provider <!-- TODO: provider --> configuring the root {@link Injector} * a custom value via a DI provider <!-- TODO: provider --> configuring the root {@link Injector}
* using this token. * using this token.
*/ */
export const APP_ID: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken('AppId'); export const APP_ID: any = /*@ts2dart_const*/ new OpaqueToken('AppId');
function _appIdRandomProviderFactory() { function _appIdRandomProviderFactory() {
return `${_randomChar()}${_randomChar()}${_randomChar()}`; return `${_randomChar()}${_randomChar()}${_randomChar()}`;
@ -19,8 +19,12 @@ function _appIdRandomProviderFactory() {
/** /**
* Providers that will generate a random APP_ID_TOKEN. * Providers that will generate a random APP_ID_TOKEN.
*/ */
export const APP_ID_RANDOM_PROVIDER: Provider = export const APP_ID_RANDOM_PROVIDER =
/*@ts2dart_const*/ new Provider(APP_ID, {useFactory: _appIdRandomProviderFactory, deps: []}); /*@ts2dart_const*/ /* @ts2dart_Provider */ {
provide: APP_ID,
useFactory: _appIdRandomProviderFactory,
deps: []
};
function _randomChar(): string { function _randomChar(): string {
return StringWrapper.fromCharCode(97 + Math.floor(Math.random() * 25)); return StringWrapper.fromCharCode(97 + Math.floor(Math.random() * 25));
@ -29,17 +33,17 @@ function _randomChar(): string {
/** /**
* A function that will be executed when a platform is initialized. * A function that will be executed when a platform is initialized.
*/ */
export const PLATFORM_INITIALIZER: OpaqueToken = export const PLATFORM_INITIALIZER: any =
/*@ts2dart_const*/ new OpaqueToken("Platform Initializer"); /*@ts2dart_const*/ new OpaqueToken("Platform Initializer");
/** /**
* A function that will be executed when an application is initialized. * A function that will be executed when an application is initialized.
*/ */
export const APP_INITIALIZER: OpaqueToken = export const APP_INITIALIZER: any =
/*@ts2dart_const*/ new OpaqueToken("Application Initializer"); /*@ts2dart_const*/ new OpaqueToken("Application Initializer");
/** /**
* A token which indicates the root directory of the application * A token which indicates the root directory of the application
*/ */
export const PACKAGE_ROOT_URL: OpaqueToken = export const PACKAGE_ROOT_URL: any =
/*@ts2dart_const*/ new OpaqueToken("Application Packages Root URL"); /*@ts2dart_const*/ new OpaqueToken("Application Packages Root URL");

View File

@ -6,7 +6,7 @@ import {
} from 'angular2/src/facade/collection'; } from 'angular2/src/facade/collection';
export {looseIdentical} from 'angular2/src/facade/lang'; export {looseIdentical} from 'angular2/src/facade/lang';
export var uninitialized: Object = /*@ts2dart_const*/<Object>(new Object()); export var uninitialized: Object = /*@ts2dart_const*/ new Object();
export function devModeEqual(a: any, b: any): boolean { export function devModeEqual(a: any, b: any): boolean {
if (isListLikeIterable(a) && isListLikeIterable(b)) { if (isListLikeIterable(a) && isListLikeIterable(b)) {

View File

@ -15,6 +15,7 @@ import {IterableDiffer, IterableDifferFactory, TrackByFn} from '../differs/itera
/* @ts2dart_const */ /* @ts2dart_const */
export class DefaultIterableDifferFactory implements IterableDifferFactory { export class DefaultIterableDifferFactory implements IterableDifferFactory {
constructor() {}
supports(obj: Object): boolean { return isListLikeIterable(obj); } supports(obj: Object): boolean { return isListLikeIterable(obj); }
create(cdRef: ChangeDetectorRef, trackByFn?: TrackByFn): DefaultIterableDiffer { create(cdRef: ChangeDetectorRef, trackByFn?: TrackByFn): DefaultIterableDiffer {
return new DefaultIterableDiffer(trackByFn); return new DefaultIterableDiffer(trackByFn);

View File

@ -4,8 +4,8 @@ import {BaseException} from 'angular2/src/facade/exceptions';
import {ChangeDetectorRef} from '../change_detector_ref'; import {ChangeDetectorRef} from '../change_detector_ref';
import {KeyValueDiffer, KeyValueDifferFactory} from '../differs/keyvalue_differs'; import {KeyValueDiffer, KeyValueDifferFactory} from '../differs/keyvalue_differs';
/*@ts2dart_const*/
export class DefaultKeyValueDifferFactory implements KeyValueDifferFactory { export class DefaultKeyValueDifferFactory implements KeyValueDifferFactory {
/* @ts2dart_const */
constructor() {} constructor() {}
supports(obj: any): boolean { return obj instanceof Map || isJsObject(obj); } supports(obj: any): boolean { return obj instanceof Map || isJsObject(obj); }

View File

@ -32,8 +32,8 @@ export interface IterableDifferFactory {
* A repository of different iterable diffing strategies used by NgFor, NgClass, and others. * A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
* @ts2dart_const * @ts2dart_const
*/ */
/* @ts2dart_const */
export class IterableDiffers { export class IterableDiffers {
/*@ts2dart_const*/
constructor(public factories: IterableDifferFactory[]) {} constructor(public factories: IterableDifferFactory[]) {}
static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers { static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers {

View File

@ -24,8 +24,8 @@ export interface KeyValueDifferFactory {
* A repository of different Map diffing strategies used by NgClass, NgStyle, and others. * A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
* @ts2dart_const * @ts2dart_const
*/ */
/* @ts2dart_const */
export class KeyValueDiffers { export class KeyValueDiffers {
/*@ts2dart_const*/
constructor(public factories: KeyValueDifferFactory[]) {} constructor(public factories: KeyValueDifferFactory[]) {}
static create(factories: KeyValueDifferFactory[], parent?: KeyValueDiffers): KeyValueDiffers { static create(factories: KeyValueDifferFactory[], parent?: KeyValueDiffers): KeyValueDiffers {

View File

@ -1,7 +1,7 @@
import {unimplemented} from 'angular2/src/facade/exceptions'; import {unimplemented} from 'angular2/src/facade/exceptions';
const _THROW_IF_NOT_FOUND = /*@ts2dart_const*/ new Object(); const _THROW_IF_NOT_FOUND = /*@ts2dart_const*/ new Object();
export const THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; export const THROW_IF_NOT_FOUND = /*@ts2dart_const*/ _THROW_IF_NOT_FOUND;
export abstract class Injector { export abstract class Injector {
static THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; static THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;

View File

@ -39,8 +39,8 @@ import {stringify, isBlank, isPresent} from "angular2/src/facade/lang";
* var injector = Injector.resolveAndCreate([Engine, Car]); * var injector = Injector.resolveAndCreate([Engine, Car]);
* expect(injector.get(Car).engine instanceof Engine).toBe(true); * expect(injector.get(Car).engine instanceof Engine).toBe(true);
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class InjectMetadata { export class InjectMetadata {
constructor(public token) {} constructor(public token) {}
toString(): string { return `@Inject(${stringify(this.token)})`; } toString(): string { return `@Inject(${stringify(this.token)})`; }
@ -66,8 +66,8 @@ export class InjectMetadata {
* var injector = Injector.resolveAndCreate([Car]); * var injector = Injector.resolveAndCreate([Car]);
* expect(injector.get(Car).engine).toBeNull(); * expect(injector.get(Car).engine).toBeNull();
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class OptionalMetadata { export class OptionalMetadata {
toString(): string { return `@Optional()`; } toString(): string { return `@Optional()`; }
} }
@ -75,8 +75,8 @@ export class OptionalMetadata {
/** /**
* `DependencyMetadata` is used by the framework to extend DI. * `DependencyMetadata` is used by the framework to extend DI.
* This is internal to Angular and should not be used directly. * This is internal to Angular and should not be used directly.
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class DependencyMetadata { export class DependencyMetadata {
get token() { return null; } get token() { return null; }
} }
@ -111,8 +111,8 @@ export class DependencyMetadata {
* var injector = Injector.resolveAndCreate([NeedsService, UsefulService]); * var injector = Injector.resolveAndCreate([NeedsService, UsefulService]);
* expect(() => injector.get(NeedsService)).toThrowError(); * expect(() => injector.get(NeedsService)).toThrowError();
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class InjectableMetadata { export class InjectableMetadata {
constructor() {} constructor() {}
} }
@ -143,8 +143,8 @@ export class InjectableMetadata {
* var child = inj.resolveAndCreateChild([NeedsDependency]); * var child = inj.resolveAndCreateChild([NeedsDependency]);
* expect(() => child.get(NeedsDependency)).toThrowError(); * expect(() => child.get(NeedsDependency)).toThrowError();
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class SelfMetadata { export class SelfMetadata {
toString(): string { return `@Self()`; } toString(): string { return `@Self()`; }
} }
@ -173,8 +173,8 @@ export class SelfMetadata {
* var inj = Injector.resolveAndCreate([Dependency, NeedsDependency]); * var inj = Injector.resolveAndCreate([Dependency, NeedsDependency]);
* expect(() => inj.get(NeedsDependency)).toThrowError(); * expect(() => inj.get(NeedsDependency)).toThrowError();
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class SkipSelfMetadata { export class SkipSelfMetadata {
toString(): string { return `@SkipSelf()`; } toString(): string { return `@SkipSelf()`; }
} }
@ -232,8 +232,8 @@ export class SkipSelfMetadata {
* *
* bootstrap(App); * bootstrap(App);
*``` *```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class HostMetadata { export class HostMetadata {
toString(): string { return `@Host()`; } toString(): string { return `@Host()`; }
} }

View File

@ -19,8 +19,8 @@
* *
* Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better * Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better
* error messages. * error messages.
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class OpaqueToken { export class OpaqueToken {
constructor(private _desc: string) {} constructor(private _desc: string) {}

View File

@ -22,8 +22,8 @@ import {BaseException} from 'angular2/src/facade/exceptions';
* *
* expect(injector.get("message")).toEqual('Hello'); * expect(injector.get("message")).toEqual('Hello');
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class Provider { export class Provider {
/** /**
* Token used when retrieving this provider. Usually, it is a type {@link Type}. * Token used when retrieving this provider. Usually, it is a type {@link Type}.
@ -45,11 +45,11 @@ export class Provider {
* *
* var injectorClass = Injector.resolveAndCreate([ * var injectorClass = Injector.resolveAndCreate([
* Car, * Car,
* new Provider(Vehicle, { useClass: Car }) * {provide: Vehicle, useClass: Car }
* ]); * ]);
* var injectorAlias = Injector.resolveAndCreate([ * var injectorAlias = Injector.resolveAndCreate([
* Car, * Car,
* new Provider(Vehicle, { useExisting: Car }) * {provide: Vehicle, useExisting: Car }
* ]); * ]);
* *
* expect(injectorClass.get(Vehicle)).not.toBe(injectorClass.get(Car)); * expect(injectorClass.get(Vehicle)).not.toBe(injectorClass.get(Car));
@ -94,11 +94,11 @@ export class Provider {
* *
* var injectorAlias = Injector.resolveAndCreate([ * var injectorAlias = Injector.resolveAndCreate([
* Car, * Car,
* new Provider(Vehicle, { useExisting: Car }) * {provide: Vehicle, useExisting: Car }
* ]); * ]);
* var injectorClass = Injector.resolveAndCreate([ * var injectorClass = Injector.resolveAndCreate([
* Car, * Car,
* new Provider(Vehicle, { useClass: Car }) * {provide: Vehicle, useClass: Car }
* ]); * ]);
* *
* expect(injectorAlias.get(Vehicle)).toBe(injectorAlias.get(Car)); * expect(injectorAlias.get(Vehicle)).toBe(injectorAlias.get(Car));
@ -117,7 +117,7 @@ export class Provider {
* *
* ```typescript * ```typescript
* var injector = Injector.resolveAndCreate([ * var injector = Injector.resolveAndCreate([
* new Provider(Number, { useFactory: () => { return 1+2; }}), * {provide: Number, useFactory: () => { return 1+2; }},
* new Provider(String, { useFactory: (value) => { return "Value: " + value; }, * new Provider(String, { useFactory: (value) => { return "Value: " + value; },
* deps: [Number] }) * deps: [Number] })
* ]); * ]);
@ -138,7 +138,7 @@ export class Provider {
* *
* ```typescript * ```typescript
* var injector = Injector.resolveAndCreate([ * var injector = Injector.resolveAndCreate([
* new Provider(Number, { useFactory: () => { return 1+2; }}), * {provide: Number, useFactory: () => { return 1+2; }},
* new Provider(String, { useFactory: (value) => { return "Value: " + value; }, * new Provider(String, { useFactory: (value) => { return "Value: " + value; },
* deps: [Number] }) * deps: [Number] })
* ]); * ]);
@ -208,8 +208,8 @@ export class Provider {
* See {@link Provider} instead. * See {@link Provider} instead.
* *
* @deprecated * @deprecated
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class Binding extends Provider { export class Binding extends Provider {
constructor(token, {toClass, toValue, toAlias, toFactory, deps, multi}: { constructor(token, {toClass, toValue, toAlias, toFactory, deps, multi}: {
toClass?: Type, toClass?: Type,

View File

@ -625,7 +625,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
*/ */
debugContext(): any { return this._debugContext(); } debugContext(): any { return this._debugContext(); }
get(token: any, notFoundValue: any = THROW_IF_NOT_FOUND): any { get(token: any, notFoundValue: any = /*@ts2dart_const*/ THROW_IF_NOT_FOUND): any {
return this._getByKey(ReflectiveKey.get(token), null, null, notFoundValue); return this._getByKey(ReflectiveKey.get(token), null, null, notFoundValue);
} }

View File

@ -72,6 +72,7 @@ export class ComponentRef_ extends ComponentRef {
const EMPTY_CONTEXT = /*@ts2dart_const*/new Object(); const EMPTY_CONTEXT = /*@ts2dart_const*/new Object();
export class ComponentFactory { export class ComponentFactory {
/* @ts2dart_const */
constructor(public selector: string, private _viewFactory: Function, constructor(public selector: string, private _viewFactory: Function,
private _componentType: Type) {} private _componentType: Type) {}

View File

@ -1,4 +1,3 @@
import {isBlank, stringify} from 'angular2/src/facade/lang';
import {Injector, THROW_IF_NOT_FOUND} from 'angular2/src/core/di/injector'; import {Injector, THROW_IF_NOT_FOUND} from 'angular2/src/core/di/injector';
import {AppView} from './view'; import {AppView} from './view';

View File

@ -18,8 +18,8 @@ import {DependencyMetadata} from 'angular2/src/core/di/metadata';
* A decorator can inject string literal `text` like so: * A decorator can inject string literal `text` like so:
* *
* {@example core/ts/metadata/metadata.ts region='attributeMetadata'} * {@example core/ts/metadata/metadata.ts region='attributeMetadata'}
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class AttributeMetadata extends DependencyMetadata { export class AttributeMetadata extends DependencyMetadata {
constructor(public attributeName: string) { super(); } constructor(public attributeName: string) { super(); }
@ -140,8 +140,8 @@ export class AttributeMetadata extends DependencyMetadata {
* *
* The injected object is an unmodifiable live list. * The injected object is an unmodifiable live list.
* See {@link QueryList} for more details. * See {@link QueryList} for more details.
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class QueryMetadata extends DependencyMetadata { export class QueryMetadata extends DependencyMetadata {
/** /**
* whether we want to query only direct children (false) or all * whether we want to query only direct children (false) or all
@ -207,8 +207,8 @@ export class QueryMetadata extends DependencyMetadata {
* } * }
* } * }
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class ContentChildrenMetadata extends QueryMetadata { export class ContentChildrenMetadata extends QueryMetadata {
constructor(_selector: Type | string, constructor(_selector: Type | string,
{descendants = false, read = null}: {descendants?: boolean, read?: any} = {}) { {descendants = false, read = null}: {descendants?: boolean, read?: any} = {}) {
@ -236,8 +236,8 @@ export class ContentChildrenMetadata extends QueryMetadata {
* } * }
* } * }
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class ContentChildMetadata extends QueryMetadata { export class ContentChildMetadata extends QueryMetadata {
constructor(_selector: Type | string, {read = null}: {read?: any} = {}) { constructor(_selector: Type | string, {read = null}: {read?: any} = {}) {
super(_selector, {descendants: true, first: true, read: read}); super(_selector, {descendants: true, first: true, read: read});
@ -278,8 +278,8 @@ export class ContentChildMetadata extends QueryMetadata {
* *
* The injected object is an iterable and observable live list. * The injected object is an iterable and observable live list.
* See {@link QueryList} for more details. * See {@link QueryList} for more details.
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class ViewQueryMetadata extends QueryMetadata { export class ViewQueryMetadata extends QueryMetadata {
constructor(_selector: Type | string, constructor(_selector: Type | string,
{descendants = false, first = false, {descendants = false, first = false,
@ -370,8 +370,8 @@ export class ViewQueryMetadata extends QueryMetadata {
* } * }
* } * }
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class ViewChildrenMetadata extends ViewQueryMetadata { export class ViewChildrenMetadata extends ViewQueryMetadata {
constructor(_selector: Type | string, {read = null}: {read?: any} = {}) { constructor(_selector: Type | string, {read = null}: {read?: any} = {}) {
super(_selector, {descendants: true, read: read}); super(_selector, {descendants: true, read: read});
@ -447,8 +447,8 @@ export class ViewChildrenMetadata extends ViewQueryMetadata {
* } * }
* } * }
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class ViewChildMetadata extends ViewQueryMetadata { export class ViewChildMetadata extends ViewQueryMetadata {
constructor(_selector: Type | string, {read = null}: {read?: any} = {}) { constructor(_selector: Type | string, {read = null}: {read?: any} = {}) {
super(_selector, {descendants: true, first: true, read: read}); super(_selector, {descendants: true, first: true, read: read});

View File

@ -380,8 +380,8 @@ import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
* Note also that although the `<li></li>` template still exists inside the `<template></template>`, * Note also that although the `<li></li>` template still exists inside the `<template></template>`,
* the instantiated * the instantiated
* view occurs on the second `<li></li>` which is a sibling to the `<template>` element. * view occurs on the second `<li></li>` which is a sibling to the `<template>` element.
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class DirectiveMetadata extends InjectableMetadata { export class DirectiveMetadata extends InjectableMetadata {
/** /**
* The CSS selector that triggers the instantiation of a directive. * The CSS selector that triggers the instantiation of a directive.
@ -783,8 +783,8 @@ export class DirectiveMetadata extends InjectableMetadata {
* ### Example * ### Example
* *
* {@example core/ts/metadata/metadata.ts region='component'} * {@example core/ts/metadata/metadata.ts region='component'}
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class ComponentMetadata extends DirectiveMetadata { export class ComponentMetadata extends DirectiveMetadata {
/** /**
* Defines the used change detection strategy. * Defines the used change detection strategy.
@ -940,8 +940,8 @@ export class ComponentMetadata extends DirectiveMetadata {
* ### Example * ### Example
* *
* {@example core/ts/metadata/metadata.ts region='pipe'} * {@example core/ts/metadata/metadata.ts region='pipe'}
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class PipeMetadata extends InjectableMetadata { export class PipeMetadata extends InjectableMetadata {
name: string; name: string;
/** @internal */ /** @internal */
@ -996,8 +996,8 @@ export class PipeMetadata extends InjectableMetadata {
* *
* bootstrap(App); * bootstrap(App);
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class InputMetadata { export class InputMetadata {
constructor( constructor(
/** /**
@ -1046,8 +1046,8 @@ export class InputMetadata {
* } * }
* bootstrap(App); * bootstrap(App);
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class OutputMetadata { export class OutputMetadata {
constructor(public bindingPropertyName?: string) {} constructor(public bindingPropertyName?: string) {}
} }
@ -1086,8 +1086,8 @@ export class OutputMetadata {
* *
* bootstrap(App); * bootstrap(App);
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class HostBindingMetadata { export class HostBindingMetadata {
constructor(public hostPropertyName?: string) {} constructor(public hostPropertyName?: string) {}
} }
@ -1125,8 +1125,8 @@ export class HostBindingMetadata {
* *
* bootstrap(App); * bootstrap(App);
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class HostListenerMetadata { export class HostListenerMetadata {
constructor(public eventName: string, public args?: string[]) {} constructor(public eventName: string, public args?: string[]) {}
} }

View File

@ -60,8 +60,8 @@ export var VIEW_ENCAPSULATION_VALUES =
* } * }
* } * }
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class ViewMetadata { export class ViewMetadata {
/** /**
* Specifies a template URL for an Angular component. * Specifies a template URL for an Angular component.

View File

@ -1,5 +1,5 @@
import {Type, isBlank, isPresent, assertionsEnabled} from 'angular2/src/facade/lang'; import {Type} from 'angular2/src/facade/lang';
import {provide, Provider, Injector, OpaqueToken} from 'angular2/src/core/di'; import {Provider} from 'angular2/src/core/di';
import {Console} from 'angular2/src/core/console'; import {Console} from 'angular2/src/core/console';
import {Reflector, reflector} from './reflection/reflection'; import {Reflector, reflector} from './reflection/reflection';
import {ReflectorReader} from './reflection/reflector_reader'; import {ReflectorReader} from './reflection/reflector_reader';

View File

@ -76,20 +76,20 @@ function _document(): any {
* Used automatically by `bootstrap`, or can be passed to {@link PlatformRef.application}. * Used automatically by `bootstrap`, or can be passed to {@link PlatformRef.application}.
*/ */
export const BROWSER_APP_COMMON_PROVIDERS: Array<any /*Type | Provider | any[]*/> = export const BROWSER_APP_COMMON_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/ [ /*@ts2dart_const*/[
APPLICATION_COMMON_PROVIDERS, APPLICATION_COMMON_PROVIDERS,
FORM_PROVIDERS, FORM_PROVIDERS,
/*@ts2dart_Provider*/{provide: PLATFORM_PIPES, useValue: COMMON_PIPES, multi: true}, /* @ts2dart_Provider */ {provide: PLATFORM_PIPES, useValue: COMMON_PIPES, multi: true},
/*@ts2dart_Provider*/{provide: PLATFORM_DIRECTIVES, useValue: COMMON_DIRECTIVES, multi: true}, /* @ts2dart_Provider */ {provide: PLATFORM_DIRECTIVES, useValue: COMMON_DIRECTIVES, multi: true},
/*@ts2dart_Provider*/{provide: ExceptionHandler, useFactory: _exceptionHandler, deps: []}, /* @ts2dart_Provider */ {provide: ExceptionHandler, useFactory: _exceptionHandler, deps: []},
/*@ts2dart_Provider*/{provide: DOCUMENT, useFactory: _document, deps: []}, /* @ts2dart_Provider */ {provide: DOCUMENT, useFactory: _document, deps: []},
/*@ts2dart_Provider*/{provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true}, /* @ts2dart_Provider */ {provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true},
/*@ts2dart_Provider*/{provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true}, /* @ts2dart_Provider */ {provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true},
/*@ts2dart_Provider*/{provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true}, /* @ts2dart_Provider */ {provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true},
/*@ts2dart_Provider*/{provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig}, /* @ts2dart_Provider */ {provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig},
/*@ts2dart_Provider*/{provide: DomRootRenderer, useClass: DomRootRenderer_}, /* @ts2dart_Provider */ {provide: DomRootRenderer, useClass: DomRootRenderer_},
/*@ts2dart_Provider*/{provide: RootRenderer, useExisting: DomRootRenderer}, /* @ts2dart_Provider */ {provide: RootRenderer, useExisting: DomRootRenderer},
/*@ts2dart_Provider*/{provide: SharedStylesHost, useExisting: DomSharedStylesHost}, /* @ts2dart_Provider */ {provide: SharedStylesHost, useExisting: DomSharedStylesHost},
DomSharedStylesHost, DomSharedStylesHost,
Testability, Testability,
BrowserDetails, BrowserDetails,

View File

@ -1,5 +1,4 @@
import {assertionsEnabled, isPresent} from 'angular2/src/facade/lang'; import {assertionsEnabled} from 'angular2/src/facade/lang';
import {Injectable, provide} from 'angular2/src/core/di';
import {DOM} from 'angular2/src/platform/dom/dom_adapter'; import {DOM} from 'angular2/src/platform/dom/dom_adapter';
import {DebugNode, getDebugNode} from 'angular2/src/core/debug/debug_node'; import {DebugNode, getDebugNode} from 'angular2/src/core/debug/debug_node';
import {DomRootRenderer} from 'angular2/src/platform/dom/dom_renderer'; import {DomRootRenderer} from 'angular2/src/platform/dom/dom_renderer';

View File

@ -22,8 +22,8 @@ let _postMessage = {
export const WORKER_APP_APPLICATION: Array<any /*Type | Provider | any[]*/> = [ export const WORKER_APP_APPLICATION: Array<any /*Type | Provider | any[]*/> = [
WORKER_APP_APPLICATION_COMMON, WORKER_APP_APPLICATION_COMMON,
COMPILER_PROVIDERS, COMPILER_PROVIDERS,
new Provider(MessageBus, {useFactory: createMessageBus, deps: [NgZone]}), /* @ts2dart_Provider */ {provide: MessageBus, useFactory: createMessageBus, deps: [NgZone]},
new Provider(APP_INITIALIZER, {useValue: setupWebWorker, multi: true}) /* @ts2dart_Provider */ {provide: APP_INITIALIZER, useValue: setupWebWorker, multi: true}
]; ];
function createMessageBus(zone: NgZone): MessageBus { function createMessageBus(zone: NgZone): MessageBus {

View File

@ -1,7 +1,7 @@
import {XHR} from 'angular2/src/compiler/xhr'; import {XHR} from 'angular2/src/compiler/xhr';
import {WebWorkerXHRImpl} from 'angular2/src/web_workers/worker/xhr_impl'; import {WebWorkerXHRImpl} from 'angular2/src/web_workers/worker/xhr_impl';
import {WebWorkerRootRenderer} from 'angular2/src/web_workers/worker/renderer'; import {WebWorkerRootRenderer} from 'angular2/src/web_workers/worker/renderer';
import {print, Type, isPresent} from 'angular2/src/facade/lang'; import {print} from 'angular2/src/facade/lang';
import {RootRenderer} from 'angular2/src/core/render/api'; import {RootRenderer} from 'angular2/src/core/render/api';
import { import {
PLATFORM_DIRECTIVES, PLATFORM_DIRECTIVES,
@ -22,7 +22,6 @@ import {
} from 'angular2/src/web_workers/shared/service_message_broker'; } from 'angular2/src/web_workers/shared/service_message_broker';
import {Serializer} from "angular2/src/web_workers/shared/serializer"; import {Serializer} from "angular2/src/web_workers/shared/serializer";
import {ON_WEB_WORKER} from "angular2/src/web_workers/shared/api"; import {ON_WEB_WORKER} from "angular2/src/web_workers/shared/api";
import {Provider} from 'angular2/src/core/di';
import {RenderStore} from 'angular2/src/web_workers/shared/render_store'; import {RenderStore} from 'angular2/src/web_workers/shared/render_store';
class PrintLogger { class PrintLogger {
@ -35,25 +34,31 @@ class PrintLogger {
export const WORKER_APP_PLATFORM_MARKER = export const WORKER_APP_PLATFORM_MARKER =
/*@ts2dart_const*/ new OpaqueToken('WorkerAppPlatformMarker'); /*@ts2dart_const*/ new OpaqueToken('WorkerAppPlatformMarker');
export const WORKER_APP_PLATFORM: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/ export const WORKER_APP_PLATFORM: Array<any /*Type | Provider | any[]*/> =
[PLATFORM_COMMON_PROVIDERS, new Provider(WORKER_APP_PLATFORM_MARKER, {useValue: true})]; /*@ts2dart_const*/[
PLATFORM_COMMON_PROVIDERS,
/*@ts2dart_const*/ (/* @ts2dart_Provider */ {
provide: WORKER_APP_PLATFORM_MARKER,
useValue: true
})
];
export const WORKER_APP_APPLICATION_COMMON: Array<any /*Type | Provider | any[]*/> = export const WORKER_APP_APPLICATION_COMMON: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[ /*@ts2dart_const*/[
APPLICATION_COMMON_PROVIDERS, APPLICATION_COMMON_PROVIDERS,
FORM_PROVIDERS, FORM_PROVIDERS,
Serializer, Serializer,
new Provider(PLATFORM_PIPES, {useValue: COMMON_PIPES, multi: true}), /* @ts2dart_Provider */ {provide: PLATFORM_PIPES, useValue: COMMON_PIPES, multi: true},
new Provider(PLATFORM_DIRECTIVES, {useValue: COMMON_DIRECTIVES, multi: true}), /* @ts2dart_Provider */ {provide: PLATFORM_DIRECTIVES, useValue: COMMON_DIRECTIVES, multi: true},
new Provider(ClientMessageBrokerFactory, {useClass: ClientMessageBrokerFactory_}), /* @ts2dart_Provider */ {provide: ClientMessageBrokerFactory, useClass: ClientMessageBrokerFactory_},
new Provider(ServiceMessageBrokerFactory, {useClass: ServiceMessageBrokerFactory_}), /* @ts2dart_Provider */ {provide: ServiceMessageBrokerFactory, useClass: ServiceMessageBrokerFactory_},
WebWorkerRootRenderer, WebWorkerRootRenderer,
new Provider(RootRenderer, {useExisting: WebWorkerRootRenderer}), /* @ts2dart_Provider */ {provide: RootRenderer, useExisting: WebWorkerRootRenderer},
new Provider(ON_WEB_WORKER, {useValue: true}), /* @ts2dart_Provider */ {provide: ON_WEB_WORKER, useValue: true},
RenderStore, RenderStore,
new Provider(ExceptionHandler, {useFactory: _exceptionHandler, deps: []}), /* @ts2dart_Provider */ {provide: ExceptionHandler, useFactory: _exceptionHandler, deps: []},
WebWorkerXHRImpl, WebWorkerXHRImpl,
new Provider(XHR, {useExisting: WebWorkerXHRImpl}) /* @ts2dart_Provider */ {provide: XHR, useExisting: WebWorkerXHRImpl}
]; ];
function _exceptionHandler(): ExceptionHandler { function _exceptionHandler(): ExceptionHandler {

View File

@ -64,8 +64,8 @@ export const WORKER_RENDER_PLATFORM_MARKER =
export const WORKER_RENDER_PLATFORM: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/[ export const WORKER_RENDER_PLATFORM: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/[
PLATFORM_COMMON_PROVIDERS, PLATFORM_COMMON_PROVIDERS,
new Provider(WORKER_RENDER_PLATFORM_MARKER, {useValue: true}), /*@ts2dart_const*/ (/* @ts2dart_Provider */ {provide: WORKER_RENDER_PLATFORM_MARKER, useValue: true}),
new Provider(PLATFORM_INITIALIZER, {useValue: initWebWorkerRenderPlatform, multi: true}) /* @ts2dart_Provider */ {provide: PLATFORM_INITIALIZER, useValue: initWebWorkerRenderPlatform, multi: true}
]; ];
/** /**
@ -79,23 +79,23 @@ export const WORKER_RENDER_APPLICATION_COMMON: Array<any /*Type | Provider | any
/*@ts2dart_const*/[ /*@ts2dart_const*/[
APPLICATION_COMMON_PROVIDERS, APPLICATION_COMMON_PROVIDERS,
WORKER_RENDER_MESSAGING_PROVIDERS, WORKER_RENDER_MESSAGING_PROVIDERS,
new Provider(ExceptionHandler, {useFactory: _exceptionHandler, deps: []}), /* @ts2dart_Provider */ {provide: ExceptionHandler, useFactory: _exceptionHandler, deps: []},
new Provider(DOCUMENT, {useFactory: _document, deps: []}), /* @ts2dart_Provider */ {provide: DOCUMENT, useFactory: _document, deps: []},
// TODO(jteplitz602): Investigate if we definitely need EVENT_MANAGER on the render thread // TODO(jteplitz602): Investigate if we definitely need EVENT_MANAGER on the render thread
// #5298 // #5298
new Provider(EVENT_MANAGER_PLUGINS, {useClass: DomEventsPlugin, multi: true}), /* @ts2dart_Provider */ {provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true},
new Provider(EVENT_MANAGER_PLUGINS, {useClass: KeyEventsPlugin, multi: true}), /* @ts2dart_Provider */ {provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true},
new Provider(EVENT_MANAGER_PLUGINS, {useClass: HammerGesturesPlugin, multi: true}), /* @ts2dart_Provider */ {provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true},
new Provider(HAMMER_GESTURE_CONFIG, {useClass: HammerGestureConfig}), /* @ts2dart_Provider */ {provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig},
new Provider(DomRootRenderer, {useClass: DomRootRenderer_}), /* @ts2dart_Provider */ {provide: DomRootRenderer, useClass: DomRootRenderer_},
new Provider(RootRenderer, {useExisting: DomRootRenderer}), /* @ts2dart_Provider */ {provide: RootRenderer, useExisting: DomRootRenderer},
new Provider(SharedStylesHost, {useExisting: DomSharedStylesHost}), /* @ts2dart_Provider */ {provide: SharedStylesHost, useExisting: DomSharedStylesHost},
new Provider(XHR, {useClass: XHRImpl}), /* @ts2dart_Provider */ {provide: XHR, useClass: XHRImpl},
MessageBasedXHRImpl, MessageBasedXHRImpl,
new Provider(ServiceMessageBrokerFactory, {useClass: ServiceMessageBrokerFactory_}), /* @ts2dart_Provider */ {provide: ServiceMessageBrokerFactory, useClass: ServiceMessageBrokerFactory_},
new Provider(ClientMessageBrokerFactory, {useClass: ClientMessageBrokerFactory_}), /* @ts2dart_Provider */ {provide: ClientMessageBrokerFactory, useClass: ClientMessageBrokerFactory_},
Serializer, Serializer,
new Provider(ON_WEB_WORKER, {useValue: false}), /* @ts2dart_Provider */ {provide: ON_WEB_WORKER, useValue: false},
RenderStore, RenderStore,
DomSharedStylesHost, DomSharedStylesHost,
Testability, Testability,

View File

@ -10,8 +10,8 @@ var __make_dart_analyzer_happy: Promise<any> = null;
* The `RouteConfig` decorator defines routes for a given component. * The `RouteConfig` decorator defines routes for a given component.
* *
* It takes an array of {@link RouteDefinition}s. * It takes an array of {@link RouteDefinition}s.
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class RouteConfig { export class RouteConfig {
constructor(public configs: RouteDefinition[]) {} constructor(public configs: RouteDefinition[]) {}
} }
@ -56,8 +56,8 @@ export abstract class AbstractRoute implements RouteDefinition {
* ]) * ])
* class MyApp {} * class MyApp {}
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class Route extends AbstractRoute { export class Route extends AbstractRoute {
component: any; component: any;
aux: string = null; aux: string = null;
@ -94,8 +94,8 @@ export class Route extends AbstractRoute {
* ]) * ])
* class MyApp {} * class MyApp {}
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class AuxRoute extends AbstractRoute { export class AuxRoute extends AbstractRoute {
component: any; component: any;
@ -135,8 +135,8 @@ export class AuxRoute extends AbstractRoute {
* ]) * ])
* class MyApp {} * class MyApp {}
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class AsyncRoute extends AbstractRoute { export class AsyncRoute extends AbstractRoute {
loader: () => Promise<Type>; loader: () => Promise<Type>;
aux: string = null; aux: string = null;
@ -174,8 +174,8 @@ export class AsyncRoute extends AbstractRoute {
* ]) * ])
* class MyApp {} * class MyApp {}
* ``` * ```
* @ts2dart_const
*/ */
/* @ts2dart_const */
export class Redirect extends AbstractRoute { export class Redirect extends AbstractRoute {
redirectTo: any[]; redirectTo: any[];

View File

@ -31,7 +31,10 @@ 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,
new Provider(PlatformLocation, {useClass: BrowserPlatformLocation}), /*@ts2dart_const*/ (/* @ts2dart_Provider */ {
provide: PlatformLocation,
useClass: BrowserPlatformLocation
}),
]; ];
/** /**

View File

@ -10,15 +10,18 @@ import {BaseException} from 'angular2/src/facade/exceptions';
*/ */
export const ROUTER_PROVIDERS_COMMON: any[] = /*@ts2dart_const*/[ export const ROUTER_PROVIDERS_COMMON: any[] = /*@ts2dart_const*/[
RouteRegistry, RouteRegistry,
new Provider(LocationStrategy, {useClass: PathLocationStrategy}), /* @ts2dart_Provider */ {provide: LocationStrategy, useClass: PathLocationStrategy},
Location, Location,
new Provider(Router, {
{ provide: Router,
useFactory: routerFactory, useFactory: routerFactory,
deps: [RouteRegistry, Location, ROUTER_PRIMARY_COMPONENT, ApplicationRef] deps: [RouteRegistry, Location, ROUTER_PRIMARY_COMPONENT, ApplicationRef]
}), },
new Provider(ROUTER_PRIMARY_COMPONENT, {
{useFactory: routerPrimaryComponentFactory, deps: [ApplicationRef]}) provide: ROUTER_PRIMARY_COMPONENT,
useFactory: routerPrimaryComponentFactory,
deps: /*@ts2dart_const*/ ([ApplicationRef])
}
]; ];
function routerFactory(registry: RouteRegistry, location: Location, primaryComponent: Type, function routerFactory(registry: RouteRegistry, location: Location, primaryComponent: Type,

View File

@ -7,7 +7,7 @@ import {APP_INITIALIZER, Provider, Injector, NgZone} from 'angular2/core';
export const WORKER_RENDER_ROUTER = /*@ts2dart_const*/[ export const WORKER_RENDER_ROUTER = /*@ts2dart_const*/[
MessageBasedPlatformLocation, MessageBasedPlatformLocation,
BrowserPlatformLocation, BrowserPlatformLocation,
new Provider(APP_INITIALIZER, {useFactory: initRouterListeners, multi: true, deps: [Injector]}) /* @ts2dart_Provider */ {provide: APP_INITIALIZER, useFactory: initRouterListeners, multi: true, deps: [Injector]}
]; ];
function initRouterListeners(injector: Injector): () => void { function initRouterListeners(injector: Injector): () => void {

View File

@ -5,14 +5,14 @@ import {ROUTER_PROVIDERS_COMMON} from 'angular2/src/router/router_providers_comm
export var WORKER_APP_ROUTER = [ export var WORKER_APP_ROUTER = [
ROUTER_PROVIDERS_COMMON, ROUTER_PROVIDERS_COMMON,
new Provider(PlatformLocation, {useClass: WebWorkerPlatformLocation}), /* @ts2dart_Provider */ {provide: PlatformLocation, useClass: WebWorkerPlatformLocation},
new Provider(APP_INITIALIZER, {
{ provide: APP_INITIALIZER,
useFactory: (platformLocation: WebWorkerPlatformLocation, zone: NgZone) => () => useFactory: (platformLocation: WebWorkerPlatformLocation, zone: NgZone) => () =>
initRouter(platformLocation, zone), initRouter(platformLocation, zone),
multi: true, multi: true,
deps: [PlatformLocation, NgZone] deps: [PlatformLocation, NgZone]
}) }
]; ];
function initRouter(platformLocation: WebWorkerPlatformLocation, zone: NgZone): Promise<boolean> { function initRouter(platformLocation: WebWorkerPlatformLocation, zone: NgZone): Promise<boolean> {

View File

@ -1371,7 +1371,13 @@ function loginIsEmptyGroupValidator(c: ControlGroup) {
@Directive({ @Directive({
selector: '[login-is-empty-validator]', selector: '[login-is-empty-validator]',
providers: [new Provider(NG_VALIDATORS, {useValue: loginIsEmptyGroupValidator, multi: true})] providers: [
/* @ts2dart_Provider */ {
provide: NG_VALIDATORS,
useValue: loginIsEmptyGroupValidator,
multi: true
}
]
}) })
class LoginIsEmptyValidator { class LoginIsEmptyValidator {
} }

View File

@ -2,7 +2,6 @@
import {print, IS_DART} from 'angular2/src/facade/lang'; import {print, IS_DART} from 'angular2/src/facade/lang';
import {TypeScriptEmitter} from 'angular2/src/compiler/output/ts_emitter'; import {TypeScriptEmitter} from 'angular2/src/compiler/output/ts_emitter';
import {DartEmitter} from 'angular2/src/compiler/output/dart_emitter'; import {DartEmitter} from 'angular2/src/compiler/output/dart_emitter';
import * as o from 'angular2/src/compiler/output/output_ast';
import {compileComp, compAMetadata} from './offline_compiler_util'; import {compileComp, compAMetadata} from './offline_compiler_util';
import {ComponentFactory} from 'angular2/src/core/linker/component_factory'; import {ComponentFactory} from 'angular2/src/core/linker/component_factory';

View File

@ -254,8 +254,8 @@ export function main() {
it('should support multiProviders', () => { it('should support multiProviders', () => {
var injector = createInjector([ var injector = createInjector([
Engine, Engine,
new Provider(Car, {useClass: SportsCar, multi: true}), /* @ts2dart_Provider */ {provide: Car, useClass: SportsCar, multi: true},
new Provider(Car, {useClass: CarWithOptionalEngine, multi: true}) /* @ts2dart_Provider */ {provide: Car, useClass: CarWithOptionalEngine, multi: true}
]); ]);
var cars = injector.get(Car); var cars = injector.get(Car);
@ -264,14 +264,15 @@ 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( () => {
[Engine, SportsCar, new Provider(Car, {useExisting: SportsCar, multi: true})]); var injector = createInjector(
[Engine, 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);
expect(cars[0]).toBe(injector.get(SportsCar)); expect(cars[0]).toBe(injector.get(SportsCar));
}); });
it('should throw when the aliased provider does not exist', () => { it('should throw when the aliased provider does not exist', () => {
var injector = createInjector([provide('car', {useExisting: SportsCar})]); var injector = createInjector([provide('car', {useExisting: SportsCar})]);
@ -523,8 +524,8 @@ export function main() {
it("should support multi providers", () => { it("should support multi providers", () => {
var provider = ReflectiveInjector.resolve([ var provider = ReflectiveInjector.resolve([
new Provider(Engine, {useClass: BrokenEngine, multi: true}), /* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
new Provider(Engine, {useClass: TurboEngine, multi: true}) /* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true}
])[0]; ])[0];
expect(provider.key.token).toBe(Engine); expect(provider.key.token).toBe(Engine);
@ -535,8 +536,8 @@ export function main() {
it("should support providers as hash", () => { it("should support providers as hash", () => {
var provider = ReflectiveInjector.resolve([ var provider = ReflectiveInjector.resolve([
{provide: Engine, useClass: BrokenEngine, multi: true}, /* @ts2dart_Provider */ {provide: Engine, useClass: BrokenEngine, multi: true},
{provide: Engine, useClass: TurboEngine, multi: true} /* @ts2dart_Provider */ {provide: Engine, useClass: TurboEngine, multi: true}
])[0]; ])[0];
expect(provider.key.token).toBe(Engine); expect(provider.key.token).toBe(Engine);
@ -545,25 +546,41 @@ 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([
[new Provider(Engine, {useClass: BrokenEngine, multi: true})])[0]; /* @ts2dart_Provider */ {
provide: Engine,
useClass: BrokenEngine,
multi: true
}
])[0];
expect(provider.key.token).toBe(Engine); expect(provider.key.token).toBe(Engine);
expect(provider.multiProvider).toEqual(true); expect(provider.multiProvider).toEqual(true);
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(() => { () => {
ReflectiveInjector.resolve( expect(() => {
[new Provider(Engine, {useClass: BrokenEngine, multi: true}), Engine]); ReflectiveInjector.resolve([
}).toThrowErrorWith("Cannot mix multi providers and regular providers"); /* @ts2dart_Provider */ {
provide: Engine,
useClass: BrokenEngine,
multi: true
},
Engine
]);
})
.toThrowErrorWith(
"Cannot mix multi providers and regular providers");
expect(() => { expect(() => {
ReflectiveInjector.resolve( ReflectiveInjector.resolve(
[Engine, new Provider(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', () => {
var providers = ReflectiveInjector.resolve([ var providers = ReflectiveInjector.resolve([

View File

@ -2272,7 +2272,13 @@ class PublicApi {
@Directive({ @Directive({
selector: '[public-api]', selector: '[public-api]',
providers: [new Provider(PublicApi, {useExisting: PrivateImpl, deps: []})] providers: [
/* @ts2dart_Provider */ {
provide: PublicApi,
useExisting: PrivateImpl,
deps: []
}
]
}) })
@Injectable() @Injectable()
class PrivateImpl extends PublicApi { class PrivateImpl extends PublicApi {
@ -2343,7 +2349,11 @@ function createInjectableWithLogging(inj: Injector) {
@Component({ @Component({
selector: 'component-providing-logging-injectable', selector: 'component-providing-logging-injectable',
providers: [ providers: [
new Provider(InjectableService, {useFactory: createInjectableWithLogging, deps: [Injector]}) /* @ts2dart_Provider */ {
provide: InjectableService,
useFactory: createInjectableWithLogging,
deps: [Injector]
}
], ],
template: '' template: ''
}) })
@ -2369,8 +2379,10 @@ class DirectiveProvidingInjectableInView {
@Component({ @Component({
selector: 'directive-providing-injectable', selector: 'directive-providing-injectable',
providers: [new Provider(InjectableService, {useValue: 'host'})], providers:
viewProviders: [new Provider(InjectableService, {useValue: 'view'})], [/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'host'}],
viewProviders:
[/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'view'}],
template: '' template: ''
}) })
@Injectable() @Injectable()
@ -2420,7 +2432,12 @@ class EventBus {
@Directive({ @Directive({
selector: 'grand-parent-providing-event-bus', selector: 'grand-parent-providing-event-bus',
providers: [new Provider(EventBus, {useValue: new EventBus(null, "grandparent")})] providers: [
/* @ts2dart_Provider */ {
provide: EventBus,
useValue: new EventBus(null, "grandparent")
}
]
}) })
class GrandParentProvidingEventBus { class GrandParentProvidingEventBus {
bus: EventBus; bus: EventBus;

View File

@ -4,6 +4,6 @@ import {HashLocationStrategy, LocationStrategy} from 'angular2/platform/common';
import {App} from "./index_common"; import {App} from "./index_common";
export function main() { export function main() {
bootstrapApp( bootstrapApp(App,
App, [WORKER_APP_ROUTER, new Provider(LocationStrategy, {useClass: HashLocationStrategy})]); [WORKER_APP_ROUTER, {provide: LocationStrategy, useClass: HashLocationStrategy}]);
} }