feat(ivy): select instruction now generated in front of all relevant instructions (#29546)

PR Close #29546
This commit is contained in:
Ben Lesh
2019-03-27 09:30:05 -07:00
committed by Miško Hevery
parent dd69e4e780
commit 96b800c8bc
10 changed files with 57 additions and 2 deletions

View File

@ -122,9 +122,10 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
private _updateCodeFns: (() => o.Statement)[] = [];
/**
* Memorizes the last node index for which a select instruction has been generated.
* Initialized to 0 to avoid generating a useless select(0).
* We're initializing this to -1 to ensure the `select(0)` instruction is generated before any
* relevant update instructions.
*/
private _lastNodeIndexWithFlush: number = 0;
private _lastNodeIndexWithFlush: number = -1;
/** Temporary variable declarations generated from visiting pipes, literals, etc. */
private _tempVariables: o.Statement[] = [];
/**