diff --git a/modules/angular2/angular2.dart b/modules/angular2/angular2.dart index 8aa91e6e76c1e..4eaeca9ee64b5 100644 --- a/modules/angular2/angular2.dart +++ b/modules/angular2/angular2.dart @@ -5,4 +5,10 @@ library angular2; * * This library does not include `bootstrap`. Import `bootstrap.dart` instead. */ -export 'package:angular2/core.dart'; +export 'package:angular2/core.dart' hide forwardRef, resolveForwardRef, ForwardRefFn; +export 'package:angular2/profile.dart'; +export 'package:angular2/lifecycle_hooks.dart'; +export 'package:angular2/src/core/application_ref.dart'; +export 'package:angular2/src/core/application_tokens.dart' hide APP_COMPONENT_REF_PROMISE; +export 'package:angular2/src/core/render/dom/dom_tokens.dart' hide APP_ID_RANDOM_BINDING; +export 'package:angular2/src/core/render/dom/dom_tokens.dart' hide APP_ID_RANDOM_BINDING; diff --git a/modules/angular2/core.dart b/modules/angular2/core.dart index 74100c943b2c8..8ed4f2ae2561d 100644 --- a/modules/angular2/core.dart +++ b/modules/angular2/core.dart @@ -1,6 +1,7 @@ library angular2.core; // Public Core API +export 'package:angular2/src/core/metadata.dart'; export 'package:angular2/src/core/util.dart'; export 'package:angular2/src/core/di.dart'; export 'package:angular2/src/core/pipes.dart'; @@ -12,11 +13,8 @@ export 'package:angular2/src/core/services.dart'; export 'package:angular2/src/core/compiler.dart'; export 'package:angular2/src/core/lifecycle.dart'; export 'package:angular2/src/core/zone.dart'; -//Do not export render for dart. Must import from angular2/render -//export 'package:angular2/src/core/render.dart'; +export 'package:angular2/src/core/render.dart'; export 'package:angular2/src/core/directives.dart'; export 'package:angular2/src/core/forms.dart'; -//Do not export debug for dart. -//export 'package:angular2/src/core/debug.dart'; -export 'package:angular2/src/core/metadata.dart'; +export 'package:angular2/src/core/debug.dart'; export 'package:angular2/src/core/change_detection.dart'; diff --git a/modules/angular2/src/core/application.ts b/modules/angular2/src/core/application.ts index 17f8948403e34..22c3078c089a3 100644 --- a/modules/angular2/src/core/application.ts +++ b/modules/angular2/src/core/application.ts @@ -1,4 +1,11 @@ // Public API for Application export {APP_COMPONENT} from './application_tokens'; export {platform, commonBootstrap as bootstrap} from './application_common'; -export {PlatformRef, ApplicationRef} from './application_ref'; +export { + PlatformRef, + ApplicationRef, + applicationCommonBindings, + createNgZone, + platformCommon, + platformBindings +} from './application_ref'; diff --git a/modules/angular2/src/core/directives.dart b/modules/angular2/src/core/directives.dart deleted file mode 100644 index bea027f416a17..0000000000000 --- a/modules/angular2/src/core/directives.dart +++ /dev/null @@ -1,11 +0,0 @@ -library angular2.src.core.directives; - -export './directives/ng_class.dart'; -export './directives/ng_for.dart'; -export './directives/ng_if.dart'; -export './directives/ng_non_bindable.dart'; -export './directives/ng_style.dart'; -export './directives/ng_switch.dart'; - -//Dart Only -export './directives/observable_list_diff.dart'; diff --git a/modules/angular2/src/core/directives.ts b/modules/angular2/src/core/directives.ts index 8264ecbbf2348..745a473b531b3 100644 --- a/modules/angular2/src/core/directives.ts +++ b/modules/angular2/src/core/directives.ts @@ -12,12 +12,14 @@ import {NgNonBindable} from './directives/ng_non_bindable'; import {NgStyle} from './directives/ng_style'; import {NgSwitch, NgSwitchWhen, NgSwitchDefault} from './directives/ng_switch'; -export * from './directives/ng_class'; -export * from './directives/ng_for'; -export * from './directives/ng_if'; -export * from './directives/ng_non_bindable'; -export * from './directives/ng_style'; -export * from './directives/ng_switch'; +export {NgClass} from './directives/ng_class'; +export {NgFor} from './directives/ng_for'; +export {NgIf} from './directives/ng_if'; +export {NgNonBindable} from './directives/ng_non_bindable'; +export {NgStyle} from './directives/ng_style'; +export {NgSwitch, NgSwitchWhen, NgSwitchDefault} from './directives/ng_switch'; +export * from './directives/observable_list_diff'; + /** * A collection of the Angular core directives that are likely to be used in each and every Angular diff --git a/modules/angular2/src/core/directives/observable_list_diff.ts b/modules/angular2/src/core/directives/observable_list_diff.ts new file mode 100644 index 0000000000000..ec7e58c1181b1 --- /dev/null +++ b/modules/angular2/src/core/directives/observable_list_diff.ts @@ -0,0 +1,4 @@ +// TS does not have Observables + +// I need to be here to make TypeScript think this is a module. +import {} from 'angular2/src/core/facade/lang'; diff --git a/modules/angular2/src/core/render/dom/dom_tokens.ts b/modules/angular2/src/core/render/dom/dom_tokens.ts index addb20037cd60..d52d787a80a03 100644 --- a/modules/angular2/src/core/render/dom/dom_tokens.ts +++ b/modules/angular2/src/core/render/dom/dom_tokens.ts @@ -9,7 +9,7 @@ export const DOCUMENT: OpaqueToken = CONST_EXPR(new OpaqueToken('DocumentToken') export const APP_ID: OpaqueToken = CONST_EXPR(new OpaqueToken('AppId')); function _appIdRandomBindingFactory() { - return `${randomChar()}${randomChar()}${randomChar()}`; + return `${_randomChar()}${_randomChar()}${_randomChar()}`; } /** @@ -25,6 +25,6 @@ export const APP_ID_RANDOM_BINDING: Binding = export const MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE: OpaqueToken = CONST_EXPR(new OpaqueToken('MaxInMemoryElementsPerTemplate')); -function randomChar(): string { +function _randomChar(): string { return StringWrapper.fromCharCode(97 + Math.floor(Math.random() * 25)); } diff --git a/modules/angular2/test/public_api_spec.dart b/modules/angular2/test/public_api_spec.dart deleted file mode 100644 index 97fa3dde0ded0..0000000000000 --- a/modules/angular2/test/public_api_spec.dart +++ /dev/null @@ -1,2 +0,0 @@ -// ignore in dart -main() {} diff --git a/modules/angular2/test/public_api_spec.ts b/modules/angular2/test/public_api_spec.ts index 76b8d0d0ad930..33d936b98f533 100644 --- a/modules/angular2/test/public_api_spec.ts +++ b/modules/angular2/test/public_api_spec.ts @@ -11,7 +11,8 @@ import { xit } from 'angular2/test_lib'; -import * as ng from 'angular2/angular2'; +import {getSymbolsFromLibrary} from './symbol_inspector/symbol_inspector'; +import {SymbolsDiff} from './symbol_inspector/symbol_differ'; // ================================================================================================= // ================================================================================================= @@ -24,38 +25,41 @@ import * as ng from 'angular2/angular2'; // ================================================================================================= // ================================================================================================= -const NG_API = [ - 'APP_COMPONENT', // TODO: To be removed +var NG_API = [ + 'APP_COMPONENT', 'APP_ID', 'AbstractBindingError', - 'AbstractBindingError.addKey', - 'AbstractBindingError.captureStackTrace', - 'AbstractBindingError.constructor', - 'AbstractBindingError.constructor.captureStackTrace', - 'AbstractBindingError.constructor.stackTraceLimit', + 'AbstractBindingError.addKey()', + 'AbstractBindingError.constructResolvingMessage', + 'AbstractBindingError.constructResolvingMessage=', 'AbstractBindingError.context', - 'AbstractBindingError.stackTraceLimit', - 'AbstractBindingError.toString', - + 'AbstractBindingError.injectors', + 'AbstractBindingError.injectors=', + 'AbstractBindingError.keys', + 'AbstractBindingError.keys=', + 'AbstractBindingError.message', + 'AbstractBindingError.message=', + 'AbstractBindingError.stackTrace', 'AbstractControl', 'AbstractControl.dirty', 'AbstractControl.errors', - 'AbstractControl.find', - 'AbstractControl.getError', - 'AbstractControl.hasError', - 'AbstractControl.markAsDirty', - 'AbstractControl.markAsTouched', + 'AbstractControl.find()', + 'AbstractControl.getError()', + 'AbstractControl.hasError()', + 'AbstractControl.markAsDirty()', + 'AbstractControl.markAsTouched()', 'AbstractControl.pristine', - 'AbstractControl.setParent', + 'AbstractControl.setParent()', 'AbstractControl.status', 'AbstractControl.touched', 'AbstractControl.untouched', - 'AbstractControl.updateValidity', - 'AbstractControl.updateValueAndValidity', + 'AbstractControl.updateValidity()', + 'AbstractControl.updateValueAndValidity()', 'AbstractControl.valid', + 'AbstractControl.validator', + 'AbstractControl.validator=', 'AbstractControl.value', 'AbstractControl.valueChanges', - 'AbstractControlDirective', 'AbstractControlDirective.control', 'AbstractControlDirective.dirty', @@ -65,86 +69,78 @@ const NG_API = [ 'AbstractControlDirective.untouched', 'AbstractControlDirective.valid', 'AbstractControlDirective.value', - 'AppRootUrl', 'AppRootUrl.value', - + 'AppRootUrl.value=', 'AppViewManager', - 'AppViewManager.attachViewInContainer', - 'AppViewManager.createEmbeddedViewInContainer', - 'AppViewManager.createHostViewInContainer', - 'AppViewManager.createRootHostView', - 'AppViewManager.destroyRootHostView', - 'AppViewManager.destroyViewInContainer', - 'AppViewManager.detachViewInContainer', - 'AppViewManager.getComponent', - 'AppViewManager.getHostElement', - 'AppViewManager.getNamedElementInComponentView', - 'AppViewManager.getViewContainer', - + 'AppViewManager.attachViewInContainer()', + 'AppViewManager.createEmbeddedViewInContainer()', + 'AppViewManager.createHostViewInContainer()', + 'AppViewManager.createRootHostView()', + 'AppViewManager.destroyRootHostView()', + 'AppViewManager.destroyViewInContainer()', + 'AppViewManager.detachViewInContainer()', + 'AppViewManager.getComponent()', + 'AppViewManager.getHostElement()', + 'AppViewManager.getNamedElementInComponentView()', + 'AppViewManager.getViewContainer()', 'ApplicationRef', - 'ApplicationRef.bootstrap', - 'ApplicationRef.dispose', + 'ApplicationRef.bootstrap()', + 'ApplicationRef.dispose()', 'ApplicationRef.injector', - 'ApplicationRef.registerBootstrapListener', + 'ApplicationRef.registerBootstrapListener()', 'ApplicationRef.zone', - 'AsyncPipe', - 'AsyncPipe.onDestroy', - 'AsyncPipe.transform', - + 'AsyncPipe.onDestroy()', + 'AsyncPipe.transform()', 'Attribute', - 'Attribute.constructor', - 'Attribute.constructor.constructor', - 'Attribute.constructor.toString', - 'Attribute.constructor.token', - 'Attribute.toString', + 'Attribute.attributeName', 'Attribute.token', - 'AttributeMetadata', - 'AttributeMetadata.constructor', - 'AttributeMetadata.toString', + 'AttributeMetadata.attributeName', 'AttributeMetadata.token', - 'Binding', + 'Binding.dependencies', 'Binding.multi', - + 'Binding.toAlias', + 'Binding.toClass', + 'Binding.toFactory', + 'Binding.toValue', + 'Binding.token', 'BindingBuilder', - 'BindingBuilder.toAlias', - 'BindingBuilder.toClass', - 'BindingBuilder.toFactory', - 'BindingBuilder.toValue', - - 'By', // TODO: not sure - 'By.all', - 'By.css', - 'By.directive', - - + 'BindingBuilder.toAlias()', + 'BindingBuilder.toClass()', + 'BindingBuilder.toFactory()', + 'BindingBuilder.toValue()', + 'BindingBuilder.token', + 'BindingBuilder.token=', + 'By#all()', + 'By#css()', + 'By#directive()', + 'By', 'CORE_DIRECTIVES', - 'ChangeDetectionError', - 'ChangeDetectionError.captureStackTrace', - 'ChangeDetectionError.constructor', - 'ChangeDetectionError.constructor.captureStackTrace', - 'ChangeDetectionError.constructor.stackTraceLimit', 'ChangeDetectionError.context', + 'ChangeDetectionError.location', + 'ChangeDetectionError.location=', 'ChangeDetectionError.message', - 'ChangeDetectionError.originalException', - 'ChangeDetectionError.originalStack', - 'ChangeDetectionError.stackTraceLimit', - 'ChangeDetectionError.toString', + 'ChangeDetectionError.stackTrace', 'ChangeDetectionError.wrapperMessage', - 'ChangeDetectionError.wrapperStack', - + 'ChangeDetectionStrategy#CheckAlways', + 'ChangeDetectionStrategy#CheckOnce', + 'ChangeDetectionStrategy#Checked', + 'ChangeDetectionStrategy#Default', + 'ChangeDetectionStrategy#Detached', + 'ChangeDetectionStrategy#OnPush', + 'ChangeDetectionStrategy#OnPushObserve', + 'ChangeDetectionStrategy#values', 'ChangeDetectionStrategy', - + 'ChangeDetectionStrategy.index', 'ChangeDetectorRef', - 'ChangeDetectorRef.detach', - 'ChangeDetectorRef.detectChanges', - 'ChangeDetectorRef.markForCheck', - 'ChangeDetectorRef.reattach', - + 'ChangeDetectorRef.detach()', + 'ChangeDetectorRef.detectChanges()', + 'ChangeDetectorRef.markForCheck()', + 'ChangeDetectorRef.reattach()', 'CheckboxControlValueAccessor', 'CheckboxControlValueAccessor.ngClassDirty', 'CheckboxControlValueAccessor.ngClassInvalid', @@ -152,211 +148,212 @@ const NG_API = [ 'CheckboxControlValueAccessor.ngClassTouched', 'CheckboxControlValueAccessor.ngClassUntouched', 'CheckboxControlValueAccessor.ngClassValid', - 'CheckboxControlValueAccessor.registerOnChange', - 'CheckboxControlValueAccessor.registerOnTouched', - 'CheckboxControlValueAccessor.writeValue', - - 'Class', - + 'CheckboxControlValueAccessor.onChange', + 'CheckboxControlValueAccessor.onChange=', + 'CheckboxControlValueAccessor.onTouched', + 'CheckboxControlValueAccessor.onTouched=', + 'CheckboxControlValueAccessor.registerOnChange()', + 'CheckboxControlValueAccessor.registerOnTouched()', + 'CheckboxControlValueAccessor.writeValue()', + 'Class:js', 'Compiler', - 'Compiler.compileInHost', - + 'Compiler.compileInHost()', 'Component', - 'Component.constructor', - 'Component.constructor.constructor', - + 'Component.bindings', + 'Component.changeDetection', + 'Component.compileChildren', + 'Component.events', + 'Component.exportAs', + 'Component.host', + 'Component.moduleId', + 'Component.properties', + 'Component.queries', + 'Component.selector', + 'Component.viewBindings', 'ComponentMetadata', - 'ComponentMetadata.constructor', - + 'ComponentMetadata.bindings', + 'ComponentMetadata.changeDetection', + 'ComponentMetadata.compileChildren', + 'ComponentMetadata.events', + 'ComponentMetadata.exportAs', + 'ComponentMetadata.host', + 'ComponentMetadata.moduleId', + 'ComponentMetadata.properties', + 'ComponentMetadata.queries', + 'ComponentMetadata.selector', + 'ComponentMetadata.viewBindings', 'ComponentRef', - 'ComponentRef.dispose', + 'ComponentRef.componentType', + 'ComponentRef.componentType=', + 'ComponentRef.dispose()', 'ComponentRef.hostComponent', 'ComponentRef.hostComponentType', 'ComponentRef.hostView', - + 'ComponentRef.injector', + 'ComponentRef.injector=', + 'ComponentRef.instance', + 'ComponentRef.instance=', + 'ComponentRef.location', + 'ComponentRef.location=', 'ComponentUrlMapper', - 'ComponentUrlMapper.getUrl', - + 'ComponentUrlMapper.getUrl()', 'ContentChild', - 'ContentChild.constructor', - 'ContentChild.constructor.constructor', - 'ContentChild.constructor.isVarBindingQuery', - 'ContentChild.constructor.isViewQuery', - 'ContentChild.constructor.selector', - 'ContentChild.constructor.toString', - 'ContentChild.constructor.token', - 'ContentChild.constructor.varBindings', + 'ContentChild.descendants', + 'ContentChild.first', 'ContentChild.isVarBindingQuery', 'ContentChild.isViewQuery', 'ContentChild.selector', - 'ContentChild.toString', 'ContentChild.token', 'ContentChild.varBindings', 'ContentChildMetadata', - 'ContentChildMetadata.constructor', + 'ContentChildMetadata.descendants', + 'ContentChildMetadata.first', 'ContentChildMetadata.isVarBindingQuery', 'ContentChildMetadata.isViewQuery', 'ContentChildMetadata.selector', - 'ContentChildMetadata.toString', 'ContentChildMetadata.token', 'ContentChildMetadata.varBindings', - 'ContentChildren', - 'ContentChildren.constructor', - 'ContentChildren.constructor.constructor', - 'ContentChildren.constructor.isVarBindingQuery', - 'ContentChildren.constructor.isViewQuery', - 'ContentChildren.constructor.selector', - 'ContentChildren.constructor.toString', - 'ContentChildren.constructor.token', - 'ContentChildren.constructor.varBindings', + 'ContentChildren.descendants', + 'ContentChildren.first', 'ContentChildren.isVarBindingQuery', 'ContentChildren.isViewQuery', 'ContentChildren.selector', - 'ContentChildren.toString', 'ContentChildren.token', 'ContentChildren.varBindings', 'ContentChildrenMetadata', - 'ContentChildrenMetadata.constructor', + 'ContentChildrenMetadata.descendants', + 'ContentChildrenMetadata.first', 'ContentChildrenMetadata.isVarBindingQuery', 'ContentChildrenMetadata.isViewQuery', 'ContentChildrenMetadata.selector', - 'ContentChildrenMetadata.toString', 'ContentChildrenMetadata.token', 'ContentChildrenMetadata.varBindings', - 'Control', - 'Control.constructor', 'Control.dirty', 'Control.errors', - 'Control.find', - 'Control.getError', - 'Control.hasError', - 'Control.markAsDirty', - 'Control.markAsTouched', + 'Control.find()', + 'Control.getError()', + 'Control.hasError()', + 'Control.markAsDirty()', + 'Control.markAsTouched()', 'Control.pristine', - 'Control.registerOnChange', - 'Control.setParent', + 'Control.registerOnChange()', + 'Control.setParent()', 'Control.status', 'Control.touched', 'Control.untouched', - 'Control.updateValidity', - 'Control.updateValue', - 'Control.updateValueAndValidity', + 'Control.updateValidity()', + 'Control.updateValue()', + 'Control.updateValueAndValidity()', 'Control.valid', + 'Control.validator', + 'Control.validator=', 'Control.value', 'Control.valueChanges', - 'ControlArray', - 'ControlArray.at', - 'ControlArray.constructor', + 'ControlArray.at()', + 'ControlArray.controls', + 'ControlArray.controls=', 'ControlArray.dirty', 'ControlArray.errors', - 'ControlArray.find', - 'ControlArray.getError', - 'ControlArray.hasError', - 'ControlArray.insert', + 'ControlArray.find()', + 'ControlArray.getError()', + 'ControlArray.hasError()', + 'ControlArray.insert()', 'ControlArray.length', - 'ControlArray.markAsDirty', - 'ControlArray.markAsTouched', + 'ControlArray.markAsDirty()', + 'ControlArray.markAsTouched()', 'ControlArray.pristine', - 'ControlArray.push', - 'ControlArray.removeAt', - 'ControlArray.setParent', + 'ControlArray.push()', + 'ControlArray.removeAt()', + 'ControlArray.setParent()', 'ControlArray.status', 'ControlArray.touched', 'ControlArray.untouched', - 'ControlArray.updateValidity', - 'ControlArray.updateValueAndValidity', + 'ControlArray.updateValidity()', + 'ControlArray.updateValueAndValidity()', 'ControlArray.valid', + 'ControlArray.validator', + 'ControlArray.validator=', 'ControlArray.value', 'ControlArray.valueChanges', - 'ControlContainer', - 'ControlContainer.constructor', 'ControlContainer.control', 'ControlContainer.dirty', 'ControlContainer.errors', 'ControlContainer.formDirective', + 'ControlContainer.name', + 'ControlContainer.name=', 'ControlContainer.path', 'ControlContainer.pristine', 'ControlContainer.touched', 'ControlContainer.untouched', 'ControlContainer.valid', 'ControlContainer.value', - 'ControlGroup', - 'ControlGroup.addControl', - 'ControlGroup.constructor', - 'ControlGroup.contains', + 'ControlGroup.addControl()', + 'ControlGroup.contains()', + 'ControlGroup.controls', + 'ControlGroup.controls=', 'ControlGroup.dirty', 'ControlGroup.errors', - 'ControlGroup.exclude', - 'ControlGroup.find', - 'ControlGroup.getError', - 'ControlGroup.hasError', - 'ControlGroup.include', - 'ControlGroup.markAsDirty', - 'ControlGroup.markAsTouched', + 'ControlGroup.exclude()', + 'ControlGroup.find()', + 'ControlGroup.getError()', + 'ControlGroup.hasError()', + 'ControlGroup.include()', + 'ControlGroup.markAsDirty()', + 'ControlGroup.markAsTouched()', 'ControlGroup.pristine', - 'ControlGroup.removeControl', - 'ControlGroup.setParent', + 'ControlGroup.removeControl()', + 'ControlGroup.setParent()', 'ControlGroup.status', 'ControlGroup.touched', 'ControlGroup.untouched', - 'ControlGroup.updateValidity', - 'ControlGroup.updateValueAndValidity', + 'ControlGroup.updateValidity()', + 'ControlGroup.updateValueAndValidity()', 'ControlGroup.valid', + 'ControlGroup.validator', + 'ControlGroup.validator=', 'ControlGroup.value', 'ControlGroup.valueChanges', - 'CurrencyPipe', - 'CurrencyPipe.constructor', - 'CurrencyPipe.transform', - + 'CurrencyPipe.transform()', 'CyclicDependencyError', - 'CyclicDependencyError.addKey', - 'CyclicDependencyError.captureStackTrace', - 'CyclicDependencyError.constructor', - 'CyclicDependencyError.constructor.captureStackTrace', - 'CyclicDependencyError.constructor.stackTraceLimit', + 'CyclicDependencyError.addKey()', + 'CyclicDependencyError.constructResolvingMessage', + 'CyclicDependencyError.constructResolvingMessage=', 'CyclicDependencyError.context', - 'CyclicDependencyError.stackTraceLimit', - 'CyclicDependencyError.toString', - + 'CyclicDependencyError.injectors', + 'CyclicDependencyError.injectors=', + 'CyclicDependencyError.keys', + 'CyclicDependencyError.keys=', + 'CyclicDependencyError.message', + 'CyclicDependencyError.message=', + 'CyclicDependencyError.stackTrace', 'DEFAULT_PIPES', - 'DEFAULT_PIPES_TOKEN', - 'DOCUMENT', - 'DatePipe', - 'DatePipe.supports', - 'DatePipe.transform', - + 'DatePipe.supports()', + 'DatePipe.transform()', 'DebugElement', 'DebugElement.children', 'DebugElement.componentInstance', 'DebugElement.componentViewChildren', 'DebugElement.elementRef', - 'DebugElement.getDirectiveInstance', - 'DebugElement.getLocal', - 'DebugElement.hasDirective', - 'DebugElement.inject', + 'DebugElement.getDirectiveInstance()', + 'DebugElement.getLocal()', + 'DebugElement.hasDirective()', + 'DebugElement.inject()', 'DebugElement.nativeElement', - 'DebugElement.query', - 'DebugElement.queryAll', - 'DebugElement.triggerEventHandler', - - 'DependencyMetadata', - 'DependencyMetadata.token', - + 'DebugElement.query()', + 'DebugElement.queryAll()', + 'DebugElement.triggerEventHandler()', 'DecimalPipe', - 'DecimalPipe.constructor', - 'DecimalPipe.transform', - + 'DecimalPipe.transform()', 'DefaultValidators', - 'DefaultValueAccessor', 'DefaultValueAccessor.ngClassDirty', 'DefaultValueAccessor.ngClassInvalid', @@ -364,176 +361,216 @@ const NG_API = [ 'DefaultValueAccessor.ngClassTouched', 'DefaultValueAccessor.ngClassUntouched', 'DefaultValueAccessor.ngClassValid', - 'DefaultValueAccessor.registerOnChange', - 'DefaultValueAccessor.registerOnTouched', - 'DefaultValueAccessor.writeValue', - + 'DefaultValueAccessor.onChange', + 'DefaultValueAccessor.onChange=', + 'DefaultValueAccessor.onTouched', + 'DefaultValueAccessor.onTouched=', + 'DefaultValueAccessor.registerOnChange()', + 'DefaultValueAccessor.registerOnTouched()', + 'DefaultValueAccessor.writeValue()', + 'Dependency#fromKey()', 'Dependency', - 'Dependency.fromKey', - + 'Dependency.key', + 'Dependency.key=', + 'Dependency.lowerBoundVisibility', + 'Dependency.lowerBoundVisibility=', + 'Dependency.optional', + 'Dependency.optional=', + 'Dependency.properties', + 'Dependency.properties=', + 'Dependency.upperBoundVisibility', + 'Dependency.upperBoundVisibility=', + 'DependencyMetadata', + 'DependencyMetadata.token', 'Directive', - 'Directive.constructor', - 'Directive.constructor.constructor', - + 'Directive.bindings', + 'Directive.compileChildren', + 'Directive.events', + 'Directive.exportAs', + 'Directive.host', + 'Directive.moduleId', + 'Directive.properties', + 'Directive.queries', + 'Directive.selector', 'DirectiveMetadata', - 'DirectiveMetadata.constructor', + 'DirectiveMetadata.bindings', + 'DirectiveMetadata.compileChildren', + 'DirectiveMetadata.events', + 'DirectiveMetadata.exportAs', + 'DirectiveMetadata.host', + 'DirectiveMetadata.moduleId', + 'DirectiveMetadata.properties', + 'DirectiveMetadata.queries', + 'DirectiveMetadata.selector', 'DirectiveResolver', - 'DirectiveResolver.resolve', - + 'DirectiveResolver.resolve()', 'DynamicComponentLoader', - 'DynamicComponentLoader.loadAsRoot', - 'DynamicComponentLoader.loadIntoLocation', - 'DynamicComponentLoader.loadNextToLocation', - + 'DynamicComponentLoader.loadAsRoot()', + 'DynamicComponentLoader.loadIntoLocation()', + 'DynamicComponentLoader.loadNextToLocation()', 'ELEMENT_PROBE_BINDINGS', - 'ElementRef', + 'ElementRef.boundElementIndex', + 'ElementRef.boundElementIndex=', 'ElementRef.nativeElement', + 'ElementRef.parentView', + 'ElementRef.parentView=', + 'ElementRef.renderBoundElementIndex', + 'ElementRef.renderBoundElementIndex=', 'ElementRef.renderView', - + 'ElementRef.renderView=', 'Event', - + 'Event.bindingPropertyName', 'EventEmitter', - 'EventEmitter.constructor', - 'EventEmitter.next', - 'EventEmitter.observer', - 'EventEmitter.return', - 'EventEmitter.throw', - 'EventEmitter.toRx', - + 'EventEmitter.add():dart', + 'EventEmitter.addError():dart', + 'EventEmitter.any():dart', + 'EventEmitter.asBroadcastStream():dart', + 'EventEmitter.asyncExpand():dart', + 'EventEmitter.asyncMap():dart', + 'EventEmitter.close():dart', + 'EventEmitter.contains():dart', + 'EventEmitter.distinct():dart', + 'EventEmitter.drain():dart', + 'EventEmitter.elementAt():dart', + 'EventEmitter.every():dart', + 'EventEmitter.expand():dart', + 'EventEmitter.first:dart', + 'EventEmitter.firstWhere():dart', + 'EventEmitter.fold():dart', + 'EventEmitter.forEach():dart', + 'EventEmitter.handleError():dart', + 'EventEmitter.isBroadcast:dart', + 'EventEmitter.isEmpty:dart', + 'EventEmitter.join():dart', + 'EventEmitter.last:dart', + 'EventEmitter.lastWhere():dart', + 'EventEmitter.length:dart', + 'EventEmitter.listen():dart', + 'EventEmitter.map():dart', + 'EventEmitter.next():js', + 'EventEmitter.observer():js', + 'EventEmitter.pipe():dart', + 'EventEmitter.reduce():dart', + 'EventEmitter.return():js', + 'EventEmitter.single:dart', + 'EventEmitter.singleWhere():dart', + 'EventEmitter.skip():dart', + 'EventEmitter.skipWhile():dart', + 'EventEmitter.take():dart', + 'EventEmitter.takeWhile():dart', + 'EventEmitter.throw():js', + 'EventEmitter.timeout():dart', + 'EventEmitter.toList():dart', + 'EventEmitter.toRx():js', + 'EventEmitter.toSet():dart', + 'EventEmitter.transform():dart', + 'EventEmitter.where():dart', 'EventMetadata', - + 'EventMetadata.bindingPropertyName', 'ExpressionChangedAfterItHasBeenCheckedException', - 'ExpressionChangedAfterItHasBeenCheckedException.captureStackTrace', - 'ExpressionChangedAfterItHasBeenCheckedException.constructor', - 'ExpressionChangedAfterItHasBeenCheckedException.constructor.captureStackTrace', - 'ExpressionChangedAfterItHasBeenCheckedException.constructor.stackTraceLimit', - 'ExpressionChangedAfterItHasBeenCheckedException.stackTraceLimit', - 'ExpressionChangedAfterItHasBeenCheckedException.toString', - + 'ExpressionChangedAfterItHasBeenCheckedException.message', + 'ExpressionChangedAfterItHasBeenCheckedException.stackTrace', 'FORM_BINDINGS', - 'FORM_DIRECTIVES', - 'FormBuilder', - 'FormBuilder.array', - 'FormBuilder.control', - 'FormBuilder.group', - + 'FormBuilder.array()', + 'FormBuilder.control()', + 'FormBuilder.group()', 'Host', - 'Host.toString', - 'HostBinding', - + 'HostBinding.hostPropertyName', 'HostBindingMetadata', - + 'HostBindingMetadata.hostPropertyName', 'HostListener', + 'HostListener.args', + 'HostListener.eventName', 'HostListenerMetadata', - + 'HostListenerMetadata.args', + 'HostListenerMetadata.eventName', 'HostMetadata', - 'HostMetadata.toString', - 'Inject', - 'Inject.toString', - + 'Inject.token', 'InjectMetadata', - 'InjectMetadata.toString', - + 'InjectMetadata.token', 'Injectable', - 'InjectableMetadata', - + 'Injector#fromResolvedBindings()', + 'Injector#resolve()', + 'Injector#resolveAndCreate()', 'Injector', - 'Injector.createChildFromResolved', - 'Injector.debugContext', + 'Injector.createChildFromResolved()', + 'Injector.debugContext()', 'Injector.displayName', - 'Injector.fromResolvedBindings', - 'Injector.get', - 'Injector.getAt', - 'Injector.getOptional', - 'Injector.instantiateResolved', + 'Injector.get()', + 'Injector.getAt()', + 'Injector.getOptional()', + 'Injector.instantiateResolved()', 'Injector.internalStrategy', 'Injector.parent', - 'Injector.resolve', - 'Injector.resolveAndCreate', - 'Injector.resolveAndCreateChild', - 'Injector.resolveAndInstantiate', - 'Injector.toString', - + 'Injector.resolveAndCreateChild()', + 'Injector.resolveAndInstantiate()', 'InstantiationError', - 'InstantiationError.addKey', - 'InstantiationError.captureStackTrace', + 'InstantiationError.addKey()', 'InstantiationError.causeKey', - 'InstantiationError.constructor', - 'InstantiationError.constructor.captureStackTrace', - 'InstantiationError.constructor.stackTraceLimit', 'InstantiationError.context', + 'InstantiationError.injectors', + 'InstantiationError.injectors=', + 'InstantiationError.keys', + 'InstantiationError.keys=', 'InstantiationError.message', - 'InstantiationError.originalException', - 'InstantiationError.originalStack', - 'InstantiationError.stackTraceLimit', - 'InstantiationError.toString', + 'InstantiationError.stackTrace', 'InstantiationError.wrapperMessage', - 'InstantiationError.wrapperStack', - 'InvalidBindingError', - 'InvalidBindingError.captureStackTrace', - 'InvalidBindingError.constructor', - 'InvalidBindingError.constructor.captureStackTrace', - 'InvalidBindingError.constructor.stackTraceLimit', - 'InvalidBindingError.stackTraceLimit', - 'InvalidBindingError.toString', - + 'InvalidBindingError.message', + 'InvalidBindingError.stackTrace', + 'IterableDiffers#create()', + 'IterableDiffers#extend()', 'IterableDiffers', - 'IterableDiffers.create', - 'IterableDiffers.extend', - 'IterableDiffers.find', - + 'IterableDiffers.factories', + 'IterableDiffers.find()', 'JsonPipe', - 'JsonPipe.transform', - + 'JsonPipe.transform()', + 'Key#get()', + 'Key#numberOfKeys', 'Key', 'Key.displayName', - 'Key.get', - 'Key.numberOfKeys', - + 'Key.id', + 'Key.id=', + 'Key.token', + 'Key.token=', + 'KeyValueDiffers#create()', + 'KeyValueDiffers#extend()', 'KeyValueDiffers', - 'KeyValueDiffers.create', - 'KeyValueDiffers.extend', - 'KeyValueDiffers.find', - - 'LifeCycle', // TODO: replace with ApplicationRef - 'LifeCycle.registerWith', - 'LifeCycle.tick', - - 'SlicePipe', - 'SlicePipe.supports', - 'SlicePipe.transform', - + 'KeyValueDiffers.factories', + 'KeyValueDiffers.find()', + 'LifeCycle', + 'LifeCycle.registerWith()', + 'LifeCycle.tick()', 'Locals', - 'Locals.clearValues', - 'Locals.contains', - 'Locals.get', - 'Locals.set', - + 'Locals.clearValues()', + 'Locals.contains()', + 'Locals.current', + 'Locals.current=', + 'Locals.get()', + 'Locals.parent', + 'Locals.parent=', + 'Locals.set()', 'LowerCasePipe', - 'LowerCasePipe.transform', - + 'LowerCasePipe.transform()', 'MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE', - 'NG_VALIDATORS', - 'NgClass', - 'NgClass.doCheck', - 'NgClass.initialClasses', - 'NgClass.onDestroy', - 'NgClass.rawClass', - + 'NgClass.doCheck()', + 'NgClass.initialClasses=', + 'NgClass.onDestroy()', + 'NgClass.rawClass=', 'NgControl', - 'NgControl.constructor', 'NgControl.control', 'NgControl.dirty', 'NgControl.errors', + 'NgControl.name', + 'NgControl.name=', 'NgControl.path', 'NgControl.pristine', 'NgControl.touched', @@ -541,289 +578,375 @@ const NG_API = [ 'NgControl.valid', 'NgControl.validator', 'NgControl.value', - 'NgControl.viewToModelUpdate', - + 'NgControl.valueAccessor', + 'NgControl.valueAccessor=', + 'NgControl.viewToModelUpdate()', 'NgControlGroup', - 'NgControlGroup.constructor', 'NgControlGroup.control', 'NgControlGroup.dirty', 'NgControlGroup.errors', 'NgControlGroup.formDirective', - 'NgControlGroup.onDestroy', - 'NgControlGroup.onInit', + 'NgControlGroup.name', + 'NgControlGroup.name=', + 'NgControlGroup.onDestroy()', + 'NgControlGroup.onInit()', 'NgControlGroup.path', 'NgControlGroup.pristine', 'NgControlGroup.touched', 'NgControlGroup.untouched', 'NgControlGroup.valid', 'NgControlGroup.value', - 'NgControlName', - 'NgControlName.constructor', 'NgControlName.control', 'NgControlName.dirty', 'NgControlName.errors', 'NgControlName.formDirective', - 'NgControlName.onChanges', - 'NgControlName.onDestroy', + 'NgControlName.model', + 'NgControlName.model=', + 'NgControlName.name', + 'NgControlName.name=', + 'NgControlName.onChanges()', + 'NgControlName.onDestroy()', 'NgControlName.path', 'NgControlName.pristine', 'NgControlName.touched', 'NgControlName.untouched', + 'NgControlName.update', + 'NgControlName.update=', 'NgControlName.valid', 'NgControlName.validator', + 'NgControlName.validators', + 'NgControlName.validators=', 'NgControlName.value', - 'NgControlName.viewToModelUpdate', - + 'NgControlName.valueAccessor', + 'NgControlName.valueAccessor=', + 'NgControlName.viewModel', + 'NgControlName.viewModel=', + 'NgControlName.viewToModelUpdate()', 'NgFor', - 'NgFor.doCheck', - 'NgFor.ngForOf', - + 'NgFor.doCheck()', + 'NgFor.ngForOf=', 'NgForm', - 'NgForm.addControl', - 'NgForm.addControlGroup', - 'NgForm.constructor', + 'NgForm.addControl()', + 'NgForm.addControlGroup()', 'NgForm.control', 'NgForm.controls', 'NgForm.dirty', 'NgForm.errors', + 'NgForm.form', + 'NgForm.form=', 'NgForm.formDirective', - 'NgForm.getControl', - 'NgForm.getControlGroup', - 'NgForm.onSubmit', + 'NgForm.getControl()', + 'NgForm.getControlGroup()', + 'NgForm.name', + 'NgForm.name=', + 'NgForm.ngSubmit', + 'NgForm.ngSubmit=', + 'NgForm.onSubmit()', 'NgForm.path', 'NgForm.pristine', - 'NgForm.removeControl', - 'NgForm.removeControlGroup', + 'NgForm.removeControl()', + 'NgForm.removeControlGroup()', 'NgForm.touched', 'NgForm.untouched', - 'NgForm.updateModel', + 'NgForm.updateModel()', 'NgForm.valid', 'NgForm.value', - 'NgFormControl', - 'NgFormControl.constructor', 'NgFormControl.control', 'NgFormControl.dirty', 'NgFormControl.errors', - 'NgFormControl.onChanges', + 'NgFormControl.form', + 'NgFormControl.form=', + 'NgFormControl.model', + 'NgFormControl.model=', + 'NgFormControl.name', + 'NgFormControl.name=', + 'NgFormControl.onChanges()', 'NgFormControl.path', 'NgFormControl.pristine', 'NgFormControl.touched', 'NgFormControl.untouched', + 'NgFormControl.update', + 'NgFormControl.update=', 'NgFormControl.valid', 'NgFormControl.validator', + 'NgFormControl.validators', + 'NgFormControl.validators=', 'NgFormControl.value', - 'NgFormControl.viewToModelUpdate', - + 'NgFormControl.valueAccessor', + 'NgFormControl.valueAccessor=', + 'NgFormControl.viewModel', + 'NgFormControl.viewModel=', + 'NgFormControl.viewToModelUpdate()', 'NgFormModel', - 'NgFormModel.addControl', - 'NgFormModel.addControlGroup', - 'NgFormModel.constructor', + 'NgFormModel.addControl()', + 'NgFormModel.addControlGroup()', 'NgFormModel.control', + 'NgFormModel.directives', + 'NgFormModel.directives=', 'NgFormModel.dirty', 'NgFormModel.errors', + 'NgFormModel.form', + 'NgFormModel.form=', 'NgFormModel.formDirective', - 'NgFormModel.getControl', - 'NgFormModel.getControlGroup', - 'NgFormModel.onChanges', - 'NgFormModel.onSubmit', + 'NgFormModel.getControl()', + 'NgFormModel.getControlGroup()', + 'NgFormModel.name', + 'NgFormModel.name=', + 'NgFormModel.ngSubmit', + 'NgFormModel.ngSubmit=', + 'NgFormModel.onChanges()', + 'NgFormModel.onSubmit()', 'NgFormModel.path', 'NgFormModel.pristine', - 'NgFormModel.removeControl', - 'NgFormModel.removeControlGroup', + 'NgFormModel.removeControl()', + 'NgFormModel.removeControlGroup()', 'NgFormModel.touched', 'NgFormModel.untouched', - 'NgFormModel.updateModel', + 'NgFormModel.updateModel()', 'NgFormModel.valid', 'NgFormModel.value', - 'NgIf', - 'NgIf.ngIf', - + 'NgIf.ngIf=', 'NgModel', - 'NgModel.constructor', 'NgModel.control', 'NgModel.dirty', 'NgModel.errors', - 'NgModel.onChanges', + 'NgModel.model', + 'NgModel.model=', + 'NgModel.name', + 'NgModel.name=', + 'NgModel.onChanges()', 'NgModel.path', 'NgModel.pristine', 'NgModel.touched', 'NgModel.untouched', + 'NgModel.update', + 'NgModel.update=', 'NgModel.valid', 'NgModel.validator', + 'NgModel.validators', + 'NgModel.validators=', 'NgModel.value', - 'NgModel.viewToModelUpdate', - + 'NgModel.valueAccessor', + 'NgModel.valueAccessor=', + 'NgModel.viewModel', + 'NgModel.viewModel=', + 'NgModel.viewToModelUpdate()', 'NgNonBindable', - 'NgSelectOption', - 'NgStyle', - 'NgStyle.doCheck', - 'NgStyle.rawStyle', - + 'NgStyle.doCheck()', + 'NgStyle.rawStyle=', 'NgSwitch', - 'NgSwitch.ngSwitch', - + 'NgSwitch.ngSwitch=', 'NgSwitchDefault', - 'NgSwitchWhen', - 'NgSwitchWhen.ngSwitchWhen', - + 'NgSwitchWhen.ngSwitchWhen=', 'NgZone', - 'NgZone.overrideOnErrorHandler', - 'NgZone.overrideOnEventDone', - 'NgZone.overrideOnTurnDone', - 'NgZone.overrideOnTurnStart', - 'NgZone.run', - 'NgZone.runOutsideAngular', - + 'NgZone.overrideOnErrorHandler()', + 'NgZone.overrideOnEventDone()', + 'NgZone.overrideOnTurnDone()', + 'NgZone.overrideOnTurnStart()', + 'NgZone.run()', + 'NgZone.runOutsideAngular()', 'NoAnnotationError', - 'NoAnnotationError.captureStackTrace', - 'NoAnnotationError.constructor', - 'NoAnnotationError.constructor.captureStackTrace', - 'NoAnnotationError.constructor.stackTraceLimit', - 'NoAnnotationError.stackTraceLimit', - 'NoAnnotationError.toString', - + 'NoAnnotationError.message', + 'NoAnnotationError.stackTrace', 'NoBindingError', - 'NoBindingError.addKey', - 'NoBindingError.captureStackTrace', - 'NoBindingError.constructor', - 'NoBindingError.constructor.captureStackTrace', - 'NoBindingError.constructor.stackTraceLimit', + 'NoBindingError.addKey()', + 'NoBindingError.constructResolvingMessage', + 'NoBindingError.constructResolvingMessage=', 'NoBindingError.context', - 'NoBindingError.stackTraceLimit', - 'NoBindingError.toString', - + 'NoBindingError.injectors', + 'NoBindingError.injectors=', + 'NoBindingError.keys', + 'NoBindingError.keys=', + 'NoBindingError.message', + 'NoBindingError.message=', + 'NoBindingError.stackTrace', 'NumberPipe', - - 'Observable', - 'Observable.observer', - + 'Observable.observer():js', + 'Observable:js', + 'ObservableListDiff.check():dart', + 'ObservableListDiff.collection:dart', + 'ObservableListDiff.diff():dart', + 'ObservableListDiff.forEachAddedItem():dart', + 'ObservableListDiff.forEachItem():dart', + 'ObservableListDiff.forEachMovedItem():dart', + 'ObservableListDiff.forEachPreviousItem():dart', + 'ObservableListDiff.forEachRemovedItem():dart', + 'ObservableListDiff.isDirty:dart', + 'ObservableListDiff.length:dart', + 'ObservableListDiff.onDestroy():dart', + 'ObservableListDiff:dart', + 'ObservableListDiffFactory.create():dart', + 'ObservableListDiffFactory.supports():dart', + 'ObservableListDiffFactory:dart', 'OpaqueToken', - 'OpaqueToken.toString', - 'Optional', - 'Optional.toString', - 'OptionalMetadata', - 'OptionalMetadata.toString', - 'OutOfBoundsError', - 'OutOfBoundsError.captureStackTrace', - 'OutOfBoundsError.constructor', - 'OutOfBoundsError.constructor.captureStackTrace', - 'OutOfBoundsError.constructor.stackTraceLimit', - 'OutOfBoundsError.stackTraceLimit', - 'OutOfBoundsError.toString', - + 'OutOfBoundsError.message', + 'OutOfBoundsError.stackTrace', 'PercentPipe', - 'PercentPipe.constructor', - 'PercentPipe.transform', - + 'PercentPipe.transform()', 'Pipe', - 'Pipe.constructor', - 'Pipe.constructor.constructor', - 'Pipe.constructor.pure', + 'Pipe.name', 'Pipe.pure', - 'PipeMetadata', - 'PipeMetadata.constructor', + 'PipeMetadata.name', 'PipeMetadata.pure', - 'PlatformRef', - 'PlatformRef.application', - 'PlatformRef.asyncApplication', - 'PlatformRef.dispose', + 'PlatformRef.application()', + 'PlatformRef.asyncApplication()', + 'PlatformRef.dispose()', 'PlatformRef.injector', - + 'Predicate:dart', 'Property', - + 'Property.bindingPropertyName', 'PropertyMetadata', - + 'PropertyMetadata.bindingPropertyName', 'ProtoViewRef', - 'Query', - 'Query.constructor', - 'Query.constructor.constructor', - 'Query.constructor.isVarBindingQuery', - 'Query.constructor.isViewQuery', - 'Query.constructor.selector', - 'Query.constructor.toString', - 'Query.constructor.token', - 'Query.constructor.varBindings', + 'Query.descendants', + 'Query.first', 'Query.isVarBindingQuery', 'Query.isViewQuery', 'Query.selector', - 'Query.toString', 'Query.token', 'Query.varBindings', - 'QueryList', - 'QueryList.add', - 'QueryList.fireCallbacks', + 'QueryList.add()', + 'QueryList.any():dart', + 'QueryList.contains():dart', + 'QueryList.elementAt():dart', + 'QueryList.every():dart', + 'QueryList.expand():dart', + 'QueryList.fireCallbacks():', 'QueryList.first', + 'QueryList.firstWhere():dart', + 'QueryList.fold():dart', + 'QueryList.forEach():dart', + 'QueryList.isEmpty', + 'QueryList.isNotEmpty', + 'QueryList.iterator', + 'QueryList.join():dart', 'QueryList.last', + 'QueryList.lastWhere():dart', 'QueryList.length', - 'QueryList.map', - 'QueryList.onChange', - 'QueryList.removeAllCallbacks', - 'QueryList.removeCallback', - 'QueryList.reset', - 'QueryList.toString', - + 'QueryList.map()', + 'QueryList.onChange()', + 'QueryList.reduce():dart', + 'QueryList.removeAllCallbacks()', + 'QueryList.removeCallback()', + 'QueryList.reset()', + 'QueryList.single', + 'QueryList.singleWhere():dart', + 'QueryList.skip():dart', + 'QueryList.skipWhile():dart', + 'QueryList.take():dart', + 'QueryList.takeWhile():dart', + 'QueryList.toList():dart', + 'QueryList.toSet():dart', + 'QueryList.where():dart', 'QueryMetadata', - 'QueryMetadata.constructor', + 'QueryMetadata.descendants', + 'QueryMetadata.first', 'QueryMetadata.isVarBindingQuery', 'QueryMetadata.isViewQuery', 'QueryMetadata.selector', - 'QueryMetadata.toString', 'QueryMetadata.token', 'QueryMetadata.varBindings', - + 'RenderDirectiveMetadata#COMPONENT_TYPE', + 'RenderDirectiveMetadata#DIRECTIVE_TYPE', + 'RenderDirectiveMetadata#create()', 'RenderDirectiveMetadata', - 'RenderDirectiveMetadata.COMPONENT_TYPE', - 'RenderDirectiveMetadata.DIRECTIVE_TYPE', - 'RenderDirectiveMetadata.create', - + 'RenderDirectiveMetadata.callAfterContentChecked', + 'RenderDirectiveMetadata.callAfterContentChecked=', + 'RenderDirectiveMetadata.callAfterContentInit', + 'RenderDirectiveMetadata.callAfterContentInit=', + 'RenderDirectiveMetadata.callAfterViewChecked', + 'RenderDirectiveMetadata.callAfterViewChecked=', + 'RenderDirectiveMetadata.callAfterViewInit', + 'RenderDirectiveMetadata.callAfterViewInit=', + 'RenderDirectiveMetadata.callDoCheck', + 'RenderDirectiveMetadata.callDoCheck=', + 'RenderDirectiveMetadata.callOnChanges', + 'RenderDirectiveMetadata.callOnChanges=', + 'RenderDirectiveMetadata.callOnDestroy', + 'RenderDirectiveMetadata.callOnDestroy=', + 'RenderDirectiveMetadata.callOnInit', + 'RenderDirectiveMetadata.callOnInit=', + 'RenderDirectiveMetadata.changeDetection', + 'RenderDirectiveMetadata.changeDetection=', + 'RenderDirectiveMetadata.compileChildren', + 'RenderDirectiveMetadata.compileChildren=', + 'RenderDirectiveMetadata.events', + 'RenderDirectiveMetadata.events=', + 'RenderDirectiveMetadata.exportAs', + 'RenderDirectiveMetadata.exportAs=', + 'RenderDirectiveMetadata.hostAttributes', + 'RenderDirectiveMetadata.hostAttributes=', + 'RenderDirectiveMetadata.hostListeners', + 'RenderDirectiveMetadata.hostListeners=', + 'RenderDirectiveMetadata.hostProperties', + 'RenderDirectiveMetadata.hostProperties=', + 'RenderDirectiveMetadata.id', + 'RenderDirectiveMetadata.id=', + 'RenderDirectiveMetadata.properties', + 'RenderDirectiveMetadata.properties=', + 'RenderDirectiveMetadata.queries', + 'RenderDirectiveMetadata.queries=', + 'RenderDirectiveMetadata.readAttributes', + 'RenderDirectiveMetadata.readAttributes=', + 'RenderDirectiveMetadata.selector', + 'RenderDirectiveMetadata.selector=', + 'RenderDirectiveMetadata.type', + 'RenderDirectiveMetadata.type=', 'RenderFragmentRef', - 'RenderProtoViewRef', - 'RenderViewRef', - 'RenderViewWithFragments', - + 'RenderViewWithFragments.fragmentRefs', + 'RenderViewWithFragments.fragmentRefs=', + 'RenderViewWithFragments.viewRef', + 'RenderViewWithFragments.viewRef=', 'Renderer', - 'Renderer.attachFragmentAfterElement', - 'Renderer.attachFragmentAfterFragment', - 'Renderer.createRootHostView', - 'Renderer.createView', - 'Renderer.dehydrateView', - 'Renderer.destroyView', - 'Renderer.detachFragment', - 'Renderer.getNativeElementSync', - 'Renderer.hydrateView', - 'Renderer.invokeElementMethod', - 'Renderer.setElementAttribute', - 'Renderer.setElementClass', - 'Renderer.setElementProperty', - 'Renderer.setElementStyle', - 'Renderer.setEventDispatcher', - 'Renderer.setText', - + 'Renderer.attachFragmentAfterElement()', + 'Renderer.attachFragmentAfterFragment()', + 'Renderer.createRootHostView()', + 'Renderer.createView()', + 'Renderer.dehydrateView()', + 'Renderer.destroyView()', + 'Renderer.detachFragment()', + 'Renderer.getNativeElementSync()', + 'Renderer.hydrateView()', + 'Renderer.invokeElementMethod()', + 'Renderer.setElementAttribute()', + 'Renderer.setElementClass()', + 'Renderer.setElementProperty()', + 'Renderer.setElementStyle()', + 'Renderer.setEventDispatcher()', + 'Renderer.setText()', 'ResolvedBinding', + 'ResolvedBinding.key', + 'ResolvedBinding.key=', + 'ResolvedBinding.multiBinding', + 'ResolvedBinding.multiBinding=', + 'ResolvedBinding.resolvedFactories', + 'ResolvedBinding.resolvedFactories=', 'ResolvedBinding.resolvedFactory', 'ResolvedFactory', - - 'Scope', - 'Scope.all', - 'Scope.light', - 'Scope.view', - + 'ResolvedFactory.dependencies', + 'ResolvedFactory.dependencies=', + 'ResolvedFactory.factory', + 'ResolvedFactory.factory=', + 'Scope#all()', + 'Scope#light()', + 'Scope#view()', + 'Scope', // TODO(misko): rename? 'SelectControlValueAccessor', 'SelectControlValueAccessor.ngClassDirty', 'SelectControlValueAccessor.ngClassInvalid', @@ -831,235 +954,255 @@ const NG_API = [ 'SelectControlValueAccessor.ngClassTouched', 'SelectControlValueAccessor.ngClassUntouched', 'SelectControlValueAccessor.ngClassValid', - 'SelectControlValueAccessor.registerOnChange', - 'SelectControlValueAccessor.registerOnTouched', - 'SelectControlValueAccessor.writeValue', - + 'SelectControlValueAccessor.onChange', + 'SelectControlValueAccessor.onChange=', + 'SelectControlValueAccessor.onTouched', + 'SelectControlValueAccessor.onTouched=', + 'SelectControlValueAccessor.registerOnChange()', + 'SelectControlValueAccessor.registerOnTouched()', + 'SelectControlValueAccessor.value', + 'SelectControlValueAccessor.value=', + 'SelectControlValueAccessor.writeValue()', 'Self', - 'Self.toString', - 'SelfMetadata', - 'SelfMetadata.toString', - 'SkipSelf', - 'SkipSelf.toString', - 'SkipSelfMetadata', - 'SkipSelfMetadata.toString', - - 'SwitchView', - 'SwitchView.create', - 'SwitchView.destroy', - + 'SlicePipe', + 'SlicePipe.supports()', + 'SlicePipe.transform()', 'TemplateRef', - 'TemplateRef.hasLocal', + 'TemplateRef.elementRef', + 'TemplateRef.elementRef=', + 'TemplateRef.hasLocal()', 'TemplateRef.protoViewRef', - - 'Type', - + 'Type:js', 'TypeLiteral', 'TypeLiteral.type', - 'UpperCasePipe', - 'UpperCasePipe.transform', - + 'UpperCasePipe.transform()', 'UrlResolver', - 'UrlResolver.resolve', - + 'UrlResolver.packagePrefix', + 'UrlResolver.resolve()', + 'Validators#array()', + 'Validators#compose()', + 'Validators#group()', + 'Validators#nullValidator()', + 'Validators#required()', 'Validators', - 'Validators.array', - 'Validators.compose', - 'Validators.group', - 'Validators.nullValidator', - 'Validators.required', - 'View', - + 'View.directives', + 'View.encapsulation', + 'View.pipes', + 'View.styleUrls', + 'View.styles', + 'View.template', + 'View.templateUrl', 'ViewChild', - 'ViewChild.constructor', - 'ViewChild.constructor.constructor', - 'ViewChild.constructor.isVarBindingQuery', - 'ViewChild.constructor.isViewQuery', - 'ViewChild.constructor.selector', - 'ViewChild.constructor.toString', - 'ViewChild.constructor.token', - 'ViewChild.constructor.varBindings', + 'ViewChild.descendants', + 'ViewChild.first', 'ViewChild.isVarBindingQuery', 'ViewChild.isViewQuery', 'ViewChild.selector', - 'ViewChild.toString', 'ViewChild.token', 'ViewChild.varBindings', 'ViewChildMetadata', - 'ViewChildMetadata.constructor', + 'ViewChildMetadata.descendants', + 'ViewChildMetadata.first', 'ViewChildMetadata.isVarBindingQuery', 'ViewChildMetadata.isViewQuery', 'ViewChildMetadata.selector', - 'ViewChildMetadata.toString', 'ViewChildMetadata.token', 'ViewChildMetadata.varBindings', - 'ViewChildren', - 'ViewChildren.constructor', - 'ViewChildren.constructor.constructor', - 'ViewChildren.constructor.isVarBindingQuery', - 'ViewChildren.constructor.isViewQuery', - 'ViewChildren.constructor.selector', - 'ViewChildren.constructor.toString', - 'ViewChildren.constructor.token', - 'ViewChildren.constructor.varBindings', + 'ViewChildren.descendants', + 'ViewChildren.first', 'ViewChildren.isVarBindingQuery', 'ViewChildren.isViewQuery', 'ViewChildren.selector', - 'ViewChildren.toString', 'ViewChildren.token', 'ViewChildren.varBindings', 'ViewChildrenMetadata', - 'ViewChildrenMetadata.constructor', + 'ViewChildrenMetadata.descendants', + 'ViewChildrenMetadata.first', 'ViewChildrenMetadata.isVarBindingQuery', 'ViewChildrenMetadata.isViewQuery', 'ViewChildrenMetadata.selector', - 'ViewChildrenMetadata.toString', 'ViewChildrenMetadata.token', 'ViewChildrenMetadata.varBindings', - 'ViewContainerRef', - 'ViewContainerRef.clear', - 'ViewContainerRef.createEmbeddedView', - 'ViewContainerRef.createHostView', - 'ViewContainerRef.detach', - 'ViewContainerRef.get', - 'ViewContainerRef.indexOf', - 'ViewContainerRef.insert', + 'ViewContainerRef.clear()', + 'ViewContainerRef.createEmbeddedView()', + 'ViewContainerRef.createHostView()', + 'ViewContainerRef.detach()', + 'ViewContainerRef.element', + 'ViewContainerRef.element=', + 'ViewContainerRef.get()', + 'ViewContainerRef.indexOf()', + 'ViewContainerRef.insert()', 'ViewContainerRef.length', - 'ViewContainerRef.remove', - + 'ViewContainerRef.remove()', + 'ViewContainerRef.viewManager', + 'ViewContainerRef.viewManager=', 'ViewDefinition', - + 'ViewDefinition.componentId', + 'ViewDefinition.componentId=', + 'ViewDefinition.directives', + 'ViewDefinition.directives=', + 'ViewDefinition.encapsulation', + 'ViewDefinition.encapsulation=', + 'ViewDefinition.styleAbsUrls', + 'ViewDefinition.styleAbsUrls=', + 'ViewDefinition.styles', + 'ViewDefinition.styles=', + 'ViewDefinition.template', + 'ViewDefinition.template=', + 'ViewDefinition.templateAbsUrl', + 'ViewDefinition.templateAbsUrl=', + 'ViewEncapsulation#Emulated', + 'ViewEncapsulation#Native', + 'ViewEncapsulation#None', + 'ViewEncapsulation#values', 'ViewEncapsulation', - + 'ViewEncapsulation.index', 'ViewMetadata', - + 'ViewMetadata.directives', + 'ViewMetadata.encapsulation', + 'ViewMetadata.pipes', + 'ViewMetadata.styleUrls', + 'ViewMetadata.styles', + 'ViewMetadata.template', + 'ViewMetadata.templateUrl', 'ViewQuery', - 'ViewQuery.constructor', - 'ViewQuery.constructor.constructor', - 'ViewQuery.constructor.isVarBindingQuery', - 'ViewQuery.constructor.isViewQuery', - 'ViewQuery.constructor.selector', - 'ViewQuery.constructor.toString', - 'ViewQuery.constructor.token', - 'ViewQuery.constructor.varBindings', + 'ViewQuery.descendants', + 'ViewQuery.first', 'ViewQuery.isVarBindingQuery', 'ViewQuery.isViewQuery', 'ViewQuery.selector', - 'ViewQuery.toString', 'ViewQuery.token', 'ViewQuery.varBindings', - 'ViewQueryMetadata', - 'ViewQueryMetadata.constructor', + 'ViewQueryMetadata.descendants', + 'ViewQueryMetadata.first', 'ViewQueryMetadata.isVarBindingQuery', 'ViewQueryMetadata.isViewQuery', 'ViewQueryMetadata.selector', - 'ViewQueryMetadata.toString', 'ViewQueryMetadata.token', 'ViewQueryMetadata.varBindings', - 'ViewRef', 'ViewRef.render', 'ViewRef.renderFragment', - 'ViewRef.setLocal', - + 'ViewRef.setLocal()', 'WrappedException', - 'WrappedException.captureStackTrace', - 'WrappedException.constructor', - 'WrappedException.constructor.captureStackTrace', - 'WrappedException.constructor.stackTraceLimit', 'WrappedException.context', 'WrappedException.message', - 'WrappedException.originalException', - 'WrappedException.originalStack', - 'WrappedException.stackTraceLimit', - 'WrappedException.toString', + 'WrappedException.stackTrace', 'WrappedException.wrapperMessage', - 'WrappedException.wrapperStack', - + 'WrappedValue#wrap()', 'WrappedValue', - 'WrappedValue.wrap', - - 'asNativeElements', - 'bind', - 'bootstrap', - 'forwardRef', - 'inspectElement', - 'inspectNativeElement', - 'platform', - 'resolveForwardRef', - 'wtfCreateScope', - 'wtfEndTimeRange', - 'wtfLeave', - 'wtfStartTimeRange' -].sort(); + 'WrappedValue.wrapped', + 'WrappedValue.wrapped=', + 'WtfScopeFn:dart', + 'applicationCommonBindings()', + 'asNativeElements()', + 'bind()', + 'bootstrap():js', + 'createNgZone()', + 'forwardRef():js', + 'inspectElement()', + 'inspectNativeElement()', + 'platform():js', + 'platformBindings()', + 'platformCommon()', + 'resolveForwardRef():js', + 'wtfCreateScope():js', + 'wtfCreateScope:dart', + 'wtfEndTimeRange():js', + 'wtfEndTimeRange:dart', + 'wtfLeave():js', + 'wtfLeave:dart', + 'wtfStartTimeRange():js', + 'wtfStartTimeRange:dart', + '{AfterContentChecked}', + '{AfterContentInit}', + '{AfterViewChecked}', + '{AfterViewInit}', + '{ChangeDetector}', + '{ChangeDetector}.mode', + '{ChangeDetector}.mode=', + '{ChangeDetector}.parent', + '{ChangeDetector}.parent=', + '{ChangeDetector}.ref', + '{ChangeDetector}.ref=', + '{ControlValueAccessor}', + '{DoCheck}', + '{Form}', + '{HostViewRef}', + '{IterableDifferFactory}', + '{IterableDiffer}', + '{KeyValueDifferFactory}', + '{KeyValueDiffer}', + '{OnChanges}', + '{OnDestroy}', + '{OnInit}', + '{PipeOnDestroy}', + '{PipeTransform}', + '{RenderElementRef}', + '{RenderElementRef}.renderBoundElementIndex', + '{RenderElementRef}.renderBoundElementIndex=', + '{RenderElementRef}.renderView', + '{RenderElementRef}.renderView=', + '{RenderEventDispatcher}', + '{Stream}', + '{Stream}.any()', + '{Stream}.asBroadcastStream()', + '{Stream}.asyncExpand()', + '{Stream}.asyncMap()', + '{Stream}.contains()', + '{Stream}.distinct()', + '{Stream}.drain()', + '{Stream}.elementAt()', + '{Stream}.every()', + '{Stream}.expand()', + '{Stream}.first', + '{Stream}.firstWhere()', + '{Stream}.fold()', + '{Stream}.forEach()', + '{Stream}.handleError()', + '{Stream}.isBroadcast', + '{Stream}.isEmpty', + '{Stream}.join()', + '{Stream}.last', + '{Stream}.lastWhere()', + '{Stream}.length', + '{Stream}.map()', + '{Stream}.pipe()', + '{Stream}.reduce()', + '{Stream}.single', + '{Stream}.singleWhere()', + '{Stream}.skip()', + '{Stream}.skipWhile()', + '{Stream}.take()', + '{Stream}.takeWhile()', + '{Stream}.timeout()', + '{Stream}.toList()', + '{Stream}.toSet()', + '{Stream}.transform()', + '{Stream}.where()', + '{Type}' +]; export function main() { + /** + var x = getSymbolsFromLibrary('ng'); + x.sort(); + var parts = []; + x.forEach((i) => parts.push(`'${i}'`)); + print(`[ ${parts.join(', + ')} ]`); + */ + describe('public API', () => { - it('should fail if public API has changed', () => { - var ngApi = extractApi(ng); - // console.log(ngApi); - expect(diffApi(NG_API, ngApi)).toBe(0); - }); + it('should fail if public API has changed', + () => { expect(new SymbolsDiff(getSymbolsFromLibrary('ng'), NG_API).errors).toEqual([]); }); }); } - -function extractApi(src: any, dst: string[] = [], path: string[] = [], alreadySeen: any[] = []): - string[] { - if (alreadySeen.indexOf(src) != -1) { - return; - } - alreadySeen.push(src); - for (var name in src) { - if (name.charAt(0) == '_') continue; - path.push(name); - var value = null; - try { - value = src[name]; - } catch (e) { - value = 'property'; - } - switch (typeof value) { - case 'function': - var type: any = {}; - dst.push(path.join('.')); - extractApi(value, dst, path, alreadySeen); // static methods - extractApi(value.prototype, dst, path, alreadySeen); // instance methods; - break; - default: - dst.push(path.join('.')); - } - path.pop(); - } - alreadySeen.pop(); - dst.sort(); - return dst; -} - -function diffApi(expected: string[], actual: string[]): number { - var diffCount = 0; - for (var i = 0, j = 0, length = expected.length + actual.length; i + j < length;) { - var expectedName = expected[i] || '~'; - var actualName = actual[j] || '~'; - if (expectedName == actualName) { - i++; - j++; - } else if (expectedName > actualName) { - console.log('Extra symbol: ' + actualName); - j++; - diffCount++; - } else { - console.log('Missing symbol ' + expectedName); - i++; - diffCount++; - } - } - return diffCount; -} diff --git a/modules/angular2/test/symbol_inspector/simple_library.ts b/modules/angular2/test/symbol_inspector/simple_library.ts new file mode 100644 index 0000000000000..45f2bb7062786 --- /dev/null +++ b/modules/angular2/test/symbol_inspector/simple_library.ts @@ -0,0 +1,35 @@ +// A library for the symbol inspector test + +export class A { + constructor(b: ConsParamType) {} + + field: FieldType; + get getter(): GetterType { return null; } + + method(p: ParamType): MethodReturnType { return null; } + + methodWithFunc(closure: ClosureReturn) {} + + static staticField: StaticFieldType = null; + static staticMethod() {} +} + +export class ConsParamType {} +export class FieldType {} +export class GetterType {} +export class MethodReturnType {} +export class ParamType {} +export class StaticFieldType {} + +export class ClosureReturn {} +export class ClosureParam {} + +export class TypedefReturnType {} +export class TypedefParam {} + + +export class Generic { // Generic should be exported, but not K. + get getter(): K { return null; } +} + +export interface SomeInterface { someMethod(); } diff --git a/modules/angular2/test/symbol_inspector/symbol_differ.ts b/modules/angular2/test/symbol_inspector/symbol_differ.ts new file mode 100644 index 0000000000000..7fdabd11209d1 --- /dev/null +++ b/modules/angular2/test/symbol_inspector/symbol_differ.ts @@ -0,0 +1,68 @@ +import {StringWrapper, RegExpWrapper, isJsObject} from 'angular2/src/core/facade/lang'; + +var IS_FIELD = RegExpWrapper.create('^\\w+[\\.|\\#]\\w+=?$'); +var IS_INTERFACE = RegExpWrapper.create('^\\{\\w+\\}'); +var IS_DART = RegExpWrapper.create('\\:dart$'); +var IS_JS = RegExpWrapper.create('\\:js$'); +var IS_OPTIONAL = RegExpWrapper.create('\\:optional$'); +var JS = 'JS'; +var DART = 'Dart'; +var MODE = isJsObject({}) ? JS : DART; + +export class SymbolsDiff { + missing: string[] = []; + extra: string[] = []; + errors: string[] = []; + + constructor(public actual: string[], public expected: string[]) { + this.actual.sort(compareIgnoreLang); + this.expected.sort(compareIgnoreLang); + this.computeDiff(); + } + + computeDiff(): void { + for (var i = 0, j = 0, length = this.expected.length + this.actual.length; i + j < length;) { + var expectedName: string = i < this.expected.length ? this.expected[i] : '~'; + var actualName: string = j < this.actual.length ? this.actual[j] : '~'; + if (stripLang(expectedName) == stripLang(actualName)) { + i++; + j++; + } else if (StringWrapper.compare(stripLang(expectedName), stripLang(actualName)) > 0) { + // JS does not see fields so ignore none method symbols + if (!this.shouldIgnore(expectedName)) { + this.extra.push(actualName); + this.errors.push('+ ' + actualName); + } + j++; + } else { + if (!this.shouldIgnore(expectedName)) { + this.missing.push(expectedName); + this.errors.push('- ' + expectedName); + } + i++; + } + } + } + + shouldIgnore(expected: string): boolean { + var ignore = false; + if (MODE == JS) { + ignore = RegExpWrapper.test(IS_FIELD, expected) || + RegExpWrapper.test(IS_INTERFACE, expected) || + RegExpWrapper.test(IS_DART, expected) || RegExpWrapper.test(IS_OPTIONAL, expected) + } else { + ignore = RegExpWrapper.test(IS_JS, expected) || RegExpWrapper.test(IS_OPTIONAL, expected) + } + return ignore; + } +} + +function stripLang(text: string): string { + var index = text.indexOf(':'); + if (index >= 0) text = text.substring(0, index); + return text; +} + +function compareIgnoreLang(a: string, b: string): number { + return StringWrapper.compare(stripLang(a), stripLang(b)); +} diff --git a/modules/angular2/test/symbol_inspector/symbol_inspector.dart b/modules/angular2/test/symbol_inspector/symbol_inspector.dart new file mode 100644 index 0000000000000..db235459e516e --- /dev/null +++ b/modules/angular2/test/symbol_inspector/symbol_inspector.dart @@ -0,0 +1,214 @@ +library angular.symbol_inspector.symbol_inspector; + +import 'dart:mirrors'; +import './simple_library.dart' as simple_library; +import 'package:angular2/angular2.dart' as angular2; + +const IGNORE = const { + 'runtimeType': true, + 'toString': true, + 'noSuchMethod': true, + 'hashCode': true, + 'originalException': true, + 'originalStack': true +}; + +const LIB_MAP = const { + 'simple_library': 'angular2.test.symbol_inspector.simple_library', + 'ng': 'angular2' +}; + +// Have this list here to trick dart to force import. +var libs = [simple_library.A, angular2.Component]; + +List getSymbolsFromLibrary(String name) { + var libraryName = LIB_MAP[name]; + if (libs.isEmpty) throw "No libriries loaded."; + if (libraryName == null) throw "Don't know how to load '$name' library."; + var lib = currentMirrorSystem().findLibrary(new Symbol(libraryName)); + var names = []; + extractSymbols(lib).addTo(names); + names.sort(); + // remove duplicates; + var lastValue; + names = names.where((v) { + var duplicate = v == lastValue; + lastValue = v; + return !duplicate; + }).toList(); + return names; +} + +class ExportedSymbol { + Symbol symbol; + DeclarationMirror declaration; + LibraryMirror library; + + ExportedSymbol(this.symbol, this.declaration, this.library); + + addTo(List names) { + var name = unwrapSymbol(symbol); + if (declaration is MethodMirror) { + names.add('$name()'); + } else if (declaration is ClassMirror) { + var classMirror = declaration as ClassMirror; + if (classMirror.isAbstract) name = '{$name}'; + names.add(name); + classMirror.staticMembers.forEach(members('$name#', names)); + classMirror.instanceMembers.forEach(members('$name.', names)); + } else if (declaration is TypedefMirror) { + names.add(name); + } else if (declaration is VariableMirror) { + names.add(name); + } else { + throw 'UNEXPECTED: $declaration'; + } + } + + toString() => unwrapSymbol(symbol); +} + +members(String prefix, List names) { + return (Symbol symbol, MethodMirror method) { + var name = unwrapSymbol(symbol); + if (method.isOperator || method.isPrivate || IGNORE[name] == true) return; + var suffix = (method.isSetter || method.isGetter) ? '' : '()'; + names.add('$prefix$name$suffix'); + }; +} + +class LibraryInfo { + List names; + Map> symbolsUsedForName; + + LibraryInfo(this.names, this.symbolsUsedForName); + + addTo(List names) { + this.names.forEach((ExportedSymbol es) => es.addTo(names)); + //this.names.addAll(symbolsUsedForName.keys.map(unwrapSymbol)); + } +} + +Iterable _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyType) { + + if (seenDecls.containsKey(decl.qualifiedName)) return []; + seenDecls[decl.qualifiedName] = true; + + if (decl.isPrivate) return []; + + path = "$path -> $decl"; + + var used = []; + + if (decl is TypedefMirror) { + TypedefMirror tddecl = decl; + used.addAll(_getUsedSymbols(tddecl.referent, seenDecls, path, onlyType)); + } + if (decl is FunctionTypeMirror) { + FunctionTypeMirror ftdecl = decl; + + ftdecl.parameters.forEach((ParameterMirror p) { + used.addAll(_getUsedSymbols(p.type, seenDecls, path, onlyType)); + }); + used.addAll(_getUsedSymbols(ftdecl.returnType, seenDecls, path, onlyType)); + } + else if (decl is TypeMirror) { + var tdecl = decl; + used.add(tdecl.qualifiedName); + } + + + if (!onlyType) { + if (decl is ClassMirror) { + ClassMirror cdecl = decl; + cdecl.declarations.forEach((s, d) { + try { + used.addAll(_getUsedSymbols(d, seenDecls, path, false)); + } catch (e, s) { + print("Got error [$e] when visiting $d\n$s"); + } + }); + + } + + if (decl is MethodMirror) { + MethodMirror mdecl = decl; + if (mdecl.parameters != null) + mdecl.parameters.forEach((p) { + used.addAll(_getUsedSymbols(p.type, seenDecls, path, true)); + }); + used.addAll(_getUsedSymbols(mdecl.returnType, seenDecls, path, true)); + } + + if (decl is VariableMirror) { + VariableMirror vdecl = decl; + used.addAll(_getUsedSymbols(vdecl.type, seenDecls, path, true)); + } + } + + // Strip out type variables. + if (decl is TypeMirror) { + TypeMirror tdecl = decl; + var typeVariables = tdecl.typeVariables.map((tv) => tv.qualifiedName); + used = used.where((x) => !typeVariables.contains(x)); + } + + return used; +} + +LibraryInfo extractSymbols(LibraryMirror lib, [String printPrefix = ""]) { + List exportedSymbols = []; + Map> used = {}; + + printPrefix += " "; + lib.declarations.forEach((Symbol symbol, DeclarationMirror decl) { + if (decl.isPrivate) return; + + // Work-around for dartbug.com/18271 + if (decl is TypedefMirror && unwrapSymbol(symbol).startsWith('_')) return; + + exportedSymbols.add(new ExportedSymbol(symbol, decl, lib)); + used[decl.qualifiedName] = _getUsedSymbols(decl, {}, "", false); + }); + + lib.libraryDependencies.forEach((LibraryDependencyMirror libDep) { + LibraryMirror target = libDep.targetLibrary; + if (!libDep.isExport) return; + + var childInfo = extractSymbols(target, printPrefix); + var childNames = childInfo.names; + + // If there was a "show" or "hide" on the exported library, filter the results. + // This API needs love :-( + var showSymbols = [], hideSymbols = []; + libDep.combinators.forEach((CombinatorMirror c) { + if (c.isShow) { + showSymbols.addAll(c.identifiers); + } + if (c.isHide) { + hideSymbols.addAll(c.identifiers); + } + }); + + // I don't think you can show and hide from the same library + assert(showSymbols.isEmpty || hideSymbols.isEmpty); + if (!showSymbols.isEmpty) { + childNames = childNames.where((symAndLib) { + return showSymbols.contains(symAndLib.symbol); + }); + } + if (!hideSymbols.isEmpty) { + childNames = childNames.where((symAndLib) { + return !hideSymbols.contains(symAndLib.symbol); + }); + } + + exportedSymbols.addAll(childNames); + used.addAll(childInfo.symbolsUsedForName); + }); + return new LibraryInfo(exportedSymbols, used); +} + + +var _SYMBOL_NAME = new RegExp('"(.*)"'); +unwrapSymbol(sym) => _SYMBOL_NAME.firstMatch(sym.toString()).group(1); diff --git a/modules/angular2/test/symbol_inspector/symbol_inspector.ts b/modules/angular2/test/symbol_inspector/symbol_inspector.ts new file mode 100644 index 0000000000000..0af922eb167e9 --- /dev/null +++ b/modules/angular2/test/symbol_inspector/symbol_inspector.ts @@ -0,0 +1,69 @@ +import * as simple_library from './simple_library'; +import * as ng from 'angular2/angular2'; + +const LIB_MAP = { + 'simple_library': simple_library, + 'ng': ng +}; + +const IGNORE = + { + captureStackTrace: true, + stackTraceLimit: true, + toString: true, + originalException: true, + originalStack: true, + wrapperMessage: true, + wrapperStack: true + } + +function collectClassSymbols(symbols: string[], prefix: String, type: Function): + void { + // static + for (var name in type) { + if (IGNORE[name] || name.charAt(0) == '_') continue; + var suf = type[name] instanceof Function ? '()' : ''; + var symbol = `${prefix}#${name}${suf}`; + symbols.push(symbol); + } + + // instance + for (var name in type.prototype) { + if (IGNORE[name] || name.charAt(0) == '_') continue; + if (name == 'constructor') continue; + var suf = ''; + try { + if (type.prototype[name] instanceof Function) suf = '()'; + } catch (e) { + } + var symbol = `${prefix}.${name}${suf}`; + symbols.push(symbol); + } + } + +function collectTopLevelSymbols(prefix: string, lib: any): + string[] { + var symbols: string[] = []; + for (var name in lib) { + var symbol = `${name}`; + var ref = lib[name]; + if (ref instanceof Function) { + if (symbol.charAt(0) == symbol.charAt(0).toLowerCase()) { + // assume it is top level function + symbols.push(symbol + '()'); + } else { + symbols.push(symbol); + collectClassSymbols(symbols, symbol, ref); + } + } else { + symbols.push(symbol); + } + } + return symbols; + } + +export function getSymbolsFromLibrary(name: string): string[] { + var symbols = collectTopLevelSymbols(name, LIB_MAP[name]); + symbols.sort(); + return symbols; +} diff --git a/modules/angular2/test/symbol_inspector/symbol_inspector_spec.ts b/modules/angular2/test/symbol_inspector/symbol_inspector_spec.ts new file mode 100644 index 0000000000000..2c668bd0ed670 --- /dev/null +++ b/modules/angular2/test/symbol_inspector/symbol_inspector_spec.ts @@ -0,0 +1,59 @@ +import { + AsyncTestCompleter, + beforeEach, + ddescribe, + describe, + expect, + iit, + inject, + it, + xdescribe, + xit +} from 'angular2/test_lib'; + +import {getSymbolsFromLibrary} from './symbol_inspector'; +import {SymbolsDiff} from './symbol_differ'; + +export function main() { + describe('symbol inspector', () => { + it('should extract symbols', () => { + var symbols = getSymbolsFromLibrary("simple_library"); + + expect(new SymbolsDiff(symbols, + [ + 'A', + 'A#staticField', + 'A#staticField=', + 'A#staticMethod()', + 'A.field', + 'A.field=', + 'A.getter', + 'A.method()', + 'A.methodWithFunc()', + 'ClosureParam', + 'ClosureReturn', + 'ConsParamType', + 'FieldType', + 'Generic', + 'Generic.getter', + 'GetterType', + 'MethodReturnType', + 'ParamType', + 'StaticFieldType', + 'TypedefParam', + 'TypedefReturnType', + '{SomeInterface}', + ]) + .errors) + .toEqual([]); + }); + + + describe('assert', () => { + it('should assert symbol names are correct', () => { + var diffs = new SymbolsDiff(['a()', 'c()', 'd()'], ['a()', 'b()', 'd()']); + expect(diffs.errors).toEqual(['- b()', '+ c()']); + }); + }); + }); +}