refactor(compiler): misc minor refactor / cleanup (#19189)

PR Close #19189
This commit is contained in:
Victor Berchet
2017-08-16 16:29:39 -07:00
committed by Igor Minar
parent 473a577e34
commit 34fdb91899
6 changed files with 46 additions and 96 deletions

View File

@ -7,21 +7,21 @@
*/
import {BindingDef, BindingFlags, NodeDef, NodeFlags, TextData, ViewData, asTextData} from './types';
import {calcBindingFlags, checkAndUpdateBinding, getParentRenderElement} from './util';
import {checkAndUpdateBinding, getParentRenderElement} from './util';
export function textDef(ngContentIndex: number, constants: string[]): NodeDef {
const bindings: BindingDef[] = new Array(constants.length - 1);
for (let i = 1; i < constants.length; i++) {
export function textDef(ngContentIndex: number, staticText: string[]): NodeDef {
const bindings: BindingDef[] = new Array(staticText.length - 1);
for (let i = 1; i < staticText.length; i++) {
bindings[i - 1] = {
flags: BindingFlags.TypeProperty,
name: null,
ns: null,
nonMinifiedName: null,
securityContext: null,
suffix: constants[i]
suffix: staticText[i],
};
}
const flags = NodeFlags.TypeText;
return {
// will bet set by the view definition
index: -1,
@ -30,7 +30,7 @@ export function textDef(ngContentIndex: number, constants: string[]): NodeDef {
bindingIndex: -1,
outputIndex: -1,
// regular values
flags,
flags: NodeFlags.TypeText,
childFlags: 0,
directChildFlags: 0,
childMatchedQueries: 0,
@ -38,13 +38,13 @@ export function textDef(ngContentIndex: number, constants: string[]): NodeDef {
matchedQueryIds: 0,
references: {}, ngContentIndex,
childCount: 0, bindings,
bindingFlags: calcBindingFlags(bindings),
bindingFlags: BindingFlags.TypeProperty,
outputs: [],
element: null,
provider: null,
text: {prefix: constants[0]},
text: {prefix: staticText[0]},
query: null,
ngContent: null
ngContent: null,
};
}