Revert "refactor(ivy): clean up (#23899)"

This reverts commit 856ee73464.
This commit is contained in:
Victor Berchet 2018-06-06 13:38:13 -07:00
parent 31988a6ff9
commit 24ab0a7db0
2 changed files with 6 additions and 3 deletions

View File

@ -315,12 +315,12 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
this._creationCode.push(...i18nMessages); this._creationCode.push(...i18nMessages);
} }
const isEmptyElement = element.outputs.length === 0 && element.children.length === 0; let isSelfClosingElement = element.outputs.length === 0 && element.children.length === 0;
const implicit = o.variable(CONTEXT_NAME); const implicit = o.variable(CONTEXT_NAME);
if (isEmptyElement) { if (isSelfClosingElement) {
this.instruction( this.instruction(
this._creationCode, element.sourceSpan, R3.element, ...trimTrailingNulls(parameters)); this._creationCode, element.sourceSpan, R3.element, ...trimTrailingNulls(parameters));
} else { } else {
@ -377,7 +377,7 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
t.visitAll(this, element.children); t.visitAll(this, element.children);
} }
if (!isEmptyElement) { if (!isSelfClosingElement) {
// Finish element construction mode. // Finish element construction mode.
this.instruction( this.instruction(
this._creationCode, element.endSourceSpan || element.sourceSpan, R3.elementEnd); this._creationCode, element.endSourceSpan || element.sourceSpan, R3.elementEnd);

View File

@ -133,12 +133,15 @@ describe('compiler compliance: template', () => {
}; };
const template = ` const template = `
// ...
template:function MyComponent_Template(rf: IDENT, $ctx$: IDENT){ template:function MyComponent_Template(rf: IDENT, $ctx$: IDENT){
if (rf & 1) { if (rf & 1) {
$i0$.ɵEe(0,'div'); $i0$.ɵEe(0,'div');
} }
}`; }`;
debugger;
const result = compile(files, angularFiles); const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template'); expectEmit(result.source, template, 'Incorrect template');