fix(compiler): workaround for circular dependencies in nodejs

Closes #897
This commit is contained in:
Marc Laval 2015-03-09 11:33:35 +01:00
parent e0feeaf973
commit f1f06018c1
4 changed files with 19 additions and 19 deletions

View File

@ -4,7 +4,7 @@ import {List, ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
import {Injector, Key, Dependency, bind, Binding, NoProviderError, ProviderError, CyclicDependencyError} from 'angular2/di';
import {Parent, Ancestor} from 'angular2/src/core/annotations/visibility';
import {EventEmitter, PropertySetter} from 'angular2/src/core/annotations/di';
import {View, ProtoView} from 'angular2/src/core/compiler/view';
import * as viewModule from 'angular2/src/core/compiler/view';
import {LightDom, SourceLightDom, DestinationLightDom} from 'angular2/src/core/compiler/shadow_dom_emulation/light_dom';
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {NgElement} from 'angular2/src/core/dom/element';
@ -30,7 +30,7 @@ class StaticKeys {
constructor() {
//TODO: vsavkin Key.annotate(Key.get(View), 'static')
this.viewId = Key.get(View).id;
this.viewId = Key.get(viewModule.View).id;
this.ngElementId = Key.get(NgElement).id;
this.viewContainerId = Key.get(ViewContainer).id;
this.destinationLightDomId = Key.get(DestinationLightDom).id;
@ -163,7 +163,7 @@ export class DirectiveBinding extends Binding {
// TODO(rado): benchmark and consider rolling in as ElementInjector fields.
export class PreBuiltObjects {
view:View;
view:viewModule.View;
element:NgElement;
viewContainer:ViewContainer;
lightDom:LightDom;
@ -222,7 +222,7 @@ export class ProtoElementInjector {
_keyId9:int;
parent:ProtoElementInjector;
index:int;
view:View;
view:viewModule.View;
distanceToParent:number;
/** Whether the element is exported as $implicit. */

View File

@ -1,5 +1,5 @@
import {Decorator} from '../../annotations/annotations';
import {SourceLightDom, DestinationLightDom, LightDom} from './light_dom';
import * as ldModule from './light_dom';
import {Inject} from 'angular2/di';
import {DOM} from 'angular2/src/dom/dom_adapter';
import {isPresent} from 'angular2/src/facade/lang';
@ -68,9 +68,9 @@ class RenderedContent extends ContentStrategy {
* and thus does not get rendered but only affect the distribution of its parent component.
*/
class IntermediateContent extends ContentStrategy {
destinationLightDom:LightDom;
destinationLightDom:ldModule.LightDom;
constructor(destinationLightDom:LightDom) {
constructor(destinationLightDom:ldModule.LightDom) {
super();
this.destinationLightDom = destinationLightDom;
this.nodes = [];
@ -90,7 +90,7 @@ export class Content {
select:string;
_strategy:ContentStrategy;
constructor(@Inject(DestinationLightDom) destinationLightDom, contentEl:NgElement) {
constructor(@Inject(ldModule.DestinationLightDom) destinationLightDom, contentEl:NgElement) {
this.select = contentEl.getAttribute('select');
this._strategy = isPresent(destinationLightDom) ?
new IntermediateContent(destinationLightDom) :

View File

@ -2,7 +2,7 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
import {List, ListWrapper} from 'angular2/src/facade/collection';
import {isBlank, isPresent} from 'angular2/src/facade/lang';
import {View} from '../view';
import * as viewModule from '../view';
import {ElementInjector} from '../element_injector';
import {ViewContainer} from '../view_container';
import {Content} from './content_tag';
@ -25,14 +25,14 @@ class _Root {
// once interfaces are supported
export class LightDom {
// The light DOM of the element is enclosed inside the lightDomView
lightDomView:View;
lightDomView:viewModule.View;
// The shadow DOM
shadowDomView:View;
shadowDomView:viewModule.View;
// The nodes of the light DOM
nodes:List;
roots:List<_Root>;
constructor(lightDomView:View, shadowDomView:View, element) {
constructor(lightDomView:viewModule.View, shadowDomView:viewModule.View, element) {
this.lightDomView = lightDomView;
this.shadowDomView = shadowDomView;
this.nodes = DOM.childNodesAsList(element);
@ -51,7 +51,7 @@ export class LightDom {
}
// Collects the Content directives from the view and all its child views
_collectAllContentTags(view: View, acc:List<Content>):List<Content> {
_collectAllContentTags(view: viewModule.View, acc:List<Content>):List<Content> {
var eis = view.elementInjectors;
for (var i = 0; i < eis.length; ++i) {
var ei = eis[i];

View File

@ -4,7 +4,7 @@ import {PromiseWrapper} from 'angular2/src/facade/async';
import {DOM} from 'angular2/src/dom/dom_adapter';
import {View} from './view';
import * as viewModule from './view';
import {Content} from './shadow_dom_emulation/content_tag';
import {LightDom} from './shadow_dom_emulation/light_dom';
@ -20,8 +20,8 @@ import {CompileElement} from './pipeline/compile_element';
import {CompileControl} from './pipeline/compile_control';
export class ShadowDomStrategy {
attachTemplate(el, view:View) {}
constructLightDom(lightDomView:View, shadowDomView:View, el): LightDom { return null; }
attachTemplate(el, view:viewModule.View) {}
constructLightDom(lightDomView:viewModule.View, shadowDomView:viewModule.View, el): LightDom { return null; }
polyfillDirectives():List<Type> { return []; }
/**
@ -78,12 +78,12 @@ export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
this._styleHost = styleHost;
}
attachTemplate(el, view:View){
attachTemplate(el, view:viewModule.View){
DOM.clearNodes(el);
_moveViewNodesIntoParent(el, view);
}
constructLightDom(lightDomView:View, shadowDomView:View, el): LightDom {
constructLightDom(lightDomView:viewModule.View, shadowDomView:viewModule.View, el): LightDom {
return new LightDom(lightDomView, shadowDomView, el);
}
@ -147,7 +147,7 @@ export class NativeShadowDomStrategy extends ShadowDomStrategy {
this._styleUrlResolver = styleUrlResolver;
}
attachTemplate(el, view:View){
attachTemplate(el, view:viewModule.View){
_moveViewNodesIntoParent(DOM.createShadowRoot(el), view);
}