refactor(core): introduce ViewRef and ProtoViewRef

BREAKING CHANGES:
- `NgElement` merged into `ElementRef`
- `Compiler.compile…` returns `ProtoViewRef`
- `ViewContainer` uses `ProtoViewRef`s and `ViewRef`s.
- `ViewRef`/`ProtoViewRef` in renderer were renamed to
  `RenderViewRef`/`RenderProtoViewRef`.

Related to #1477
Closes #1592
This commit is contained in:
Tobias Bosch
2015-04-28 11:20:01 -07:00
parent 1205f54d01
commit 09f8d8f7ba
35 changed files with 473 additions and 404 deletions

View File

@ -9,6 +9,7 @@ import {View} from 'angular2/src/core/annotations/view';
import {TemplateResolver} from 'angular2/src/core/compiler/template_resolver';
import {AppView} from 'angular2/src/core/compiler/view';
import {internalView} from 'angular2/src/core/compiler/view_ref';
import {DynamicComponentLoader, ComponentRef} from 'angular2/src/core/compiler/dynamic_component_loader';
import {queryView, viewRootNodes, el} from './utils';
@ -103,7 +104,7 @@ export class ViewProxy {
constructor(componentRef: ComponentRef) {
this._componentRef = componentRef;
this._view = componentRef.hostView.componentChildViews[0];
this._view = internalView(componentRef.hostView).componentChildViews[0];
}
get context(): any {

View File

@ -276,7 +276,15 @@ export class SpyObject {
constructor(type = null) {
if (type) {
for (var prop in type.prototype) {
var m = type.prototype[prop];
var m = null;
try {
m = type.prototype[prop];
} catch (e) {
// As we are creating spys for abstract classes,
// these classes might have getters that throw when they are accessed.
// As we are only auto creating spys for methods, this
// should not matter.
}
if (typeof m === 'function') {
this.spy(prop);
}