refactor: remove ts2dart annotations

This commit is contained in:
Victor Berchet 2016-07-30 19:18:14 -07:00
parent 13c8211065
commit 28c4852cd6
89 changed files with 344 additions and 489 deletions

View File

@ -55,4 +55,4 @@ import {CORE_DIRECTIVES} from './directives';
*
* @experimental Contains forms which are experimental.
*/
export const COMMON_DIRECTIVES: Type[][] = /*@ts2dart_const*/[CORE_DIRECTIVES];
export const COMMON_DIRECTIVES: Type[][] = [CORE_DIRECTIVES];

View File

@ -58,7 +58,7 @@ import {NgTemplateOutlet} from './ng_template_outlet';
*
* @stable
*/
export const CORE_DIRECTIVES: Type[] = /*@ts2dart_const*/[
export const CORE_DIRECTIVES: Type[] = [
NgClass,
NgFor,
NgIf,

View File

@ -57,7 +57,7 @@ export {NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators} from './forms-deprecated
*
* @experimental
*/
export const FORM_PROVIDERS: Type[] = /*@ts2dart_const*/[FormBuilder, RadioControlRegistry];
export const FORM_PROVIDERS: Type[] = [FormBuilder, RadioControlRegistry];
/**

View File

@ -58,7 +58,7 @@ export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValida
* ```
* @experimental
*/
export const FORM_DIRECTIVES: Type[] = /*@ts2dart_const*/[
export const FORM_DIRECTIVES: Type[] = [
NgControlName,
NgControlGroup,

View File

@ -10,7 +10,7 @@ import {Directive, ElementRef, Renderer, forwardRef} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor';
export const CHECKBOX_VALUE_ACCESSOR: any = /*@ts2dart_const*/ {
export const CHECKBOX_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => CheckboxControlValueAccessor),
multi: true

View File

@ -41,5 +41,4 @@ export interface ControlValueAccessor {
* See {@link DefaultValueAccessor} for how to implement one.
* @experimental
*/
export const NG_VALUE_ACCESSOR: OpaqueToken =
/*@ts2dart_const*/ new OpaqueToken('NgValueAccessor');
export const NG_VALUE_ACCESSOR: OpaqueToken = new OpaqueToken('NgValueAccessor');

View File

@ -12,8 +12,7 @@ import {isBlank} from '../../facade/lang';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor';
export const DEFAULT_VALUE_ACCESSOR: any = /*@ts2dart_const*/
/* @ts2dart_Provider */ {
export const DEFAULT_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => DefaultValueAccessor),
multi: true

View File

@ -16,8 +16,7 @@ import {Form} from './form_interface';
import {composeAsyncValidators, composeValidators, controlPath} from './shared';
import {AsyncValidatorFn, ValidatorFn} from './validators';
export const controlGroupProvider: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const controlGroupProvider: any = {
provide: ControlContainer,
useExisting: forwardRef(() => NgControlGroup)
};

View File

@ -19,8 +19,7 @@ import {composeAsyncValidators, composeValidators, controlPath, isPropertyUpdate
import {AsyncValidatorFn, ValidatorFn} from './validators';
export const controlNameBinding: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const controlNameBinding: any = {
provide: NgControl,
useExisting: forwardRef(() => NgControlName)
};

View File

@ -20,8 +20,10 @@ import {NgControl} from './ng_control';
import {NgControlGroup} from './ng_control_group';
import {composeAsyncValidators, composeValidators, setUpControl, setUpControlGroup} from './shared';
export const formDirectiveProvider: any =
/*@ts2dart_const*/ {provide: ControlContainer, useExisting: forwardRef(() => NgForm)};
export const formDirectiveProvider: any = {
provide: ControlContainer,
useExisting: forwardRef(() => NgForm)
};
let _formWarningDisplayed: boolean = false;

View File

@ -18,8 +18,7 @@ import {NgControl} from './ng_control';
import {composeAsyncValidators, composeValidators, isPropertyUpdated, selectValueAccessor, setUpControl} from './shared';
import {AsyncValidatorFn, ValidatorFn} from './validators';
export const formControlBinding: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const formControlBinding: any = {
provide: NgControl,
useExisting: forwardRef(() => NgFormControl)
};

View File

@ -21,8 +21,7 @@ import {NgControl} from './ng_control';
import {NgControlGroup} from './ng_control_group';
import {composeAsyncValidators, composeValidators, setUpControl, setUpControlGroup} from './shared';
export const formDirectiveProvider: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const formDirectiveProvider: any = {
provide: ControlContainer,
useExisting: forwardRef(() => NgFormModel)
};

View File

@ -17,8 +17,7 @@ import {NgControl} from './ng_control';
import {composeAsyncValidators, composeValidators, isPropertyUpdated, selectValueAccessor, setUpControl} from './shared';
import {AsyncValidatorFn, ValidatorFn} from './validators';
export const formControlBinding: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const formControlBinding: any = {
provide: NgControl,
useExisting: forwardRef(() => NgModel)
};

View File

@ -12,7 +12,7 @@ import {NumberWrapper, isBlank} from '../../facade/lang';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor';
export const NUMBER_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const NUMBER_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => NumberValueAccessor),
multi: true

View File

@ -14,7 +14,7 @@ import {isPresent} from '../../facade/lang';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor';
import {NgControl} from './ng_control';
export const RADIO_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const RADIO_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => RadioControlValueAccessor),
multi: true

View File

@ -13,7 +13,7 @@ import {StringWrapper, isBlank, isPresent, isPrimitive, looseIdentical} from '..
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor';
export const SELECT_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const SELECT_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => SelectControlValueAccessor),
multi: true

View File

@ -35,9 +35,9 @@ import {NG_VALIDATORS, Validators} from '../validators';
*/
export interface Validator { validate(c: AbstractControl): {[key: string]: any}; }
const REQUIRED = /*@ts2dart_const*/ Validators.required;
const REQUIRED = Validators.required;
export const REQUIRED_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const REQUIRED_VALIDATOR: any = {
provide: NG_VALIDATORS,
useValue: REQUIRED,
multi: true
@ -74,7 +74,7 @@ export interface AsyncValidatorFn {
*
* {@example common/forms/ts/validators/validators.ts region='min'}
*/
export const MIN_LENGTH_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const MIN_LENGTH_VALIDATOR: any = {
provide: NG_VALIDATORS,
useExisting: forwardRef(() => MinLengthValidator),
multi: true
@ -107,7 +107,7 @@ export class MinLengthValidator implements Validator {
*
* {@example common/forms/ts/validators/validators.ts region='max'}
*/
export const MAX_LENGTH_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const MAX_LENGTH_VALIDATOR: any = {
provide: NG_VALIDATORS,
useExisting: forwardRef(() => MaxLengthValidator),
multi: true
@ -134,7 +134,7 @@ export class MaxLengthValidator implements Validator {
}
export const PATTERN_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const PATTERN_VALIDATOR: any = {
provide: NG_VALIDATORS,
useExisting: forwardRef(() => PatternValidator),
multi: true

View File

@ -24,7 +24,7 @@ import {AbstractControl} from './model';
* {@example core/forms/ts/ng_validators/ng_validators.ts region='ng_validators'}
* @experimental
*/
export const NG_VALIDATORS: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken('NgValidators');
export const NG_VALIDATORS: OpaqueToken = new OpaqueToken('NgValidators');
/**
* Providers for asynchronous validators to be used for {@link Control}s
@ -36,8 +36,7 @@ export const NG_VALIDATORS: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken('Ng
*
* @experimental
*/
export const NG_ASYNC_VALIDATORS: OpaqueToken =
/*@ts2dart_const*/ new OpaqueToken('NgAsyncValidators');
export const NG_ASYNC_VALIDATORS: OpaqueToken = new OpaqueToken('NgAsyncValidators');
/**
* Provides a set of validators used by form controls.

View File

@ -69,4 +69,4 @@ export abstract class LocationStrategy {
* ```
* @stable
*/
export const APP_BASE_HREF: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken('appBaseHref');
export const APP_BASE_HREF: OpaqueToken = new OpaqueToken('appBaseHref');

View File

@ -32,7 +32,7 @@ import {UpperCasePipe} from './uppercase_pipe';
*
* @experimental Contains i18n pipes which are experimental
*/
export const COMMON_PIPES = /*@ts2dart_const*/[
export const COMMON_PIPES = [
AsyncPipe,
UpperCasePipe,
LowerCasePipe,

View File

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

View File

@ -14,7 +14,7 @@ import {PromiseWrapper} from '../../src/facade/promise';
import {TimerWrapper, ObservableWrapper, EventEmitter} from '../../src/facade/async';
export function main() {
function asyncValidator(expected: any /** TODO #9100 */, timeouts = /*@ts2dart_const*/ {}) {
function asyncValidator(expected: any /** TODO #9100 */, timeouts = {}) {
return (c: any /** TODO #9100 */) => {
var completer = PromiseWrapper.completer();
var t = isPresent((timeouts as any /** TODO #9100 */)[c.value]) ?

View File

@ -52,8 +52,7 @@ const _NO_XHR: XHR = {
* 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*/[
export const COMPILER_PROVIDERS: Array<any|Type|{[k: string]: any}|any[]> = [
{provide: Reflector, useValue: reflector},
{provide: ReflectorReader, useExisting: Reflector},
{provide: XHR, useValue: _NO_XHR},
@ -68,11 +67,11 @@ export const COMPILER_PROVIDERS: Array<any|Type|{[k: string]: any}|any[]> =
StyleCompiler,
ViewCompiler,
NgModuleCompiler,
/*@ts2dart_Provider*/ {provide: CompilerConfig, useValue: new CompilerConfig()},
{provide: CompilerConfig, useValue: new CompilerConfig()},
RuntimeCompiler,
/*@ts2dart_Provider*/ {provide: Compiler, useExisting: RuntimeCompiler},
{provide: Compiler, useExisting: RuntimeCompiler},
DomElementSchemaRegistry,
/*@ts2dart_Provider*/ {provide: ElementSchemaRegistry, useExisting: DomElementSchemaRegistry},
{provide: ElementSchemaRegistry, useExisting: DomElementSchemaRegistry},
UrlResolver,
DirectiveResolver,
PipeResolver,

View File

@ -567,7 +567,7 @@ export class ClassStmt extends Statement {
export class IfStmt extends Statement {
constructor(
public condition: Expression, public trueCase: Statement[],
public falseCase: Statement[] = /*@ts2dart_const*/[]) {
public falseCase: Statement[] = []) {
super();
}
visitStatement(visitor: StatementVisitor, context: any): any {

View File

@ -75,8 +75,7 @@ const OBJECT = 'object';
//
// =================================================================================================
const SCHEMA: string[] =
/*@ts2dart_const*/ ([
const SCHEMA: string[] = ([
'*|textContent,%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop',
'^*|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*autocomplete,*autocompleteerror,*beforecopy,*beforecut,*beforepaste,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*message,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*paste,*pause,*play,*playing,*progress,*ratechange,*reset,*resize,*scroll,*search,*seeked,*seeking,*select,*selectstart,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate',
'media|!autoplay,!controls,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,#playbackRate,preload,src,#volume',

View File

@ -10,7 +10,7 @@ import {ListWrapper} from './facade/collection';
import {BaseException} from './facade/exceptions';
import {RegExpMatcherWrapper, RegExpWrapper, StringWrapper, isBlank, isPresent} from './facade/lang';
const _EMPTY_ATTR_VALUE = /*@ts2dart_const*/ '';
const _EMPTY_ATTR_VALUE = '';
// TODO: Can't use `const` here as
// in Dart this is not transpiled into `final` yet...

View File

@ -63,7 +63,7 @@ const TEXT_CSS_SELECTOR = CssSelector.parse('*')[0];
*
* This is currently an internal-only feature and not meant for general use.
*/
export const TEMPLATE_TRANSFORMS: any = /*@ts2dart_const*/ new OpaqueToken('TemplateTransforms');
export const TEMPLATE_TRANSFORMS: any = new OpaqueToken('TemplateTransforms');
export class TemplateParseError extends ParseError {
constructor(message: string, span: ParseSourceSpan, level: ParseErrorLevel) {

View File

@ -163,7 +163,7 @@ class ListDir1Alt {
class ListDir2 {
}
const LIST_CHILDREN = /*@ts2dart_const*/[ListDir1, ListDir2];
const LIST_CHILDREN = [ListDir1, ListDir2];
@Component({
selector: 'directive-list-comp',

View File

@ -21,7 +21,7 @@ import {OpaqueToken} from './di';
* using this token.
* @experimental
*/
export const APP_ID: any = /*@ts2dart_const*/ new OpaqueToken('AppId');
export const APP_ID: any = new OpaqueToken('AppId');
export function _appIdRandomProviderFactory() {
return `${_randomChar()}${_randomChar()}${_randomChar()}`;
@ -31,8 +31,7 @@ export function _appIdRandomProviderFactory() {
* Providers that will generate a random APP_ID_TOKEN.
* @experimental
*/
export const APP_ID_RANDOM_PROVIDER =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const APP_ID_RANDOM_PROVIDER = {
provide: APP_ID,
useFactory: _appIdRandomProviderFactory,
deps: <any[]>[]
@ -46,19 +45,16 @@ function _randomChar(): string {
* A function that will be executed when a platform is initialized.
* @experimental
*/
export const PLATFORM_INITIALIZER: any =
/*@ts2dart_const*/ new OpaqueToken('Platform Initializer');
export const PLATFORM_INITIALIZER: any = new OpaqueToken('Platform Initializer');
/**
* A function that will be executed when an application is initialized.
* @experimental
*/
export const APP_INITIALIZER: any =
/*@ts2dart_const*/ new OpaqueToken('Application Initializer');
export const APP_INITIALIZER: any = new OpaqueToken('Application Initializer');
/**
* A token which indicates the root directory of the application
* @experimental
*/
export const PACKAGE_ROOT_URL: any =
/*@ts2dart_const*/ new OpaqueToken('Application Packages Root URL');
export const PACKAGE_ROOT_URL: any = new OpaqueToken('Application Packages Root URL');

View File

@ -27,15 +27,13 @@ export {PipeTransform} from './pipe_transform';
/**
* Structural diffing for `Object`s and `Map`s.
*/
export const keyValDiff: KeyValueDifferFactory[] =
/*@ts2dart_const*/[new DefaultKeyValueDifferFactory()];
export const keyValDiff: KeyValueDifferFactory[] = [new DefaultKeyValueDifferFactory()];
/**
* Structural diffing for `Iterable` types such as `Array`s.
*/
export const iterableDiff: IterableDifferFactory[] =
/*@ts2dart_const*/[new DefaultIterableDifferFactory()];
export const iterableDiff: IterableDifferFactory[] = [new DefaultIterableDifferFactory()];
export const defaultIterableDiffers = /*@ts2dart_const*/ new IterableDiffers(iterableDiff);
export const defaultIterableDiffers = new IterableDiffers(iterableDiff);
export const defaultKeyValueDiffers = /*@ts2dart_const*/ new KeyValueDiffers(keyValDiff);
export const defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);

View File

@ -14,7 +14,6 @@ import {ChangeDetectorRef} from '../change_detector_ref';
import {IterableDiffer, IterableDifferFactory, TrackByFn} from './iterable_differs';
/* @ts2dart_const */
export class DefaultIterableDifferFactory implements IterableDifferFactory {
constructor() {}
supports(obj: Object): boolean { return isListLikeIterable(obj); }

View File

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

View File

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

View File

@ -9,8 +9,8 @@
import {BaseException, unimplemented} from '../facade/exceptions';
import {stringify} from '../facade/lang';
const _THROW_IF_NOT_FOUND = /*@ts2dart_const*/ new Object();
export const THROW_IF_NOT_FOUND = /*@ts2dart_const*/ _THROW_IF_NOT_FOUND;
const _THROW_IF_NOT_FOUND = new Object();
export const THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
class _NullInjector implements Injector {
get(token: any, notFoundValue: any = _THROW_IF_NOT_FOUND): any {

View File

@ -47,7 +47,6 @@ import {stringify} from '../facade/lang';
* var injector = Injector.resolveAndCreate([Engine, Car]);
* expect(injector.get(Car).engine instanceof Engine).toBe(true);
* ```
* @ts2dart_const
* @stable
*/
export class InjectMetadata {
@ -75,7 +74,6 @@ export class InjectMetadata {
* var injector = Injector.resolveAndCreate([Car]);
* expect(injector.get(Car).engine).toBeNull();
* ```
* @ts2dart_const
* @stable
*/
export class OptionalMetadata {
@ -85,7 +83,6 @@ export class OptionalMetadata {
/**
* `DependencyMetadata` is used by the framework to extend DI.
* This is internal to Angular and should not be used directly.
* @ts2dart_const
* @stable
*/
export class DependencyMetadata {
@ -122,7 +119,6 @@ export class DependencyMetadata {
* var injector = Injector.resolveAndCreate([NeedsService, UsefulService]);
* expect(() => injector.get(NeedsService)).toThrowError();
* ```
* @ts2dart_const
* @stable
*/
export class InjectableMetadata {
@ -155,7 +151,6 @@ export class InjectableMetadata {
* var child = inj.resolveAndCreateChild([NeedsDependency]);
* expect(() => child.get(NeedsDependency)).toThrowError();
* ```
* @ts2dart_const
* @stable
*/
export class SelfMetadata {
@ -186,7 +181,6 @@ export class SelfMetadata {
* var inj = Injector.resolveAndCreate([Dependency, NeedsDependency]);
* expect(() => inj.get(NeedsDependency)).toThrowError();
* ```
* @ts2dart_const
* @stable
*/
export class SkipSelfMetadata {
@ -246,7 +240,6 @@ export class SkipSelfMetadata {
*
* bootstrap(App);
*```
* @ts2dart_const
* @stable
*/
export class HostMetadata {

View File

@ -26,7 +26,6 @@
*
* Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better
* error messages.
* @ts2dart_const
* @stable
*/
export class OpaqueToken {

View File

@ -24,7 +24,6 @@ import {Type, isBlank, isFunction, isType, normalizeBool, stringify} from '../fa
*
* expect(injector.get("message")).toEqual('Hello');
* ```
* @ts2dart_const
* @deprecated
*/
export class Provider {
@ -211,7 +210,6 @@ export class Provider {
* See {@link Provider} instead.
*
* @deprecated
* @ts2dart_const
*/
export class Binding extends Provider {
constructor(token: any, {toClass, toValue, toAlias, toFactory, deps, multi}: {

View File

@ -21,7 +21,7 @@ var __unused: Type; // avoid unused import when Type union types are erased
// Threshold for the dynamic version
const _MAX_CONSTRUCTION_COUNTER = 10;
const UNDEFINED = /*@ts2dart_const*/ new Object();
const UNDEFINED = new Object();
export interface ReflectiveProtoInjectorStrategy {
getProviderAtIndex(index: number): ResolvedReflectiveProvider;
@ -629,7 +629,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
*/
debugContext(): any { return this._debugContext(); }
get(token: any, notFoundValue: any = /*@ts2dart_const*/ THROW_IF_NOT_FOUND): any {
get(token: any, notFoundValue: any = THROW_IF_NOT_FOUND): any {
return this._getByKey(ReflectiveKey.get(token), null, null, notFoundValue);
}

View File

@ -30,7 +30,7 @@ export class ReflectiveDependency {
}
}
const _EMPTY_LIST: any[] = /*@ts2dart_const*/[];
const _EMPTY_LIST: any[] = [];
/**
* An internal resolved representation of a {@link Provider} used by the {@link Injector}.

View File

@ -81,7 +81,6 @@ export class ComponentRef_<C> extends ComponentRef<C> {
/**
* @experimental
* @ts2dart_const
*/
const EMPTY_CONTEXT = new Object();

View File

@ -15,7 +15,6 @@ import {DebugAppView} from './view';
import {ViewType} from './view_type';
/* @ts2dart_const */
export class StaticNodeDebugInfo {
constructor(
public providerTokens: any[], public componentToken: any,

View File

@ -9,7 +9,7 @@
import {Injector, THROW_IF_NOT_FOUND} from '../di/injector';
import {AppView} from './view';
const _UNDEFINED = /*@ts2dart_const*/ new Object();
const _UNDEFINED = new Object();
export class ElementInjector extends Injector {
constructor(private _view: AppView<any>, private _nodeIndex: number) { super(); }

View File

@ -12,7 +12,7 @@ import {ElementRef} from './element_ref';
import {AppView} from './view';
import {EmbeddedViewRef} from './view_ref';
const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object();
const EMPTY_CONTEXT = new Object();
/**
* Represents an Embedded Template that can be used to instantiate Embedded Views.

View File

@ -70,7 +70,7 @@ function _flattenNestedViewRenderNodes(nodes: any[], renderNodes: any[]): any[]
return renderNodes;
}
const EMPTY_ARR: any[] = /*@ts2dart_const*/[];
const EMPTY_ARR: any[] = [];
export function ensureSlotCount(projectableNodes: any[][], expectedSlotCount: number): any[][] {
var res: any[][];

View File

@ -63,7 +63,6 @@ export const ANALYZE_FOR_ENTRY_COMPONENTS = new OpaqueToken('AnalyzeForEntryComp
* A decorator can inject string literal `text` like so:
*
* {@example core/ts/metadata/metadata.ts region='attributeMetadata'}
* @ts2dart_const
* @stable
*/
export class AttributeMetadata extends DependencyMetadata {
@ -186,7 +185,6 @@ export class AttributeMetadata extends DependencyMetadata {
*
* The injected object is an unmodifiable live list.
* See {@link QueryList} for more details.
* @ts2dart_const
* @deprecated
*/
export class QueryMetadata extends DependencyMetadata {
@ -256,7 +254,6 @@ export class QueryMetadata extends DependencyMetadata {
* }
* }
* ```
* @ts2dart_const
* @stable
*/
export class ContentChildrenMetadata extends QueryMetadata {
@ -287,7 +284,6 @@ export class ContentChildrenMetadata extends QueryMetadata {
* }
* }
* ```
* @ts2dart_const
* @stable
*/
export class ContentChildMetadata extends QueryMetadata {
@ -330,7 +326,6 @@ export class ContentChildMetadata extends QueryMetadata {
*
* The injected object is an iterable and observable live list.
* See {@link QueryList} for more details.
* @ts2dart_const
* @deprecated
*/
export class ViewQueryMetadata extends QueryMetadata {
@ -423,7 +418,6 @@ export class ViewQueryMetadata extends QueryMetadata {
* }
* }
* ```
* @ts2dart_const
* @stable
*/
export class ViewChildrenMetadata extends ViewQueryMetadata {
@ -501,7 +495,6 @@ export class ViewChildrenMetadata extends ViewQueryMetadata {
* }
* }
* ```
* @ts2dart_const
* @stable
*/
export class ViewChildMetadata extends ViewQueryMetadata {

View File

@ -408,7 +408,6 @@ export interface DirectiveMetadataType {
* Note also that although the `<li></li>` template still exists inside the `<template></template>`,
* the instantiated
* view occurs on the second `<li></li>` which is a sibling to the `<template>` element.
* @ts2dart_const
* @stable
*/
export class DirectiveMetadata extends InjectableMetadata implements DirectiveMetadataType {
@ -824,7 +823,6 @@ export interface ComponentMetadataType extends DirectiveMetadataType {
* ### Example
*
* {@example core/ts/metadata/metadata.ts region='component'}
* @ts2dart_const
* @stable
*/
export class ComponentMetadata extends DirectiveMetadata implements ComponentMetadataType {
@ -1095,7 +1093,6 @@ export interface PipeMetadataType {
* ### Example
*
* {@example core/ts/metadata/metadata.ts region='pipe'}
* @ts2dart_const
* @stable
*/
export class PipeMetadata extends InjectableMetadata implements PipeMetadataType {
@ -1152,7 +1149,6 @@ export class PipeMetadata extends InjectableMetadata implements PipeMetadataType
*
* bootstrap(App);
* ```
* @ts2dart_const
* @stable
*/
export class InputMetadata {
@ -1203,7 +1199,6 @@ export class InputMetadata {
* }
* bootstrap(App);
* ```
* @ts2dart_const
* @stable
*/
export class OutputMetadata {
@ -1244,7 +1239,6 @@ export class OutputMetadata {
*
* bootstrap(App);
* ```
* @ts2dart_const
* @stable
*/
export class HostBindingMetadata {
@ -1284,7 +1278,6 @@ export class HostBindingMetadata {
*
* bootstrap(App);
* ```
* @ts2dart_const
* @stable
*/
export class HostListenerMetadata {

View File

@ -71,7 +71,6 @@ export var VIEW_ENCAPSULATION_VALUES =
* }
* }
* ```
* @ts2dart_const
*
* @deprecated Use ComponentMetadata instead.
*/

View File

@ -36,8 +36,7 @@ import {OpaqueToken} from './di';
* @deprecated Providing platform directives via a provider is deprecated. Provide platform
* directives via an {@link NgModule} instead.
*/
export const PLATFORM_DIRECTIVES: OpaqueToken =
/*@ts2dart_const*/ new OpaqueToken('Platform Directives');
export const PLATFORM_DIRECTIVES: OpaqueToken = new OpaqueToken('Platform Directives');
/**
* A token that can be provided when bootstraping an application to make an array of pipes
@ -65,4 +64,4 @@ export const PLATFORM_DIRECTIVES: OpaqueToken =
* @deprecated Providing platform pipes via a provider is deprecated. Provide platform pipes via an
* {@link NgModule} instead.
*/
export const PLATFORM_PIPES: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken('Platform Pipes');
export const PLATFORM_PIPES: OpaqueToken = new OpaqueToken('Platform Pipes');

View File

@ -11,12 +11,10 @@ import {WtfScopeFn, createScope, detectWTF, endTimeRange, leave, startTimeRange}
export {WtfScopeFn} from './wtf_impl';
// Change exports to const once https://github.com/angular/ts2dart/issues/150
/**
* True if WTF is enabled.
*/
export var wtfEnabled = detectWTF();
export const wtfEnabled = detectWTF();
function noopScope(arg0?: any, arg1?: any): any {
return null;

View File

@ -148,7 +148,6 @@ export interface GetTestability {
Testability;
}
/* @ts2dart_const */
class _NoopGetTestability implements GetTestability {
addToWindow(registry: TestabilityRegistry): void {}
findTestabilityInTree(registry: TestabilityRegistry, elem: any, findInAncestors: boolean):
@ -165,4 +164,4 @@ export function setTestabilityGetter(getter: GetTestability): void {
_testabilityGetter = getter;
}
var _testabilityGetter: GetTestability = /*@ts2dart_const*/ new _NoopGetTestability();
var _testabilityGetter: GetTestability = new _NoopGetTestability();

View File

@ -9,10 +9,8 @@
import {isBlank} from '../../src/facade/lang';
export function iterableChangesAsString(
{collection = /*@ts2dart_const*/[] as any, previous = /*@ts2dart_const*/[] as any,
additions = /*@ts2dart_const*/[] as any, moves = /*@ts2dart_const*/[] as any,
removals = /*@ts2dart_const*/[] as any,
identityChanges = /*@ts2dart_const*/[] as any}): string {
{collection = [] as any, previous = [] as any, additions = [] as any, moves = [] as any,
removals = [] as any, identityChanges = [] as any}): string {
return 'collection: ' + collection.join(', ') + '\n' +
'previous: ' + previous.join(', ') + '\n' +
'additions: ' + additions.join(', ') + '\n' +

View File

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

View File

@ -36,7 +36,7 @@ import {TemplateRef, TemplateRef_} from '@angular/core/src/linker/template_ref';
import {Renderer} from '@angular/core/src/render';
import {el, dispatchEvent} from '@angular/platform-browser/testing/browser_util';
const ANCHOR_ELEMENT = /*@ts2dart_const*/ new OpaqueToken('AnchorElement');
const ANCHOR_ELEMENT = new OpaqueToken('AnchorElement');
export function main() {
describe('jit', () => { declareTests({useJit: true}); });
@ -2416,9 +2416,7 @@ class PublicApi {
@Directive({
selector: '[public-api]',
providers: [
/* @ts2dart_Provider */ {provide: PublicApi, useExisting: PrivateImpl, deps: []}
]
providers: [{provide: PublicApi, useExisting: PrivateImpl, deps: []}]
})
class PrivateImpl extends PublicApi {
}
@ -2482,13 +2480,8 @@ function createInjectableWithLogging(inj: Injector) {
@Component({
selector: 'component-providing-logging-injectable',
providers: [
/* @ts2dart_Provider */ {
provide: InjectableService,
useFactory: createInjectableWithLogging,
deps: [Injector]
}
],
providers:
[{provide: InjectableService, useFactory: createInjectableWithLogging, deps: [Injector]}],
template: ''
})
class ComponentProvidingLoggingInjectable {
@ -2510,8 +2503,8 @@ class DirectiveProvidingInjectableInView {
@Component({
selector: 'directive-providing-injectable',
providers: [/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'host'}],
viewProviders: [/* @ts2dart_Provider */ {provide: InjectableService, useValue: 'view'}],
providers: [{provide: InjectableService, useValue: 'host'}],
viewProviders: [{provide: InjectableService, useValue: 'view'}],
template: ''
})
class DirectiveProvidingInjectableInHostAndView {
@ -2545,7 +2538,6 @@ class DirectiveConsumingInjectableUnbounded {
}
/* @ts2dart_const */
class EventBus {
parentEventBus: EventBus;
name: string;
@ -2558,9 +2550,7 @@ class EventBus {
@Directive({
selector: 'grand-parent-providing-event-bus',
providers: [
/* @ts2dart_Provider */ {provide: EventBus, useValue: new EventBus(null, 'grandparent')}
]
providers: [{provide: EventBus, useValue: new EventBus(null, 'grandparent')}]
})
class GrandParentProvidingEventBus {
bus: EventBus;

View File

@ -14,7 +14,7 @@ import {Type, ViewContainerRef, TemplateRef, ElementRef, ChangeDetectorRef, Chan
import {NgIf, NgFor} from '@angular/common';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
const ALL_DIRECTIVES = /*@ts2dart_const*/[
const ALL_DIRECTIVES = [
forwardRef(() => SimpleDirective),
forwardRef(() => CycleDirective),
forwardRef(() => SimpleComponent),
@ -49,7 +49,7 @@ const ALL_DIRECTIVES = /*@ts2dart_const*/[
NgFor
];
const ALL_PIPES = /*@ts2dart_const*/[
const ALL_PIPES = [
forwardRef(() => PipeNeedsChangeDetectorRef),
forwardRef(() => PipeNeedsService),
forwardRef(() => PurePipe),

View File

@ -60,7 +60,7 @@ export function main() {
describe('const', () => {
it('should support const expressions both in TS and Dart', () => {
const numbers = /*@ts2dart_const*/[1, 2, 3];
const numbers = [1, 2, 3];
expect(numbers).toEqual([1, 2, 3]);
});
});

View File

@ -44,18 +44,17 @@ export {NgSelectOption, SelectControlValueAccessor} from './directives/select_co
export {NgSelectMultipleOption, SelectMultipleControlValueAccessor} from './directives/select_multiple_control_value_accessor';
export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator} from './directives/validators';
export const SHARED_FORM_DIRECTIVES: Type[] = /*@ts2dart_const*/[
export const SHARED_FORM_DIRECTIVES: Type[] = [
NgSelectOption, NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor,
CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor,
RadioControlValueAccessor, NgControlStatus, RequiredValidator, MinLengthValidator,
MaxLengthValidator, PatternValidator
];
export const TEMPLATE_DRIVEN_DIRECTIVES: Type[] = /*@ts2dart_const*/[NgModel, NgModelGroup, NgForm];
export const TEMPLATE_DRIVEN_DIRECTIVES: Type[] = [NgModel, NgModelGroup, NgForm];
export const REACTIVE_DRIVEN_DIRECTIVES: Type[] = /*@ts2dart_const*/[
FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName
];
export const REACTIVE_DRIVEN_DIRECTIVES: Type[] =
[FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName];
/**
*
@ -74,15 +73,14 @@ export const REACTIVE_DRIVEN_DIRECTIVES: Type[] = /*@ts2dart_const*/[
* ```
* @experimental
*/
export const FORM_DIRECTIVES: Type[][] =
/*@ts2dart_const*/[TEMPLATE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
export const FORM_DIRECTIVES: Type[][] = [TEMPLATE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
/**
* @experimental
*/
export const REACTIVE_FORM_DIRECTIVES: Type[][] =
/*@ts2dart_const*/[REACTIVE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
[REACTIVE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
/**
* Internal module used for sharing directives between FormsModule and ReactiveFormsModule

View File

@ -10,7 +10,7 @@ import {Directive, ElementRef, Renderer, forwardRef} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor';
export const CHECKBOX_VALUE_ACCESSOR: any = /*@ts2dart_const*/ {
export const CHECKBOX_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => CheckboxControlValueAccessor),
multi: true

View File

@ -41,5 +41,4 @@ export interface ControlValueAccessor {
* See {@link DefaultValueAccessor} for how to implement one.
* @experimental
*/
export const NG_VALUE_ACCESSOR: OpaqueToken =
/*@ts2dart_const*/ new OpaqueToken('NgValueAccessor');
export const NG_VALUE_ACCESSOR: OpaqueToken = new OpaqueToken('NgValueAccessor');

View File

@ -12,8 +12,7 @@ import {isBlank} from '../facade/lang';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor';
export const DEFAULT_VALUE_ACCESSOR: any = /*@ts2dart_const*/
/* @ts2dart_Provider */ {
export const DEFAULT_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => DefaultValueAccessor),
multi: true

View File

@ -21,8 +21,10 @@ import {NgModel} from './ng_model';
import {NgModelGroup} from './ng_model_group';
import {composeAsyncValidators, composeValidators, setUpControl, setUpFormContainer} from './shared';
export const formDirectiveProvider: any =
/*@ts2dart_const*/ {provide: ControlContainer, useExisting: forwardRef(() => NgForm)};
export const formDirectiveProvider: any = {
provide: ControlContainer,
useExisting: forwardRef(() => NgForm)
};
/**
* If `NgForm` is bound in a component, `<form>` elements in that component will be

View File

@ -23,8 +23,7 @@ import {composeAsyncValidators, composeValidators, controlPath, isPropertyUpdate
import {TemplateDrivenErrors} from './template_driven_errors';
import {AsyncValidatorFn, ValidatorFn} from './validators';
export const formControlBinding: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const formControlBinding: any = {
provide: NgControl,
useExisting: forwardRef(() => NgModel)
};

View File

@ -16,8 +16,7 @@ import {ControlContainer} from './control_container';
import {NgForm} from './ng_form';
import {TemplateDrivenErrors} from './template_driven_errors';
export const modelGroupProvider: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const modelGroupProvider: any = {
provide: ControlContainer,
useExisting: forwardRef(() => NgModelGroup)
};

View File

@ -12,7 +12,7 @@ import {NumberWrapper, isBlank} from '../facade/lang';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor';
export const NUMBER_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const NUMBER_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => NumberValueAccessor),
multi: true

View File

@ -15,7 +15,7 @@ import {isPresent} from '../facade/lang';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor';
import {NgControl} from './ng_control';
export const RADIO_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const RADIO_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => RadioControlValueAccessor),
multi: true

View File

@ -19,8 +19,7 @@ import {AsyncValidatorFn, ValidatorFn} from '../validators';
import {FormGroupDirective} from './form_group_directive';
import {FormGroupName} from './form_group_name';
export const formArrayNameProvider: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const formArrayNameProvider: any = {
provide: ControlContainer,
useExisting: forwardRef(() => FormArrayName)
};

View File

@ -18,8 +18,7 @@ import {NgControl} from '../ng_control';
import {composeAsyncValidators, composeValidators, isPropertyUpdated, selectValueAccessor, setUpControl} from '../shared';
import {AsyncValidatorFn, ValidatorFn} from '../validators';
export const formControlBinding: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const formControlBinding: any = {
provide: NgControl,
useExisting: forwardRef(() => FormControlDirective)
};

View File

@ -25,8 +25,7 @@ import {FormGroupDirective} from './form_group_directive';
import {FormGroupName} from './form_group_name';
export const controlNameBinding: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const controlNameBinding: any = {
provide: NgControl,
useExisting: forwardRef(() => FormControlName)
};

View File

@ -23,8 +23,7 @@ import {composeAsyncValidators, composeValidators, setUpControl, setUpFormContai
import {FormArrayName} from './form_array_name';
import {FormGroupName} from './form_group_name';
export const formDirectiveProvider: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const formDirectiveProvider: any = {
provide: ControlContainer,
useExisting: forwardRef(() => FormGroupDirective)
};

View File

@ -16,8 +16,7 @@ import {ReactiveErrors} from '../reactive_errors';
import {FormGroupDirective} from './form_group_directive';
export const formGroupNameProvider: any =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
export const formGroupNameProvider: any = {
provide: ControlContainer,
useExisting: forwardRef(() => FormGroupName)
};

View File

@ -13,7 +13,7 @@ import {StringWrapper, isBlank, isPresent, isPrimitive, looseIdentical} from '..
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor';
export const SELECT_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const SELECT_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => SelectControlValueAccessor),
multi: true

View File

@ -35,9 +35,9 @@ import {NG_VALIDATORS, Validators} from '../validators';
*/
export interface Validator { validate(c: AbstractControl): {[key: string]: any}; }
const REQUIRED = /*@ts2dart_const*/ Validators.required;
const REQUIRED = Validators.required;
export const REQUIRED_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const REQUIRED_VALIDATOR: any = {
provide: NG_VALIDATORS,
useValue: REQUIRED,
multi: true
@ -81,7 +81,7 @@ export interface AsyncValidatorFn {
*
* {@example common/forms/ts/validators/validators.ts region='min'}
*/
export const MIN_LENGTH_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const MIN_LENGTH_VALIDATOR: any = {
provide: NG_VALIDATORS,
useExisting: forwardRef(() => MinLengthValidator),
multi: true
@ -114,7 +114,7 @@ export class MinLengthValidator implements Validator {
*
* {@example common/forms/ts/validators/validators.ts region='max'}
*/
export const MAX_LENGTH_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const MAX_LENGTH_VALIDATOR: any = {
provide: NG_VALIDATORS,
useExisting: forwardRef(() => MaxLengthValidator),
multi: true
@ -142,7 +142,7 @@ export class MaxLengthValidator implements Validator {
}
export const PATTERN_VALIDATOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {
export const PATTERN_VALIDATOR: any = {
provide: NG_VALIDATORS,
useExisting: forwardRef(() => PatternValidator),
multi: true

View File

@ -18,14 +18,13 @@ import {FormBuilder} from './form_builder';
* Shorthand set of providers used for building Angular forms.
* @experimental
*/
export const FORM_PROVIDERS: Type[] = /*@ts2dart_const*/[RadioControlRegistry];
export const FORM_PROVIDERS: Type[] = [RadioControlRegistry];
/**
* Shorthand set of providers used for building reactive Angular forms.
* @experimental
*/
export const REACTIVE_FORM_PROVIDERS: Type[] =
/*@ts2dart_const*/[FormBuilder, RadioControlRegistry];
export const REACTIVE_FORM_PROVIDERS: Type[] = [FormBuilder, RadioControlRegistry];
/**
* The ng module for forms.

View File

@ -24,7 +24,7 @@ import {AbstractControl} from './model';
* {@example core/forms/ts/ng_validators/ng_validators.ts region='ng_validators'}
* @experimental
*/
export const NG_VALIDATORS: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken('NgValidators');
export const NG_VALIDATORS: OpaqueToken = new OpaqueToken('NgValidators');
/**
* Providers for asynchronous validators to be used for {@link FormControl}s
@ -36,8 +36,7 @@ export const NG_VALIDATORS: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken('Ng
*
* @experimental
*/
export const NG_ASYNC_VALIDATORS: OpaqueToken =
/*@ts2dart_const*/ new OpaqueToken('NgAsyncValidators');
export const NG_ASYNC_VALIDATORS: OpaqueToken = new OpaqueToken('NgAsyncValidators');
/**
* Provides a set of validators used by form controls.

View File

@ -15,7 +15,7 @@ import {isPresent} from '../src/facade/lang';
import {PromiseWrapper} from '../src/facade/promise';
export function main() {
function asyncValidator(expected: any /** TODO #9100 */, timeouts = /*@ts2dart_const*/ {}) {
function asyncValidator(expected: any /** TODO #9100 */, timeouts = {}) {
return (c: any /** TODO #9100 */) => {
var completer = PromiseWrapper.completer();
var t = isPresent((timeouts as any /** TODO #9100 */)[c.value]) ?

View File

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

View File

@ -52,4 +52,4 @@ import {RouterLink} from './src/directives/router_link';
* bootstrap(AppCmp, [ROUTER_PROVIDERS]);
* ```
*/
export const ROUTER_DIRECTIVES: any[] = /*@ts2dart_const*/[RouterOutlet, RouterLink];
export const ROUTER_DIRECTIVES: any[] = [RouterOutlet, RouterLink];

View File

@ -83,7 +83,7 @@ export class RouteParams {
* ```
*/
export class RouteData {
constructor(public data: {[key: string]: any} = /*@ts2dart_const*/ {}) {}
constructor(public data: {[key: string]: any} = {}) {}
get(key: string): any { return normalizeBlank(StringMapWrapper.get(this.data, key)); }
}
@ -256,7 +256,7 @@ export class DefaultInstruction extends ResolvedInstruction {
export class UnresolvedInstruction extends Instruction {
constructor(
private _resolver: () => Promise<Instruction>, private _urlPath: string = '',
private _urlParams: string[] = /*@ts2dart_const*/[]) {
private _urlParams: string[] = []) {
super(null, null, {});
}

View File

@ -7,23 +7,17 @@
*/
/* @ts2dart_const */
export class RouteLifecycleHook {
constructor(public name: string) {}
}
/* @ts2dart_const */
export class CanActivate {
constructor(public fn: Function) {}
}
export const routerCanReuse: RouteLifecycleHook =
/*@ts2dart_const*/ new RouteLifecycleHook('routerCanReuse');
export const routerCanReuse: RouteLifecycleHook = new RouteLifecycleHook('routerCanReuse');
export const routerCanDeactivate: RouteLifecycleHook =
/*@ts2dart_const*/ new RouteLifecycleHook('routerCanDeactivate');
export const routerOnActivate: RouteLifecycleHook =
/*@ts2dart_const*/ new RouteLifecycleHook('routerOnActivate');
export const routerOnReuse: RouteLifecycleHook =
/*@ts2dart_const*/ new RouteLifecycleHook('routerOnReuse');
export const routerOnDeactivate: RouteLifecycleHook =
/*@ts2dart_const*/ new RouteLifecycleHook('routerOnDeactivate');
new RouteLifecycleHook('routerCanDeactivate');
export const routerOnActivate: RouteLifecycleHook = new RouteLifecycleHook('routerOnActivate');
export const routerOnReuse: RouteLifecycleHook = new RouteLifecycleHook('routerOnReuse');
export const routerOnDeactivate: RouteLifecycleHook = new RouteLifecycleHook('routerOnDeactivate');

View File

@ -16,13 +16,11 @@ export {RouteDefinition} from '../route_definition';
* The `RouteConfig` decorator defines routes for a given component.
*
* It takes an array of {@link RouteDefinition}s.
* @ts2dart_const
*/
export class RouteConfig {
constructor(public configs: RouteDefinition[]) {}
}
/* @ts2dart_const */
export abstract class AbstractRoute implements RouteDefinition {
name: string;
useAsDefault: boolean;
@ -65,7 +63,6 @@ export abstract class AbstractRoute implements RouteDefinition {
* ])
* class MyApp {}
* ```
* @ts2dart_const
*/
export class Route extends AbstractRoute {
component: any;
@ -105,7 +102,6 @@ export class Route extends AbstractRoute {
* ])
* class MyApp {}
* ```
* @ts2dart_const
*/
export class AuxRoute extends AbstractRoute {
component: any;
@ -148,7 +144,6 @@ export class AuxRoute extends AbstractRoute {
* ])
* class MyApp {}
* ```
* @ts2dart_const
*/
export class AsyncRoute extends AbstractRoute {
loader: () => Promise<Type>;
@ -189,7 +184,6 @@ export class AsyncRoute extends AbstractRoute {
* ])
* class MyApp {}
* ```
* @ts2dart_const
*/
export class Redirect extends AbstractRoute {
redirectTo: any[];

View File

@ -58,8 +58,7 @@ var _resolveToNull = PromiseWrapper.resolve<Instruction>(null);
* bootstrap(AppCmp, [ROUTER_PROVIDERS]);
* ```
*/
export const ROUTER_PRIMARY_COMPONENT: OpaqueToken =
/*@ts2dart_const*/ new OpaqueToken('RouterPrimaryComponent');
export const ROUTER_PRIMARY_COMPONENT: OpaqueToken = new OpaqueToken('RouterPrimaryComponent');
/**

View File

@ -36,10 +36,9 @@ import {ROUTER_PROVIDERS_COMMON} from './router_providers_common';
* bootstrap(AppCmp, [ROUTER_PROVIDERS]);
* ```
*/
export const ROUTER_PROVIDERS: any[] = /*@ts2dart_const*/[
export const ROUTER_PROVIDERS: any[] = [
ROUTER_PROVIDERS_COMMON,
/*@ts2dart_const*/ (
/* @ts2dart_Provider */ {provide: PlatformLocation, useClass: BrowserPlatformLocation}),
({provide: PlatformLocation, useClass: BrowserPlatformLocation}),
];
/**
@ -47,4 +46,4 @@ export const ROUTER_PROVIDERS: any[] = /*@ts2dart_const*/[
*
* @deprecated
*/
export const ROUTER_BINDINGS = /*@ts2dart_const*/ ROUTER_PROVIDERS;
export const ROUTER_BINDINGS = ROUTER_PROVIDERS;

View File

@ -19,9 +19,8 @@ import {RootRouter, Router} from './router';
/**
* The Platform agnostic ROUTER PROVIDERS
*/
export const ROUTER_PROVIDERS_COMMON: any[] = /*@ts2dart_const*/[
RouteRegistry,
/* @ts2dart_Provider */ {provide: LocationStrategy, useClass: PathLocationStrategy}, Location, {
export const ROUTER_PROVIDERS_COMMON: any[] = [
RouteRegistry, {provide: LocationStrategy, useClass: PathLocationStrategy}, Location, {
provide: Router,
useFactory: routerFactory,
deps: [RouteRegistry, Location, ROUTER_PRIMARY_COMPONENT, ApplicationRef]
@ -29,7 +28,7 @@ export const ROUTER_PROVIDERS_COMMON: any[] = /*@ts2dart_const*/[
{
provide: ROUTER_PRIMARY_COMPONENT,
useFactory: routerPrimaryComponentFactory,
deps: /*@ts2dart_const*/ ([ApplicationRef])
deps: [ApplicationRef]
}
];

View File

@ -32,8 +32,8 @@ export function serializeParams(urlParams: {[key: string]: any}, joiner = '&'):
*/
export class Url {
constructor(
public path: string, public child: Url = null, public auxiliary: Url[] = /*@ts2dart_const*/[],
public params: {[key: string]: any} = /*@ts2dart_const*/ {}) {}
public path: string, public child: Url = null, public auxiliary: Url[] = [],
public params: {[key: string]: any} = {}) {}
toString(): string {
return this.path + this._matrixParamsToString() + this._auxToString() + this._childString();
@ -61,9 +61,8 @@ export class Url {
}
export class RootUrl extends Url {
constructor(
path: string, child: Url = null, auxiliary: Url[] = /*@ts2dart_const*/[],
params: {[key: string]: any} = null) {
constructor(path: string, child: Url = null, auxiliary: Url[] = [], params: {[key: string]:
any} = null) {
super(path, child, auxiliary, params);
}

View File

@ -17,8 +17,7 @@ export function main() {
var locationStrategy: any /** TODO #9100 */, location: any /** TODO #9100 */;
function makeLocation(
baseHref: string = '/my/app', provider: any = /*@ts2dart_const*/[]): Location {
function makeLocation(baseHref: string = '/my/app', provider: any = []): Location {
locationStrategy = new MockLocationStrategy();
locationStrategy.internalBaseHref = baseHref;
let injector = ReflectiveInjector.resolveAndCreate(

View File

@ -47,7 +47,7 @@ function creditCardValidator(c: any /** TODO #9100 */): {[key: string]: boolean}
}
}
const creditCardValidatorBinding = /** @ts2dart_const */ /** @ts2dart_Provider */ {
const creditCardValidatorBinding = {
provide: NG_VALIDATORS,
useValue: creditCardValidator,
multi: true

View File

@ -1,32 +0,0 @@
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../dist/packages-ts2dart/",
"paths": {
"selenium-webdriver": ["@angular/typings/selenium-webdriver/selenium-webdriver.d.ts"],
"rxjs/*": ["../node_modules/rxjs/*"],
"@angular/upgrade": ["./upgrade-ts2dart.d.ts"],
"@angular/*": ["./@angular/*"]
},
"rootDir": ".",
"sourceMap": true,
"sourceRoot": ".",
"target": "es6"
},
"exclude": [
"@angular/upgrade/",
"@angular/core/test/typings.d.ts",
"@angular/manual_typings/globals.d.ts",
"@angular/typings/es6-collections/es6-collections.d.ts",
"@angular/typings/es6-promise/es6-promise.d.ts",
"@angular/typings/tsd.d.ts",
"@angular/typings.d.ts",
"angular1_router",
"rollup-test"
]
}

View File

@ -28,8 +28,6 @@
"benchpress",
"payload_tests",
"rollup-test",
"upgrade-ts2dart.d.ts",
"zone-ts2dart.d.ts",
"@angular/compiler-cli/integrationtest"
]
}

View File

@ -1,4 +0,0 @@
// This file is here to mock out ts2dart imports of upgrade.
export type UpgradeAdapter = any;
export var UpgradeAdapter: any;

View File

@ -1,5 +0,0 @@
declare type Zone = any;
declare var Zone: any;
declare type ZoneDelegate = any;
declare type HasTaskState = any;
declare type Task = any;