create key before testing for the existence of key. doh

pull/1402/head
Rich Harris 7 years ago
parent 7f58701085
commit 3f012bbdb8

@ -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

Loading…
Cancel
Save