refactor(ivy): split the memory instruction into store and load (#22268)

PR Close #22268
This commit is contained in:
Victor Berchet
2018-02-16 16:58:07 -08:00
parent 3ceee99e22
commit 5a14e2238f
19 changed files with 105 additions and 114 deletions

View File

@ -63,7 +63,7 @@ export class Identifiers {
static interpolation8: o.ExternalReference = {name: 'ɵi8', moduleName: CORE};
static interpolationV: o.ExternalReference = {name: 'ɵiV', moduleName: CORE};
static memory: o.ExternalReference = {name: m', moduleName: CORE};
static load: o.ExternalReference = {name: ld', moduleName: CORE};
static projection: o.ExternalReference = {name: 'ɵP', moduleName: CORE};
static projectionDef: o.ExternalReference = {name: 'ɵpD', moduleName: CORE};

View File

@ -408,7 +408,7 @@ class TemplateDefinitionBuilder implements TemplateAstVisitor, LocalResolver {
// Generate the update temporary.
const variableName = this.bindingScope.freshReferenceName();
this._bindingMode.push(o.variable(variableName, o.INFERRED_TYPE)
.set(o.importExpr(R3.memory).callFn([o.literal(slot)]))
.set(o.importExpr(R3.load).callFn([o.literal(slot)]))
.toDeclStmt(o.INFERRED_TYPE, [o.StmtModifier.Final]));
this.bindingScope.set(reference.name, variableName);
return [reference.name, reference.originalValue];

View File

@ -293,7 +293,7 @@ describe('r3_view_compiler', () => {
$r3$.ɵC(2, $c2$, MyComponent_IfDirective_Template_2);
$r3$.ɵe();
}
const $foo$ = $r3$m(1);
const $foo$ = $r3$ld(1);
IfDirective.ngDirectiveDef.h(3,2);
$r3$.ɵcR(2);
$r3$.ɵr(3,2);
@ -420,7 +420,7 @@ describe('r3_view_compiler', () => {
$r3$.ɵe();
$r3$.ɵT(2);
}
const $user$ = $r3$m(1);
const $user$ = $r3$ld(1);
$r3$.ɵt(2, $r3$.ɵi1('Hello ', $user$.value, '!'));
}
});