|
|
@ -45,11 +45,7 @@ export default class EachBlock extends Node {
|
|
|
|
indexes: new Map(block.indexes),
|
|
|
|
indexes: new Map(block.indexes),
|
|
|
|
changeableIndexes: new Map(block.changeableIndexes),
|
|
|
|
changeableIndexes: new Map(block.changeableIndexes),
|
|
|
|
|
|
|
|
|
|
|
|
listName: (
|
|
|
|
listName: this.generator.getUniqueName('each_value'),
|
|
|
|
(this.expression.type === 'MemberExpression' && !this.expression.computed) ? this.expression.property.name :
|
|
|
|
|
|
|
|
this.expression.type === 'Identifier' ? this.expression.name :
|
|
|
|
|
|
|
|
`each_value`
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
indexName: this.index || `${this.context}_index`,
|
|
|
|
indexName: this.index || `${this.context}_index`,
|
|
|
|
|
|
|
|
|
|
|
|
indexNames: new Map(block.indexNames),
|
|
|
|
indexNames: new Map(block.indexNames),
|
|
|
@ -75,14 +71,14 @@ export default class EachBlock extends Node {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.contextProps = [
|
|
|
|
this.contextProps = [
|
|
|
|
`${this.block.listName}: ${this.block.listAlias}`,
|
|
|
|
`${this.block.listName}: ${this.block.listName}`,
|
|
|
|
`${this.context}: ${this.block.listAlias}[#i]`,
|
|
|
|
`${this.context}: ${this.block.listName}[#i]`,
|
|
|
|
`${this.block.indexName}: #i`
|
|
|
|
`${this.block.indexName}: #i`
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
if (this.destructuredContexts) {
|
|
|
|
if (this.destructuredContexts) {
|
|
|
|
for (let i = 0; i < this.destructuredContexts.length; i += 1) {
|
|
|
|
for (let i = 0; i < this.destructuredContexts.length; i += 1) {
|
|
|
|
this.contextProps.push(`${this.destructuredContexts[i]}: ${this.block.listAlias}[#i][${i}]`);
|
|
|
|
this.contextProps.push(`${this.destructuredContexts[i]}: ${this.block.listName}[#i][${i}]`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -117,7 +113,7 @@ export default class EachBlock extends Node {
|
|
|
|
const each = this.var;
|
|
|
|
const each = this.var;
|
|
|
|
|
|
|
|
|
|
|
|
const create_each_block = this.block.name;
|
|
|
|
const create_each_block = this.block.name;
|
|
|
|
const each_block_value = this.block.listAlias;
|
|
|
|
const each_block_value = this.block.listName;
|
|
|
|
const iterations = this.iterations;
|
|
|
|
const iterations = this.iterations;
|
|
|
|
|
|
|
|
|
|
|
|
const needsAnchor = this.next ? !this.next.isDomNode() : !parentNode || !this.parent.isDomNode();
|
|
|
|
const needsAnchor = this.next ? !this.next.isDomNode() : !parentNode || !this.parent.isDomNode();
|
|
|
|