refactor(render): don’t use a global cache for property setters

Related to #2359
This commit is contained in:
Tobias Bosch
2015-06-05 11:10:07 -07:00
parent 46eeee6b5e
commit 87b3b718e3
4 changed files with 141 additions and 134 deletions

View File

@ -16,20 +16,25 @@ import {TemplateLoader} from 'angular2/src/render/dom/compiler/template_loader';
import {CompileStepFactory, DefaultStepFactory} from './compile_step_factory';
import {Parser} from 'angular2/change_detection';
import {ShadowDomStrategy} from '../shadow_dom/shadow_dom_strategy';
import {
PropertySetterFactory
} from '../view/property_setter_factory'
/**
* The compiler loads and translates the html templates of components into
* nested ProtoViews. To decompose its functionality it uses
* the CompilePipeline and the CompileSteps.
*/
export class DomCompiler extends RenderCompiler {
/**
* The compiler loads and translates the html templates of components into
* nested ProtoViews. To decompose its functionality it uses
* the CompilePipeline and the CompileSteps.
*/
export class DomCompiler extends RenderCompiler {
_templateLoader: TemplateLoader;
_stepFactory: CompileStepFactory;
_propertySetterFactory: PropertySetterFactory;
constructor(stepFactory: CompileStepFactory, templateLoader: TemplateLoader) {
super();
this._templateLoader = templateLoader;
this._stepFactory = stepFactory;
this._propertySetterFactory = new PropertySetterFactory();
}
compile(template: ViewDefinition): Promise<ProtoViewDto> {
@ -58,7 +63,7 @@ export class DomCompiler extends RenderCompiler {
var pipeline = new CompilePipeline(this._stepFactory.createSteps(viewDef, subTaskPromises));
var compileElements = pipeline.process(tplElement, protoViewType, viewDef.componentId);
var protoView = compileElements[0].inheritedProtoView.build();
var protoView = compileElements[0].inheritedProtoView.build(this._propertySetterFactory);
if (subTaskPromises.length > 0) {
return PromiseWrapper.all(subTaskPromises).then((_) => protoView);