chore(typings): mark underscore methods @internal.

This allows TypeScript to produce an API surface which matches the Dart semantics.
I found these with:
gulp build.js.dev && find dist/js/dev/es5/angular2/src -name "*.d.ts" -exec grep -H -n '^ *_' {} \;

Closes #4638
This commit is contained in:
Alex Eagle
2015-10-09 17:21:25 -07:00
committed by Alex Eagle
parent 95f984615b
commit 867c08ac84
69 changed files with 369 additions and 31 deletions

View File

@ -24,6 +24,7 @@ export class ComponentUrlMapper {
}
export class RuntimeComponentUrlMapper extends ComponentUrlMapper {
/** @internal */
_componentUrls = new Map<Type, string>();
constructor() { super(); }

View File

@ -78,6 +78,7 @@ export class StaticKeys {
}
export class TreeNode<T extends TreeNode<any>> {
/** @internal */
_parent: T;
constructor(parent: T) {
if (isPresent(parent)) {
@ -102,6 +103,7 @@ export class DirectiveDependency extends Dependency {
this._verify();
}
/** @internal */
_verify(): void {
var count = 0;
if (isPresent(this.queryDecorator)) count++;
@ -288,12 +290,15 @@ export class ProtoElementInjector {
resolvedViewBindings.forEach(b => bd.push(new BindingWithVisibility(b, Visibility.Private)));
}
/** @internal */
public _firstBindingIsComponent: boolean;
constructor(public parent: ProtoElementInjector, public index: number,
bwv: BindingWithVisibility[], public distanceToParent: number,
public _firstBindingIsComponent: boolean,
_firstBindingIsComponent: boolean,
public directiveVariableBindings: Map<string, number>) {
this._firstBindingIsComponent = _firstBindingIsComponent;
var length = bwv.length;
this.protoInjector = new ProtoInjector(bwv);
this.eventEmitterAccessors = ListWrapper.createFixedSize(length);
@ -327,10 +332,12 @@ export class ElementInjector extends TreeNode<ElementInjector> implements Depend
private _injector: Injector;
private _strategy: _ElementInjectorStrategy;
/** @internal */
public _proto: ProtoElementInjector;
constructor(public _proto: ProtoElementInjector, parent: ElementInjector) {
constructor(_proto: ProtoElementInjector, parent: ElementInjector) {
super(parent);
this._proto = _proto;
this._injector =
new Injector(this._proto.protoInjector, null, this, () => this._debugContext());

View File

@ -219,6 +219,7 @@ export class AppViewManager_ extends AppViewManager {
return this._utils.getComponentInstance(hostView, boundElementIndex);
}
/** @internal */
_createRootHostViewScope: WtfScopeFn = wtfCreateScope('AppViewManager#createRootHostView()');
createRootHostView(hostProtoViewRef: ProtoViewRef, overrideSelector: string,
@ -239,6 +240,7 @@ export class AppViewManager_ extends AppViewManager {
return wtfLeave(s, hostView.ref);
}
/** @internal */
_destroyRootHostViewScope: WtfScopeFn = wtfCreateScope('AppViewManager#destroyRootHostView()');
destroyRootHostView(hostViewRef: HostViewRef) {
@ -254,6 +256,7 @@ export class AppViewManager_ extends AppViewManager {
wtfLeave(s);
}
/** @internal */
_createEmbeddedViewInContainerScope: WtfScopeFn =
wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()');
@ -269,6 +272,7 @@ export class AppViewManager_ extends AppViewManager {
templateRef.elementRef, null));
}
/** @internal */
_createHostViewInContainerScope: WtfScopeFn =
wtfCreateScope('AppViewManager#createHostViewInContainer()');
@ -289,6 +293,7 @@ export class AppViewManager_ extends AppViewManager {
/**
*
* See {@link AppViewManager#destroyViewInContainer}.
* @internal
*/
_createViewInContainer(viewContainerLocation: ElementRef, index: number,
protoView: viewModule.AppProtoView, context: ElementRef,
@ -320,6 +325,7 @@ export class AppViewManager_ extends AppViewManager {
return view.ref;
}
/** @internal */
_attachRenderView(parentView: viewModule.AppView, boundElementIndex: number, index: number,
view: viewModule.AppView) {
var elementRef = parentView.elementRefs[boundElementIndex];
@ -331,6 +337,7 @@ export class AppViewManager_ extends AppViewManager {
}
}
/** @internal */
_destroyViewInContainerScope = wtfCreateScope('AppViewMananger#destroyViewInContainer()');
destroyViewInContainer(viewContainerLocation: ElementRef, index: number) {
@ -341,6 +348,7 @@ export class AppViewManager_ extends AppViewManager {
wtfLeave(s);
}
/** @internal */
_attachViewInContainerScope = wtfCreateScope('AppViewMananger#attachViewInContainer()');
// TODO(i): refactor detachViewInContainer+attachViewInContainer to moveViewInContainer
@ -361,6 +369,7 @@ export class AppViewManager_ extends AppViewManager {
return wtfLeave(s, viewRef);
}
/** @internal */
_detachViewInContainerScope = wtfCreateScope('AppViewMananger#detachViewInContainer()');
// TODO(i): refactor detachViewInContainer+attachViewInContainer to moveViewInContainer
@ -375,6 +384,7 @@ export class AppViewManager_ extends AppViewManager {
return wtfLeave(s, view.ref);
}
/** @internal */
_createMainView(protoView: viewModule.AppProtoView,
renderViewWithFragments: RenderViewWithFragments): viewModule.AppView {
var mergedParentView =
@ -384,6 +394,7 @@ export class AppViewManager_ extends AppViewManager {
return mergedParentView;
}
/** @internal */
_createPooledView(protoView: viewModule.AppProtoView): viewModule.AppView {
var view = this._viewPool.getView(protoView);
if (isBlank(view)) {
@ -394,6 +405,7 @@ export class AppViewManager_ extends AppViewManager {
return view;
}
/** @internal */
_destroyPooledView(view: viewModule.AppView) {
var wasReturned = this._viewPool.returnView(view);
if (!wasReturned) {
@ -402,6 +414,7 @@ export class AppViewManager_ extends AppViewManager {
}
}
/** @internal */
_destroyViewInContainer(parentView: viewModule.AppView, boundElementIndex: number,
index: number) {
var viewContainer = parentView.viewContainers[boundElementIndex];
@ -422,6 +435,7 @@ export class AppViewManager_ extends AppViewManager {
}
}
/** @internal */
_viewDehydrateRecurse(view: viewModule.AppView) {
if (view.hydrated()) {
this._utils.dehydrateView(view);

View File

@ -172,6 +172,7 @@ export class AppViewManagerUtils {
contextView.locals);
}
/** @internal */
_hydrateView(initView: viewModule.AppView, imperativelyCreatedInjector: Injector,
hostElementInjector: eli.ElementInjector, context: Object, parentLocals: Locals) {
var viewIdx = initView.viewOffset;
@ -213,6 +214,7 @@ export class AppViewManagerUtils {
}
}
/** @internal */
_populateViewLocals(view: viewModule.AppView, elementInjector: eli.ElementInjector,
boundElementIdx: number): void {
if (isPresent(elementInjector.getDirectiveVariableBindings())) {
@ -226,6 +228,7 @@ export class AppViewManagerUtils {
}
}
/** @internal */
_setUpEventEmitters(view: viewModule.AppView, elementInjector: eli.ElementInjector,
boundElementIndex: number) {
var emitters = elementInjector.getEventEmitterAccessors();

View File

@ -9,7 +9,9 @@ export const APP_VIEW_POOL_CAPACITY = CONST_EXPR(new OpaqueToken('AppViewPool.vi
@Injectable()
export class AppViewPool {
/** @internal */
_poolCapacityPerProtoView: number;
/** @internal */
_pooledViewsPerProtoView = new Map<viewModule.AppProtoView, Array<viewModule.AppView>>();
constructor(@Inject(APP_VIEW_POOL_CAPACITY) poolCapacityPerProtoView) {

View File

@ -98,8 +98,12 @@ export abstract class ViewRef implements HostViewRef {
export class ViewRef_ extends ViewRef {
private _changeDetectorRef: ChangeDetectorRef = null;
constructor(public _view: viewModule.AppView) { super(); }
/** @internal */
public _view: viewModule.AppView;
constructor(_view: viewModule.AppView) {
super();
this._view = _view;
}
/**
* Return `RenderViewRef`
@ -166,5 +170,10 @@ export class ViewRef_ extends ViewRef {
export abstract class ProtoViewRef {}
export class ProtoViewRef_ extends ProtoViewRef {
constructor(public _protoView: viewModule.AppProtoView) { super(); }
/** @internal */
public _protoView: viewModule.AppProtoView;
constructor(_protoView: viewModule.AppProtoView) {
super();
this._protoView = _protoView;
}
}

View File

@ -11,6 +11,7 @@ import {reflector} from 'angular2/src/core/reflection/reflection';
@Injectable()
export class ViewResolver {
/** @internal */
_cache = new Map<Type, ViewMetadata>();
resolve(component: Type): ViewMetadata {
@ -24,6 +25,7 @@ export class ViewResolver {
return view;
}
/** @internal */
_resolve(component: Type): ViewMetadata {
var compMeta: ComponentMetadata;
var viewMeta: ViewMetadata;
@ -87,6 +89,7 @@ export class ViewResolver {
return null;
}
/** @internal */
_throwMixingViewAndComponent(propertyName: string, component: Type): void {
throw new BaseException(
`Component '${stringify(component)}' cannot have both '${propertyName}' and '@View' set at the same time"`);