refactor: rename annotations to metadata

BREAKING CHANGE (maybe)

Well as long as our customers use public API this should not be a
breaking change, but we have changed import structure as well as
internal names, so it could be breaking.

import:
  angular2/annotations => angular2/metadata

Classes:
  *Annotations => *Metadata
  renderer.DirectiveMetadata => renderer.RendererDirectiveMetadata
  renderer.ElementBinder => renderer.RendererElementBinder
  impl.Directive => impl.DirectiveMetadata
  impl.Component => impl.ComponentMetadata
  impl.View => impl.ViewMetadata

Closes #3660
This commit is contained in:
Misko Hevery
2015-08-14 10:03:45 -07:00
committed by Miško Hevery
parent 5e6317fecc
commit ea6673947c
172 changed files with 1287 additions and 1173 deletions

View File

@ -1,24 +1,24 @@
import {Map, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
import {Type, isPresent, BaseException, stringify, isBlank} from 'angular2/src/facade/lang';
import {View} from 'angular2/src/core/annotations_impl/view';
import {ViewMetadata} from '../core/metadata';
import {ViewResolver} from 'angular2/src/core/compiler/view_resolver';
export class MockViewResolver extends ViewResolver {
_views: Map<Type, View> = new Map();
_views: Map<Type, ViewMetadata> = new Map();
_inlineTemplates: Map<Type, string> = new Map();
_viewCache: Map<Type, View> = new Map();
_viewCache: Map<Type, ViewMetadata> = new Map();
_directiveOverrides: Map<Type, Map<Type, Type>> = new Map();
constructor() { super(); }
/**
* Overrides the {@link View} for a component.
* Overrides the {@link ViewMetadata} for a component.
*
* @param {Type} component
* @param {ViewDefinition} view
*/
setView(component: Type, view: View): void {
setView(component: Type, view: ViewMetadata): void {
this._checkOverrideable(component);
this._views.set(component, view);
}
@ -35,7 +35,7 @@ export class MockViewResolver extends ViewResolver {
}
/**
* Overrides a directive from the component {@link View}.
* Overrides a directive from the component {@link ViewMetadata}.
*
* @param {Type} component
* @param {Type} from
@ -55,8 +55,8 @@ export class MockViewResolver extends ViewResolver {
}
/**
* Returns the {@link View} for a component:
* - Set the {@link View} to the overridden view when it exists or fallback to the default
* Returns the {@link ViewMetadata} for a component:
* - Set the {@link ViewMetadata} to the overridden view when it exists or fallback to the default
* `ViewResolver`,
* see `setView`.
* - Override the directives, see `overrideViewDirective`.
@ -65,7 +65,7 @@ export class MockViewResolver extends ViewResolver {
* @param component
* @returns {ViewDefinition}
*/
resolve(component: Type): View {
resolve(component: Type): ViewMetadata {
var view = this._viewCache.get(component);
if (isPresent(view)) return view;
@ -87,13 +87,14 @@ export class MockViewResolver extends ViewResolver {
}
directives[srcIndex] = to;
});
view = new View(
view = new ViewMetadata(
{template: view.template, templateUrl: view.templateUrl, directives: directives});
}
var inlineTemplate = this._inlineTemplates.get(component);
if (isPresent(inlineTemplate)) {
view = new View({template: inlineTemplate, templateUrl: null, directives: view.directives});
view = new ViewMetadata(
{template: inlineTemplate, templateUrl: null, directives: view.directives});
}
this._viewCache.set(component, view);