skip array literal length optimization in presence of spread (#2325)

pull/2326/head
Conduitry 6 years ago
parent e527b0424a
commit ecea85891c

@ -92,9 +92,11 @@ export default class EachBlockWrapper extends Wrapper {
this.index_name = this.node.index || renderer.component.get_unique_name(`${this.node.context}_index`);
const fixed_length = node.expression.node.type === 'ArrayExpression'
? node.expression.node.elements.length
: null;
const fixed_length =
node.expression.node.type === 'ArrayExpression' &&
node.expression.node.elements.every(element => element.type !== 'SpreadElement')
? node.expression.node.elements.length
: null;
// hack the sourcemap, so that if data is missing the bug
// is easy to find
@ -508,4 +510,4 @@ export default class EachBlockWrapper extends Wrapper {
block.builders.destroy.add_block(`@destroy_each(${iterations}, detaching);`);
}
}
}

Loading…
Cancel
Save