createComponentNodeAndAppend method
Expression
createComponentNodeAndAppend(
- CompileDirectiveMetadata parentComponent,
- CompileDirectiveMetadata component,
- CompileElement parent,
- NodeReference elementRef,
- int nodeIndex,
- ElementAst ast,
Implementation
o.Expression createComponentNodeAndAppend(
CompileDirectiveMetadata parentComponent,
CompileDirectiveMetadata component,
CompileElement parent,
NodeReference elementRef,
int nodeIndex,
ElementAst ast,
) {
final componentViewExpr = _createAppViewNodeAndComponent(
parent,
component,
elementRef,
nodeIndex,
ast,
);
final root = componentViewExpr.prop(componentViewRootElementFieldName);
if (isRootNodeOfHost(nodeIndex)) {
// Assign the root element of the component view to a local variable. The
// host view will use this as its root node, or the host element of a root
// view container.
_createMethod.addStmt(elementRef.toWriteStmt(root));
} else {
_initializeAndAppendNode(parent, elementRef, root);
}
_addDataDebugSource(
elementRef,
parentComponent.template?.templateUrl,
(parentComponent.template?.templateOffset ?? 0) +
ast.sourceSpan.start.offset);
return componentViewExpr;
}