Skip to content

Commit

Permalink
create key before testing for the existence of key. doh
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed May 2, 2018
1 parent 7f58701 commit 3f012bb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/compile/nodes/EachBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ export default class EachBlock extends Node {
this.scope.add(context.key.name, this.expression.dependencies);
});

this.key = info.key
? new Expression(compiler, this, this.scope, info.key)
: null;

if (this.index) {
// index can only change if this is a keyed each block
const dependencies = this.key ? this.expression.dependencies : [];
this.scope.add(this.index, dependencies);
}

this.key = info.key
? new Expression(compiler, this, this.scope, info.key)
: null;

this.children = mapChildren(compiler, this, this.scope, info.children);

this.else = info.else
Expand Down

0 comments on commit 3f012bb

Please sign in to comment.