refactor(): use const and let instead of var
This commit is contained in:

committed by
Victor Berchet

parent
73593d4bf3
commit
77ee27c59e
@ -81,13 +81,13 @@ export class CompileElement extends CompileNode {
|
||||
}
|
||||
|
||||
private _createViewContainer() {
|
||||
var fieldName = `_vc_${this.nodeIndex}`;
|
||||
var parentNodeIndex = this.isRootElement() ? null : this.parent.nodeIndex;
|
||||
const fieldName = `_vc_${this.nodeIndex}`;
|
||||
const parentNodeIndex = this.isRootElement() ? null : this.parent.nodeIndex;
|
||||
// private is fine here as no child view will reference a ViewContainer
|
||||
this.view.fields.push(new o.ClassField(
|
||||
fieldName, o.importType(resolveIdentifier(Identifiers.ViewContainer)),
|
||||
[o.StmtModifier.Private]));
|
||||
var statement =
|
||||
const statement =
|
||||
o.THIS_EXPR.prop(fieldName)
|
||||
.set(o.importExpr(resolveIdentifier(Identifiers.ViewContainer)).instantiate([
|
||||
o.literal(this.nodeIndex), o.literal(parentNodeIndex), o.THIS_EXPR, this.renderNode
|
||||
@ -101,22 +101,22 @@ export class CompileElement extends CompileNode {
|
||||
}
|
||||
|
||||
private _createComponentFactoryResolver() {
|
||||
let entryComponents =
|
||||
const entryComponents =
|
||||
this.component.entryComponents.map((entryComponent: CompileIdentifierMetadata) => {
|
||||
var id = new CompileIdentifierMetadata({name: entryComponent.name});
|
||||
const id = new CompileIdentifierMetadata({name: entryComponent.name});
|
||||
this._targetDependencies.push(new ComponentFactoryDependency(entryComponent, id));
|
||||
return id;
|
||||
});
|
||||
if (!entryComponents || entryComponents.length === 0) {
|
||||
return;
|
||||
}
|
||||
var createComponentFactoryResolverExpr =
|
||||
const createComponentFactoryResolverExpr =
|
||||
o.importExpr(resolveIdentifier(Identifiers.CodegenComponentFactoryResolver)).instantiate([
|
||||
o.literalArr(entryComponents.map((entryComponent) => o.importExpr(entryComponent))),
|
||||
injectFromViewParentInjector(
|
||||
this.view, resolveIdentifierToken(Identifiers.ComponentFactoryResolver), false)
|
||||
]);
|
||||
var provider = new CompileProviderMetadata({
|
||||
const provider = new CompileProviderMetadata({
|
||||
token: resolveIdentifierToken(Identifiers.ComponentFactoryResolver),
|
||||
useValue: createComponentFactoryResolverExpr
|
||||
});
|
||||
@ -132,7 +132,7 @@ export class CompileElement extends CompileNode {
|
||||
this.compViewExpr = compViewExpr;
|
||||
this.contentNodesByNgContentIndex =
|
||||
new Array(this.component.template.ngContentSelectors.length);
|
||||
for (var i = 0; i < this.contentNodesByNgContentIndex.length; i++) {
|
||||
for (let i = 0; i < this.contentNodesByNgContentIndex.length; i++) {
|
||||
this.contentNodesByNgContentIndex[i] = [];
|
||||
}
|
||||
}
|
||||
@ -140,11 +140,11 @@ export class CompileElement extends CompileNode {
|
||||
setEmbeddedView(embeddedView: CompileView) {
|
||||
this.embeddedView = embeddedView;
|
||||
if (isPresent(embeddedView)) {
|
||||
var createTemplateRefExpr =
|
||||
const createTemplateRefExpr =
|
||||
o.importExpr(resolveIdentifier(Identifiers.TemplateRef_)).instantiate([
|
||||
o.THIS_EXPR, o.literal(this.nodeIndex), this.renderNode
|
||||
]);
|
||||
var provider = new CompileProviderMetadata({
|
||||
const provider = new CompileProviderMetadata({
|
||||
token: resolveIdentifierToken(Identifiers.TemplateRef),
|
||||
useValue: createTemplateRefExpr
|
||||
});
|
||||
@ -199,8 +199,8 @@ export class CompileElement extends CompileNode {
|
||||
return convertValueToOutputAst(provider.useValue);
|
||||
}
|
||||
});
|
||||
var propName = `_${resolvedProvider.token.name}_${this.nodeIndex}_${this.instances.size}`;
|
||||
var instance = createProviderProperty(
|
||||
const propName = `_${resolvedProvider.token.name}_${this.nodeIndex}_${this.instances.size}`;
|
||||
const instance = createProviderProperty(
|
||||
propName, resolvedProvider, providerValueExpressions, resolvedProvider.multiProvider,
|
||||
resolvedProvider.eager, this);
|
||||
if (isDirectiveWrapper) {
|
||||
@ -212,38 +212,38 @@ export class CompileElement extends CompileNode {
|
||||
}
|
||||
});
|
||||
|
||||
for (var i = 0; i < this._directives.length; i++) {
|
||||
var directive = this._directives[i];
|
||||
var directiveInstance = this.instances.get(identifierToken(directive.type).reference);
|
||||
for (let i = 0; i < this._directives.length; i++) {
|
||||
const directive = this._directives[i];
|
||||
const directiveInstance = this.instances.get(identifierToken(directive.type).reference);
|
||||
directive.queries.forEach((queryMeta) => { this._addQuery(queryMeta, directiveInstance); });
|
||||
}
|
||||
var queriesWithReads: _QueryWithRead[] = [];
|
||||
const queriesWithReads: _QueryWithRead[] = [];
|
||||
Array.from(this._resolvedProviders.values()).forEach((resolvedProvider) => {
|
||||
var queriesForProvider = this._getQueriesFor(resolvedProvider.token);
|
||||
const queriesForProvider = this._getQueriesFor(resolvedProvider.token);
|
||||
queriesWithReads.push(
|
||||
...queriesForProvider.map(query => new _QueryWithRead(query, resolvedProvider.token)));
|
||||
});
|
||||
Object.keys(this.referenceTokens).forEach(varName => {
|
||||
var token = this.referenceTokens[varName];
|
||||
var varValue: o.Expression;
|
||||
const token = this.referenceTokens[varName];
|
||||
let varValue: o.Expression;
|
||||
if (token) {
|
||||
varValue = this.instances.get(token.reference);
|
||||
} else {
|
||||
varValue = this.renderNode;
|
||||
}
|
||||
this.view.locals.set(varName, varValue);
|
||||
var varToken = new CompileTokenMetadata({value: varName});
|
||||
const varToken = new CompileTokenMetadata({value: varName});
|
||||
queriesWithReads.push(
|
||||
...this._getQueriesFor(varToken).map(query => new _QueryWithRead(query, varToken)));
|
||||
});
|
||||
queriesWithReads.forEach((queryWithRead) => {
|
||||
var value: o.Expression;
|
||||
let value: o.Expression;
|
||||
if (isPresent(queryWithRead.read.identifier)) {
|
||||
// query for an identifier
|
||||
value = this.instances.get(queryWithRead.read.reference);
|
||||
} else {
|
||||
// query for a reference
|
||||
var token = this.referenceTokens[queryWithRead.read.value];
|
||||
const token = this.referenceTokens[queryWithRead.read.value];
|
||||
if (isPresent(token)) {
|
||||
value = this.instances.get(token.reference);
|
||||
} else {
|
||||
@ -261,12 +261,12 @@ export class CompileElement extends CompileNode {
|
||||
// Note: afterChildren is called after recursing into children.
|
||||
// This is good so that an injector match in an element that is closer to a requesting element
|
||||
// matches first.
|
||||
var providerExpr = this.instances.get(resolvedProvider.token.reference);
|
||||
const providerExpr = this.instances.get(resolvedProvider.token.reference);
|
||||
// Note: view providers are only visible on the injector of that element.
|
||||
// This is not fully correct as the rules during codegen don't allow a directive
|
||||
// to get hold of a view provdier on the same element. We still do this semantic
|
||||
// as it simplifies our model to having only one runtime injector per element.
|
||||
var providerChildNodeCount =
|
||||
const providerChildNodeCount =
|
||||
resolvedProvider.providerType === ProviderAstType.PrivateService ? 0 : childNodeCount;
|
||||
this.view.injectorGetMethod.addStmt(createInjectInternalCondition(
|
||||
this.nodeIndex, providerChildNodeCount, resolvedProvider, providerExpr));
|
||||
@ -295,10 +295,10 @@ export class CompileElement extends CompileNode {
|
||||
}
|
||||
|
||||
private _getQueriesFor(token: CompileTokenMetadata): CompileQuery[] {
|
||||
var result: CompileQuery[] = [];
|
||||
var currentEl: CompileElement = this;
|
||||
var distance = 0;
|
||||
var queries: CompileQuery[];
|
||||
const result: CompileQuery[] = [];
|
||||
let currentEl: CompileElement = this;
|
||||
let distance = 0;
|
||||
let queries: CompileQuery[];
|
||||
while (!currentEl.isNull()) {
|
||||
queries = currentEl._queries.get(token.reference);
|
||||
if (isPresent(queries)) {
|
||||
@ -318,16 +318,17 @@ export class CompileElement extends CompileNode {
|
||||
|
||||
private _addQuery(queryMeta: CompileQueryMetadata, directiveInstance: o.Expression):
|
||||
CompileQuery {
|
||||
var propName = `_query_${queryMeta.selectors[0].name}_${this.nodeIndex}_${this._queryCount++}`;
|
||||
var queryList = createQueryList(queryMeta, directiveInstance, propName, this.view);
|
||||
var query = new CompileQuery(queryMeta, queryList, directiveInstance, this.view);
|
||||
const propName =
|
||||
`_query_${queryMeta.selectors[0].name}_${this.nodeIndex}_${this._queryCount++}`;
|
||||
const queryList = createQueryList(queryMeta, directiveInstance, propName, this.view);
|
||||
const query = new CompileQuery(queryMeta, queryList, directiveInstance, this.view);
|
||||
addQueryToTokenMap(this._queries, query);
|
||||
return query;
|
||||
}
|
||||
|
||||
private _getLocalDependency(
|
||||
requestingProviderType: ProviderAstType, dep: CompileDiDependencyMetadata): o.Expression {
|
||||
var result: o.Expression = null;
|
||||
let result: o.Expression = null;
|
||||
if (isPresent(dep.token)) {
|
||||
// access builtins with special visibility
|
||||
if (!result) {
|
||||
@ -342,7 +343,7 @@ export class CompileElement extends CompileNode {
|
||||
}
|
||||
// access regular providers on the element
|
||||
if (!result) {
|
||||
let resolvedProvider = this._resolvedProviders.get(dep.token.reference);
|
||||
const resolvedProvider = this._resolvedProviders.get(dep.token.reference);
|
||||
// don't allow directives / public services to access private services.
|
||||
// only components and private services can access private services.
|
||||
if (resolvedProvider && (requestingProviderType === ProviderAstType.Directive ||
|
||||
@ -358,8 +359,8 @@ export class CompileElement extends CompileNode {
|
||||
|
||||
private _getDependency(requestingProviderType: ProviderAstType, dep: CompileDiDependencyMetadata):
|
||||
o.Expression {
|
||||
var currElement: CompileElement = this;
|
||||
var result: o.Expression = null;
|
||||
let currElement: CompileElement = this;
|
||||
let result: o.Expression = null;
|
||||
if (dep.isValue) {
|
||||
result = o.literal(dep.value);
|
||||
}
|
||||
@ -386,7 +387,7 @@ export class CompileElement extends CompileNode {
|
||||
function createInjectInternalCondition(
|
||||
nodeIndex: number, childNodeCount: number, provider: ProviderAst,
|
||||
providerExpr: o.Expression): o.Statement {
|
||||
var indexCondition: o.Expression;
|
||||
let indexCondition: o.Expression;
|
||||
if (childNodeCount > 0) {
|
||||
indexCondition = o.literal(nodeIndex)
|
||||
.lowerEquals(InjectMethodVars.requestNodeIndex)
|
||||
@ -403,9 +404,9 @@ function createInjectInternalCondition(
|
||||
function createProviderProperty(
|
||||
propName: string, provider: ProviderAst, providerValueExpressions: o.Expression[],
|
||||
isMulti: boolean, isEager: boolean, compileElement: CompileElement): o.Expression {
|
||||
var view = compileElement.view;
|
||||
var resolvedProviderValueExpr: o.Expression;
|
||||
var type: o.Type;
|
||||
const view = compileElement.view;
|
||||
let resolvedProviderValueExpr: o.Expression;
|
||||
let type: o.Type;
|
||||
if (isMulti) {
|
||||
resolvedProviderValueExpr = o.literalArr(providerValueExpressions);
|
||||
type = new o.ArrayType(o.DYNAMIC_TYPE);
|
||||
@ -420,9 +421,9 @@ function createProviderProperty(
|
||||
view.fields.push(new o.ClassField(propName, type));
|
||||
view.createMethod.addStmt(o.THIS_EXPR.prop(propName).set(resolvedProviderValueExpr).toStmt());
|
||||
} else {
|
||||
var internalField = `_${propName}`;
|
||||
const internalField = `_${propName}`;
|
||||
view.fields.push(new o.ClassField(internalField, type));
|
||||
var getter = new CompileMethod(view);
|
||||
const getter = new CompileMethod(view);
|
||||
getter.resetDebugInfo(compileElement.nodeIndex, compileElement.sourceAst);
|
||||
// Note: Equals is important for JS so that it also checks the undefined case!
|
||||
getter.addStmt(new o.IfStmt(
|
||||
|
@ -16,7 +16,7 @@ class _DebugState {
|
||||
constructor(public nodeIndex: number, public sourceAst: TemplateAst) {}
|
||||
}
|
||||
|
||||
var NULL_DEBUG_STATE = new _DebugState(null, null);
|
||||
const NULL_DEBUG_STATE = new _DebugState(null, null);
|
||||
|
||||
export class CompileMethod {
|
||||
private _newState: _DebugState = NULL_DEBUG_STATE;
|
||||
@ -33,7 +33,7 @@ export class CompileMethod {
|
||||
private _updateDebugContextIfNeeded() {
|
||||
if (this._newState.nodeIndex !== this._currState.nodeIndex ||
|
||||
this._newState.sourceAst !== this._currState.sourceAst) {
|
||||
var expr = this._updateDebugContext(this._newState);
|
||||
const expr = this._updateDebugContext(this._newState);
|
||||
if (isPresent(expr)) {
|
||||
this._bodyStatements.push(expr.toStmt());
|
||||
}
|
||||
@ -43,7 +43,7 @@ export class CompileMethod {
|
||||
private _updateDebugContext(newState: _DebugState): o.Expression {
|
||||
this._currState = this._newState = newState;
|
||||
if (this._debugEnabled) {
|
||||
var sourceLocation =
|
||||
const sourceLocation =
|
||||
isPresent(newState.sourceAst) ? newState.sourceAst.sourceSpan.start : null;
|
||||
|
||||
return o.THIS_EXPR.callMethod('debug', [
|
||||
@ -57,7 +57,7 @@ export class CompileMethod {
|
||||
}
|
||||
|
||||
resetDebugInfoExpr(nodeIndex: number, templateAst: TemplateAst): o.Expression {
|
||||
var res = this._updateDebugContext(new _DebugState(nodeIndex, templateAst));
|
||||
const res = this._updateDebugContext(new _DebugState(nodeIndex, templateAst));
|
||||
return res || o.NULL_EXPR;
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,9 @@ import {getPropertyInView, injectFromViewParentInjector} from './util';
|
||||
|
||||
export class CompilePipe {
|
||||
static call(view: CompileView, name: string, args: o.Expression[]): o.Expression {
|
||||
var compView = view.componentView;
|
||||
var meta = _findPipeMeta(compView, name);
|
||||
var pipe: CompilePipe;
|
||||
const compView = view.componentView;
|
||||
const meta = _findPipeMeta(compView, name);
|
||||
let pipe: CompilePipe;
|
||||
if (meta.pure) {
|
||||
// pure pipes live on the component view
|
||||
pipe = compView.purePipes.get(name);
|
||||
@ -41,7 +41,7 @@ export class CompilePipe {
|
||||
|
||||
constructor(public view: CompileView, public meta: CompilePipeSummary) {
|
||||
this.instance = o.THIS_EXPR.prop(`_pipe_${meta.name}_${view.pipeCount++}`);
|
||||
var deps = this.meta.type.diDeps.map((diDep) => {
|
||||
const deps = this.meta.type.diDeps.map((diDep) => {
|
||||
if (diDep.token.reference ===
|
||||
resolveIdentifierToken(Identifiers.ChangeDetectorRef).reference) {
|
||||
return getPropertyInView(o.THIS_EXPR.prop('ref'), this.view, this.view.componentView);
|
||||
@ -60,9 +60,10 @@ export class CompilePipe {
|
||||
private _call(callingView: CompileView, args: o.Expression[]): o.Expression {
|
||||
if (this.meta.pure) {
|
||||
// PurePipeProxies live on the view that called them.
|
||||
var purePipeProxyInstance =
|
||||
const purePipeProxyInstance =
|
||||
o.THIS_EXPR.prop(`${this.instance.name}_${this._purePipeProxyCount++}`);
|
||||
var pipeInstanceSeenFromPureProxy = getPropertyInView(this.instance, callingView, this.view);
|
||||
const pipeInstanceSeenFromPureProxy =
|
||||
getPropertyInView(this.instance, callingView, this.view);
|
||||
createPureProxy(
|
||||
pipeInstanceSeenFromPureProxy.prop('transform')
|
||||
.callMethod(o.BuiltinMethod.Bind, [pipeInstanceSeenFromPureProxy]),
|
||||
@ -78,9 +79,9 @@ export class CompilePipe {
|
||||
}
|
||||
|
||||
function _findPipeMeta(view: CompileView, name: string): CompilePipeSummary {
|
||||
var pipeMeta: CompilePipeSummary = null;
|
||||
for (var i = view.pipeMetas.length - 1; i >= 0; i--) {
|
||||
var localPipeMeta = view.pipeMetas[i];
|
||||
let pipeMeta: CompilePipeSummary = null;
|
||||
for (let i = view.pipeMetas.length - 1; i >= 0; i--) {
|
||||
const localPipeMeta = view.pipeMetas[i];
|
||||
if (localPipeMeta.name == name) {
|
||||
pipeMeta = localPipeMeta;
|
||||
break;
|
||||
|
@ -31,23 +31,23 @@ export class CompileQuery {
|
||||
}
|
||||
|
||||
addValue(value: o.Expression, view: CompileView) {
|
||||
var currentView = view;
|
||||
var elPath: CompileElement[] = [];
|
||||
let currentView = view;
|
||||
const elPath: CompileElement[] = [];
|
||||
while (isPresent(currentView) && currentView !== this.view) {
|
||||
var parentEl = currentView.declarationElement;
|
||||
const parentEl = currentView.declarationElement;
|
||||
elPath.unshift(parentEl);
|
||||
currentView = parentEl.view;
|
||||
}
|
||||
var queryListForDirtyExpr = getPropertyInView(this.queryList, view, this.view);
|
||||
const queryListForDirtyExpr = getPropertyInView(this.queryList, view, this.view);
|
||||
|
||||
var viewValues = this._values;
|
||||
let viewValues = this._values;
|
||||
elPath.forEach((el) => {
|
||||
var last =
|
||||
const last =
|
||||
viewValues.values.length > 0 ? viewValues.values[viewValues.values.length - 1] : null;
|
||||
if (last instanceof ViewQueryValues && last.view === el.embeddedView) {
|
||||
viewValues = last;
|
||||
} else {
|
||||
var newViewValues = new ViewQueryValues(el.embeddedView, []);
|
||||
const newViewValues = new ViewQueryValues(el.embeddedView, []);
|
||||
viewValues.values.push(newViewValues);
|
||||
viewValues = newViewValues;
|
||||
}
|
||||
@ -65,10 +65,10 @@ export class CompileQuery {
|
||||
}
|
||||
|
||||
afterChildren(targetStaticMethod: CompileMethod, targetDynamicMethod: CompileMethod) {
|
||||
var values = createQueryValues(this._values);
|
||||
var updateStmts = [this.queryList.callMethod('reset', [o.literalArr(values)]).toStmt()];
|
||||
const values = createQueryValues(this._values);
|
||||
const updateStmts = [this.queryList.callMethod('reset', [o.literalArr(values)]).toStmt()];
|
||||
if (isPresent(this.ownerDirectiveExpression)) {
|
||||
var valueExpr = this.meta.first ? this.queryList.prop('first') : this.queryList;
|
||||
const valueExpr = this.meta.first ? this.queryList.prop('first') : this.queryList;
|
||||
updateStmts.push(
|
||||
this.ownerDirectiveExpression.prop(this.meta.propertyName).set(valueExpr).toStmt());
|
||||
}
|
||||
@ -100,7 +100,7 @@ function createQueryValues(viewValues: ViewQueryValues): o.Expression[] {
|
||||
|
||||
function mapNestedViews(
|
||||
viewContainer: o.Expression, view: CompileView, expressions: o.Expression[]): o.Expression {
|
||||
var adjustedExpressions: o.Expression[] = expressions.map(
|
||||
const adjustedExpressions: o.Expression[] = expressions.map(
|
||||
(expr) => o.replaceVarInExpression(o.THIS_EXPR.name, o.variable('nestedView'), expr));
|
||||
return viewContainer.callMethod('mapNestedViews', [
|
||||
o.variable(view.className),
|
||||
@ -115,7 +115,7 @@ export function createQueryList(
|
||||
compileView: CompileView): o.Expression {
|
||||
compileView.fields.push(new o.ClassField(
|
||||
propertyName, o.importType(resolveIdentifier(Identifiers.QueryList), [o.DYNAMIC_TYPE])));
|
||||
var expr = o.THIS_EXPR.prop(propertyName);
|
||||
const expr = o.THIS_EXPR.prop(propertyName);
|
||||
compileView.createMethod.addStmt(
|
||||
o.THIS_EXPR.prop(propertyName)
|
||||
.set(o.importExpr(resolveIdentifier(Identifiers.QueryList), [o.DYNAMIC_TYPE])
|
||||
@ -126,7 +126,7 @@ export function createQueryList(
|
||||
|
||||
export function addQueryToTokenMap(map: Map<any, CompileQuery[]>, query: CompileQuery) {
|
||||
query.meta.selectors.forEach((selector) => {
|
||||
var entry = map.get(selector.reference);
|
||||
let entry = map.get(selector.reference);
|
||||
if (!entry) {
|
||||
entry = [];
|
||||
map.set(selector.reference, entry);
|
||||
|
@ -111,13 +111,13 @@ export class CompileView implements NameResolver {
|
||||
this.componentContext =
|
||||
getPropertyInView(o.THIS_EXPR.prop('context'), this, this.componentView);
|
||||
|
||||
var viewQueries = new Map<any, CompileQuery[]>();
|
||||
const viewQueries = new Map<any, CompileQuery[]>();
|
||||
if (this.viewType === ViewType.COMPONENT) {
|
||||
var directiveInstance = o.THIS_EXPR.prop('context');
|
||||
const directiveInstance = o.THIS_EXPR.prop('context');
|
||||
this.component.viewQueries.forEach((queryMeta, queryIndex) => {
|
||||
var propName = `_viewQuery_${queryMeta.selectors[0].name}_${queryIndex}`;
|
||||
var queryList = createQueryList(queryMeta, directiveInstance, propName, this);
|
||||
var query = new CompileQuery(queryMeta, queryList, directiveInstance, this);
|
||||
const propName = `_viewQuery_${queryMeta.selectors[0].name}_${queryIndex}`;
|
||||
const queryList = createQueryList(queryMeta, directiveInstance, propName, this);
|
||||
const query = new CompileQuery(queryMeta, queryList, directiveInstance, this);
|
||||
addQueryToTokenMap(viewQueries, query);
|
||||
});
|
||||
}
|
||||
@ -138,8 +138,8 @@ export class CompileView implements NameResolver {
|
||||
if (name == EventHandlerVars.event.name) {
|
||||
return EventHandlerVars.event;
|
||||
}
|
||||
var currView: CompileView = this;
|
||||
var result = currView.locals.get(name);
|
||||
let currView: CompileView = this;
|
||||
let result = currView.locals.get(name);
|
||||
while (!result && isPresent(currView.declarationElement.view)) {
|
||||
currView = currView.declarationElement.view;
|
||||
result = currView.locals.get(name);
|
||||
|
@ -16,15 +16,15 @@ import {CompileElement} from './compile_element';
|
||||
import {CompileView} from './compile_view';
|
||||
import {DetectChangesVars} from './constants';
|
||||
|
||||
var STATE_IS_NEVER_CHECKED = o.THIS_EXPR.prop('numberOfChecks').identical(new o.LiteralExpr(0));
|
||||
var NOT_THROW_ON_CHANGES = o.not(DetectChangesVars.throwOnChange);
|
||||
const STATE_IS_NEVER_CHECKED = o.THIS_EXPR.prop('numberOfChecks').identical(new o.LiteralExpr(0));
|
||||
const NOT_THROW_ON_CHANGES = o.not(DetectChangesVars.throwOnChange);
|
||||
|
||||
export function bindDirectiveAfterContentLifecycleCallbacks(
|
||||
directiveMeta: CompileDirectiveSummary, directiveInstance: o.Expression,
|
||||
compileElement: CompileElement) {
|
||||
var view = compileElement.view;
|
||||
var lifecycleHooks = directiveMeta.type.lifecycleHooks;
|
||||
var afterContentLifecycleCallbacksMethod = view.afterContentLifecycleCallbacksMethod;
|
||||
const view = compileElement.view;
|
||||
const lifecycleHooks = directiveMeta.type.lifecycleHooks;
|
||||
const afterContentLifecycleCallbacksMethod = view.afterContentLifecycleCallbacksMethod;
|
||||
afterContentLifecycleCallbacksMethod.resetDebugInfo(
|
||||
compileElement.nodeIndex, compileElement.sourceAst);
|
||||
if (lifecycleHooks.indexOf(LifecycleHooks.AfterContentInit) !== -1) {
|
||||
@ -40,9 +40,9 @@ export function bindDirectiveAfterContentLifecycleCallbacks(
|
||||
export function bindDirectiveAfterViewLifecycleCallbacks(
|
||||
directiveMeta: CompileDirectiveSummary, directiveInstance: o.Expression,
|
||||
compileElement: CompileElement) {
|
||||
var view = compileElement.view;
|
||||
var lifecycleHooks = directiveMeta.type.lifecycleHooks;
|
||||
var afterViewLifecycleCallbacksMethod = view.afterViewLifecycleCallbacksMethod;
|
||||
const view = compileElement.view;
|
||||
const lifecycleHooks = directiveMeta.type.lifecycleHooks;
|
||||
const afterViewLifecycleCallbacksMethod = view.afterViewLifecycleCallbacksMethod;
|
||||
afterViewLifecycleCallbacksMethod.resetDebugInfo(
|
||||
compileElement.nodeIndex, compileElement.sourceAst);
|
||||
if (lifecycleHooks.indexOf(LifecycleHooks.AfterViewInit) !== -1) {
|
||||
@ -67,7 +67,7 @@ export function bindDirectiveWrapperLifecycleCallbacks(
|
||||
|
||||
export function bindInjectableDestroyLifecycleCallbacks(
|
||||
provider: ProviderAst, providerInstance: o.Expression, compileElement: CompileElement) {
|
||||
var onDestroyMethod = compileElement.view.destroyMethod;
|
||||
const onDestroyMethod = compileElement.view.destroyMethod;
|
||||
onDestroyMethod.resetDebugInfo(compileElement.nodeIndex, compileElement.sourceAst);
|
||||
if (provider.providerType !== ProviderAstType.Directive &&
|
||||
provider.providerType !== ProviderAstType.Component &&
|
||||
@ -78,7 +78,7 @@ export function bindInjectableDestroyLifecycleCallbacks(
|
||||
|
||||
export function bindPipeDestroyLifecycleCallbacks(
|
||||
pipeMeta: CompilePipeSummary, pipeInstance: o.Expression, view: CompileView) {
|
||||
var onDestroyMethod = view.destroyMethod;
|
||||
const onDestroyMethod = view.destroyMethod;
|
||||
if (pipeMeta.type.lifecycleHooks.indexOf(LifecycleHooks.OnDestroy) !== -1) {
|
||||
onDestroyMethod.addStmt(pipeInstance.callMethod('ngOnDestroy', []).toStmt());
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ export function bindDirectiveInputs(
|
||||
});
|
||||
const isOnPushComp = directiveAst.directive.isComponent &&
|
||||
!isDefaultChangeDetectionStrategy(directiveAst.directive.changeDetection);
|
||||
let directiveDetectChangesExpr = DirectiveWrapperExpressions.ngDoCheck(
|
||||
const directiveDetectChangesExpr = DirectiveWrapperExpressions.ngDoCheck(
|
||||
directiveWrapperInstance, o.THIS_EXPR, compileElement.renderNode,
|
||||
DetectChangesVars.throwOnChange);
|
||||
const directiveDetectChangesStmt = isOnPushComp ?
|
||||
|
@ -21,8 +21,8 @@ export function getPropertyInView(
|
||||
if (callingView === definedView) {
|
||||
return property;
|
||||
} else {
|
||||
var viewProp: o.Expression = o.THIS_EXPR;
|
||||
var currView: CompileView = callingView;
|
||||
let viewProp: o.Expression = o.THIS_EXPR;
|
||||
let currView: CompileView = callingView;
|
||||
while (currView !== definedView && isPresent(currView.declarationElement.view)) {
|
||||
currView = currView.declarationElement.view;
|
||||
viewProp = viewProp.prop('parentView');
|
||||
@ -64,7 +64,7 @@ export function injectFromViewParentInjector(
|
||||
} else {
|
||||
viewExpr = o.THIS_EXPR.prop('parentView');
|
||||
}
|
||||
let args = [createDiTokenExpression(token), o.THIS_EXPR.prop('parentIndex')];
|
||||
const args = [createDiTokenExpression(token), o.THIS_EXPR.prop('parentIndex')];
|
||||
if (optional) {
|
||||
args.push(o.NULL_EXPR);
|
||||
}
|
||||
|
@ -30,14 +30,14 @@ const CLASS_ATTR = 'class';
|
||||
const STYLE_ATTR = 'style';
|
||||
const NG_CONTAINER_TAG = 'ng-container';
|
||||
|
||||
var parentRenderNodeVar = o.variable('parentRenderNode');
|
||||
var rootSelectorVar = o.variable('rootSelector');
|
||||
const parentRenderNodeVar = o.variable('parentRenderNode');
|
||||
const rootSelectorVar = o.variable('rootSelector');
|
||||
|
||||
export function buildView(
|
||||
view: CompileView, template: TemplateAst[],
|
||||
targetDependencies:
|
||||
Array<ViewClassDependency|ComponentFactoryDependency|DirectiveWrapperDependency>): number {
|
||||
var builderVisitor = new ViewBuilderVisitor(view, targetDependencies);
|
||||
const builderVisitor = new ViewBuilderVisitor(view, targetDependencies);
|
||||
const parentEl =
|
||||
view.declarationElement.isNull() ? view.declarationElement : view.declarationElement.parent;
|
||||
templateVisitAll(builderVisitor, template, parentEl);
|
||||
@ -68,10 +68,10 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||
private _isRootNode(parent: CompileElement): boolean { return parent.view !== this.view; }
|
||||
|
||||
private _addRootNodeAndProject(node: CompileNode) {
|
||||
var projectedNode = _getOuterContainerOrSelf(node);
|
||||
var parent = projectedNode.parent;
|
||||
var ngContentIndex = (<any>projectedNode.sourceAst).ngContentIndex;
|
||||
var viewContainer =
|
||||
const projectedNode = _getOuterContainerOrSelf(node);
|
||||
const parent = projectedNode.parent;
|
||||
const ngContentIndex = (<any>projectedNode.sourceAst).ngContentIndex;
|
||||
const viewContainer =
|
||||
(node instanceof CompileElement && node.hasViewContainer) ? node.viewContainer : null;
|
||||
if (this._isRootNode(parent)) {
|
||||
if (this.view.viewType !== ViewType.COMPONENT) {
|
||||
@ -109,7 +109,7 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||
const view = this.view;
|
||||
if (view.rootNodes.length === 0 ||
|
||||
view.rootNodes[view.rootNodes.length - 1].type !== CompileViewRootNodeType.Node) {
|
||||
var fieldName = `_el_${view.nodes.length}`;
|
||||
const fieldName = `_el_${view.nodes.length}`;
|
||||
view.fields.push(
|
||||
new o.ClassField(fieldName, o.importType(view.genConfig.renderTypes.renderElement)));
|
||||
view.createMethod.addStmt(o.THIS_EXPR.prop(fieldName)
|
||||
@ -129,12 +129,12 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||
return this._visitText(ast, ast.value, parent);
|
||||
}
|
||||
private _visitText(ast: TemplateAst, value: string, parent: CompileElement): o.Expression {
|
||||
var fieldName = `_text_${this.view.nodes.length}`;
|
||||
const fieldName = `_text_${this.view.nodes.length}`;
|
||||
this.view.fields.push(
|
||||
new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderText)));
|
||||
var renderNode = o.THIS_EXPR.prop(fieldName);
|
||||
var compileNode = new CompileNode(parent, this.view, this.view.nodes.length, renderNode, ast);
|
||||
var createRenderNode =
|
||||
const renderNode = o.THIS_EXPR.prop(fieldName);
|
||||
const compileNode = new CompileNode(parent, this.view, this.view.nodes.length, renderNode, ast);
|
||||
const createRenderNode =
|
||||
o.THIS_EXPR.prop(fieldName)
|
||||
.set(ViewProperties.renderer.callMethod(
|
||||
'createText',
|
||||
@ -153,7 +153,7 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||
// the projected nodes originate from a different view, so we don't
|
||||
// have debug information for them...
|
||||
this.view.createMethod.resetDebugInfo(null, ast);
|
||||
var parentRenderNode = this._getParentRenderNode(parent);
|
||||
const parentRenderNode = this._getParentRenderNode(parent);
|
||||
if (parentRenderNode !== o.NULL_EXPR) {
|
||||
this.view.createMethod.addStmt(
|
||||
o.THIS_EXPR.callMethod('projectNodes', [parentRenderNode, o.literal(ast.index)])
|
||||
@ -175,11 +175,11 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||
}
|
||||
|
||||
visitElement(ast: ElementAst, parent: CompileElement): any {
|
||||
var nodeIndex = this.view.nodes.length;
|
||||
var createRenderNodeExpr: o.Expression;
|
||||
var debugContextExpr = this.view.createMethod.resetDebugInfoExpr(nodeIndex, ast);
|
||||
var directives = ast.directives.map(directiveAst => directiveAst.directive);
|
||||
var component = directives.find(directive => directive.isComponent);
|
||||
const nodeIndex = this.view.nodes.length;
|
||||
let createRenderNodeExpr: o.Expression;
|
||||
const debugContextExpr = this.view.createMethod.resetDebugInfoExpr(nodeIndex, ast);
|
||||
const directives = ast.directives.map(directiveAst => directiveAst.directive);
|
||||
const component = directives.find(directive => directive.isComponent);
|
||||
if (ast.name === NG_CONTAINER_TAG) {
|
||||
createRenderNodeExpr = ViewProperties.renderer.callMethod(
|
||||
'createTemplateAnchor', [this._getParentRenderNode(parent), debugContextExpr]);
|
||||
@ -201,20 +201,20 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||
]);
|
||||
}
|
||||
}
|
||||
var fieldName = `_el_${nodeIndex}`;
|
||||
const fieldName = `_el_${nodeIndex}`;
|
||||
this.view.fields.push(
|
||||
new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderElement)));
|
||||
this.view.createMethod.addStmt(o.THIS_EXPR.prop(fieldName).set(createRenderNodeExpr).toStmt());
|
||||
|
||||
var renderNode = o.THIS_EXPR.prop(fieldName);
|
||||
const renderNode = o.THIS_EXPR.prop(fieldName);
|
||||
|
||||
var compileElement = new CompileElement(
|
||||
const compileElement = new CompileElement(
|
||||
parent, this.view, nodeIndex, renderNode, ast, component, directives, ast.providers,
|
||||
ast.hasViewContainer, false, ast.references, this.targetDependencies);
|
||||
this.view.nodes.push(compileElement);
|
||||
var compViewExpr: o.ReadPropExpr = null;
|
||||
let compViewExpr: o.ReadPropExpr = null;
|
||||
if (isPresent(component)) {
|
||||
let nestedComponentIdentifier =
|
||||
const nestedComponentIdentifier =
|
||||
new CompileIdentifierMetadata({name: getViewClassName(component, 0)});
|
||||
this.targetDependencies.push(
|
||||
new ViewClassDependency(component.type, nestedComponentIdentifier));
|
||||
@ -245,8 +245,8 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||
}
|
||||
|
||||
visitEmbeddedTemplate(ast: EmbeddedTemplateAst, parent: CompileElement): any {
|
||||
var nodeIndex = this.view.nodes.length;
|
||||
var fieldName = `_anchor_${nodeIndex}`;
|
||||
const nodeIndex = this.view.nodes.length;
|
||||
const fieldName = `_anchor_${nodeIndex}`;
|
||||
this.view.fields.push(
|
||||
new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderComment)));
|
||||
this.view.createMethod.addStmt(
|
||||
@ -258,19 +258,19 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||
this.view.createMethod.resetDebugInfoExpr(nodeIndex, ast)
|
||||
]))
|
||||
.toStmt());
|
||||
var renderNode = o.THIS_EXPR.prop(fieldName);
|
||||
const renderNode = o.THIS_EXPR.prop(fieldName);
|
||||
|
||||
var templateVariableBindings = ast.variables.map(
|
||||
const templateVariableBindings = ast.variables.map(
|
||||
varAst => [varAst.value.length > 0 ? varAst.value : IMPLICIT_TEMPLATE_VAR, varAst.name]);
|
||||
|
||||
var directives = ast.directives.map(directiveAst => directiveAst.directive);
|
||||
var compileElement = new CompileElement(
|
||||
const directives = ast.directives.map(directiveAst => directiveAst.directive);
|
||||
const compileElement = new CompileElement(
|
||||
parent, this.view, nodeIndex, renderNode, ast, null, directives, ast.providers,
|
||||
ast.hasViewContainer, true, ast.references, this.targetDependencies);
|
||||
this.view.nodes.push(compileElement);
|
||||
|
||||
this.nestedViewCount++;
|
||||
var embeddedView = new CompileView(
|
||||
const embeddedView = new CompileView(
|
||||
this.view.component, this.view.genConfig, this.view.pipeMetas, o.NULL_EXPR,
|
||||
this.view.animations, this.view.viewIndex + this.nestedViewCount, compileElement,
|
||||
templateVariableBindings);
|
||||
@ -355,7 +355,7 @@ function _mergeHtmlAndDirectiveAttrs(
|
||||
}
|
||||
|
||||
function _readHtmlAttrs(attrs: AttrAst[]): {[key: string]: string} {
|
||||
var htmlAttrs: {[key: string]: string} = {};
|
||||
const htmlAttrs: {[key: string]: string} = {};
|
||||
attrs.forEach((ast) => { htmlAttrs[ast.name] = ast.value; });
|
||||
return htmlAttrs;
|
||||
}
|
||||
@ -369,7 +369,7 @@ function mergeAttributeValue(attrName: string, attrValue1: string, attrValue2: s
|
||||
}
|
||||
|
||||
function createViewTopLevelStmts(view: CompileView, targetStatements: o.Statement[]) {
|
||||
var nodeDebugInfosVar: o.Expression = o.NULL_EXPR;
|
||||
let nodeDebugInfosVar: o.Expression = o.NULL_EXPR;
|
||||
if (view.genConfig.genDebugInfo) {
|
||||
nodeDebugInfosVar = o.variable(
|
||||
`nodeDebugInfos_${view.component.type.name}${view.viewIndex}`); // fix highlighting: `
|
||||
@ -384,7 +384,7 @@ function createViewTopLevelStmts(view: CompileView, targetStatements: o.Statemen
|
||||
}
|
||||
|
||||
|
||||
var renderCompTypeVar: o.ReadVarExpr =
|
||||
const renderCompTypeVar: o.ReadVarExpr =
|
||||
o.variable(`renderType_${view.component.type.name}`); // fix highlighting: `
|
||||
if (view.viewIndex === 0) {
|
||||
let templateUrlInfo: string;
|
||||
@ -407,15 +407,15 @@ function createViewTopLevelStmts(view: CompileView, targetStatements: o.Statemen
|
||||
.toDeclStmt(o.importType(resolveIdentifier(Identifiers.RenderComponentType))));
|
||||
}
|
||||
|
||||
var viewClass = createViewClass(view, renderCompTypeVar, nodeDebugInfosVar);
|
||||
const viewClass = createViewClass(view, renderCompTypeVar, nodeDebugInfosVar);
|
||||
targetStatements.push(viewClass);
|
||||
}
|
||||
|
||||
function createStaticNodeDebugInfo(node: CompileNode): o.Expression {
|
||||
var compileElement = node instanceof CompileElement ? node : null;
|
||||
var providerTokens: o.Expression[] = [];
|
||||
var componentToken: o.Expression = o.NULL_EXPR;
|
||||
var varTokenEntries: any[] = [];
|
||||
const compileElement = node instanceof CompileElement ? node : null;
|
||||
let providerTokens: o.Expression[] = [];
|
||||
let componentToken: o.Expression = o.NULL_EXPR;
|
||||
const varTokenEntries: any[] = [];
|
||||
if (isPresent(compileElement)) {
|
||||
providerTokens = compileElement.getProviderTokens();
|
||||
if (isPresent(compileElement.component)) {
|
||||
@ -441,7 +441,7 @@ function createStaticNodeDebugInfo(node: CompileNode): o.Expression {
|
||||
function createViewClass(
|
||||
view: CompileView, renderCompTypeVar: o.ReadVarExpr,
|
||||
nodeDebugInfosVar: o.Expression): o.ClassStmt {
|
||||
var viewConstructorArgs = [
|
||||
const viewConstructorArgs = [
|
||||
new o.FnParam(
|
||||
ViewConstructorVars.viewUtils.name, o.importType(resolveIdentifier(Identifiers.ViewUtils))),
|
||||
new o.FnParam(
|
||||
@ -450,7 +450,7 @@ function createViewClass(
|
||||
new o.FnParam(ViewConstructorVars.parentIndex.name, o.NUMBER_TYPE),
|
||||
new o.FnParam(ViewConstructorVars.parentElement.name, o.DYNAMIC_TYPE)
|
||||
];
|
||||
var superConstructorArgs = [
|
||||
const superConstructorArgs = [
|
||||
o.variable(view.className), renderCompTypeVar, ViewTypeEnum.fromValue(view.viewType),
|
||||
ViewConstructorVars.viewUtils, ViewConstructorVars.parentView, ViewConstructorVars.parentIndex,
|
||||
ViewConstructorVars.parentElement,
|
||||
@ -464,7 +464,7 @@ function createViewClass(
|
||||
'declaredViewContainer', o.importType(resolveIdentifier(Identifiers.ViewContainer))));
|
||||
superConstructorArgs.push(o.variable('declaredViewContainer'));
|
||||
}
|
||||
var viewMethods = [
|
||||
const viewMethods = [
|
||||
new o.ClassMethod(
|
||||
'createInternal', [new o.FnParam(rootSelectorVar.name, o.STRING_TYPE)],
|
||||
generateCreateMethod(view),
|
||||
@ -488,9 +488,9 @@ function createViewClass(
|
||||
generateVisitRootNodesMethod(view), generateVisitProjectableNodesMethod(view),
|
||||
generateCreateEmbeddedViewsMethod(view)
|
||||
].filter((method) => method.body.length > 0);
|
||||
var superClass = view.genConfig.genDebugInfo ? Identifiers.DebugAppView : Identifiers.AppView;
|
||||
const superClass = view.genConfig.genDebugInfo ? Identifiers.DebugAppView : Identifiers.AppView;
|
||||
|
||||
var viewClass = createClassStmt({
|
||||
const viewClass = createClassStmt({
|
||||
name: view.className,
|
||||
parent: o.importExpr(resolveIdentifier(superClass), [getContextType(view)]),
|
||||
parentArgs: superConstructorArgs,
|
||||
@ -512,8 +512,8 @@ function generateDestroyMethod(view: CompileView): o.Statement[] {
|
||||
}
|
||||
|
||||
function generateCreateMethod(view: CompileView): o.Statement[] {
|
||||
var parentRenderNodeExpr: o.Expression = o.NULL_EXPR;
|
||||
var parentRenderNodeStmts: any[] = [];
|
||||
let parentRenderNodeExpr: o.Expression = o.NULL_EXPR;
|
||||
let parentRenderNodeStmts: any[] = [];
|
||||
if (view.viewType === ViewType.COMPONENT) {
|
||||
parentRenderNodeExpr =
|
||||
ViewProperties.renderer.callMethod('createViewRoot', [o.THIS_EXPR.prop('parentElement')]);
|
||||
@ -522,7 +522,7 @@ function generateCreateMethod(view: CompileView): o.Statement[] {
|
||||
.toDeclStmt(
|
||||
o.importType(view.genConfig.renderTypes.renderNode), [o.StmtModifier.Final])];
|
||||
}
|
||||
var resultExpr: o.Expression;
|
||||
let resultExpr: o.Expression;
|
||||
if (view.viewType === ViewType.HOST) {
|
||||
const hostEl = <CompileElement>view.nodes[0];
|
||||
resultExpr =
|
||||
@ -532,7 +532,7 @@ function generateCreateMethod(view: CompileView): o.Statement[] {
|
||||
} else {
|
||||
resultExpr = o.NULL_EXPR;
|
||||
}
|
||||
let allNodesExpr: o.Expression =
|
||||
const allNodesExpr: o.Expression =
|
||||
ViewProperties.renderer.cast(o.DYNAMIC_TYPE)
|
||||
.prop('directRenderer')
|
||||
.conditional(o.NULL_EXPR, o.literalArr(view.nodes.map(node => node.renderNode)));
|
||||
@ -552,7 +552,7 @@ function generateCreateMethod(view: CompileView): o.Statement[] {
|
||||
}
|
||||
|
||||
function generateDetectChangesMethod(view: CompileView): o.Statement[] {
|
||||
var stmts: any[] = [];
|
||||
const stmts: any[] = [];
|
||||
if (view.animationBindingsMethod.isEmpty() && view.detectChangesInInputsMethod.isEmpty() &&
|
||||
view.updateContentQueriesMethod.isEmpty() &&
|
||||
view.afterContentLifecycleCallbacksMethod.isEmpty() &&
|
||||
@ -568,7 +568,7 @@ function generateDetectChangesMethod(view: CompileView): o.Statement[] {
|
||||
viewContainer.callMethod('detectChangesInNestedViews', [DetectChangesVars.throwOnChange])
|
||||
.toStmt());
|
||||
});
|
||||
var afterContentStmts = view.updateContentQueriesMethod.finish().concat(
|
||||
const afterContentStmts = view.updateContentQueriesMethod.finish().concat(
|
||||
view.afterContentLifecycleCallbacksMethod.finish());
|
||||
if (afterContentStmts.length > 0) {
|
||||
stmts.push(new o.IfStmt(o.not(DetectChangesVars.throwOnChange), afterContentStmts));
|
||||
@ -577,14 +577,14 @@ function generateDetectChangesMethod(view: CompileView): o.Statement[] {
|
||||
view.viewChildren.forEach((viewChild) => {
|
||||
stmts.push(viewChild.callMethod('detectChanges', [DetectChangesVars.throwOnChange]).toStmt());
|
||||
});
|
||||
var afterViewStmts =
|
||||
const afterViewStmts =
|
||||
view.updateViewQueriesMethod.finish().concat(view.afterViewLifecycleCallbacksMethod.finish());
|
||||
if (afterViewStmts.length > 0) {
|
||||
stmts.push(new o.IfStmt(o.not(DetectChangesVars.throwOnChange), afterViewStmts));
|
||||
}
|
||||
|
||||
var varStmts: any[] = [];
|
||||
var readVars = o.findReadVarNames(stmts);
|
||||
const varStmts: any[] = [];
|
||||
const readVars = o.findReadVarNames(stmts);
|
||||
if (readVars.has(DetectChangesVars.changed.name)) {
|
||||
varStmts.push(DetectChangesVars.changed.set(o.literal(true)).toDeclStmt(o.BOOL_TYPE));
|
||||
}
|
||||
@ -613,7 +613,7 @@ function getContextType(view: CompileView): o.Type {
|
||||
}
|
||||
|
||||
function getChangeDetectionMode(view: CompileView): ChangeDetectorStatus {
|
||||
var mode: ChangeDetectorStatus;
|
||||
let mode: ChangeDetectorStatus;
|
||||
if (view.viewType === ViewType.COMPONENT) {
|
||||
mode = isDefaultChangeDetectionStrategy(view.component.changeDetection) ?
|
||||
ChangeDetectorStatus.CheckAlways :
|
||||
|
Reference in New Issue
Block a user