···
const loopId = t.identifier(`loop_${this.depth}`);
const iterId = t.identifier(`iter_${this.depth}`);
const indexId = t.identifier(`index_${this.depth}`);
234
-
const lastIndex = t.memberExpression(ids.state, t.identifier('index'));
234
+
const assignIndex = new AssignIndexNode(indexId);
if (quantifier && !quantifier.singular && quantifier.required) {
···
t.updateExpression('++', iterId),
248
-
t.variableDeclaration('var', [
249
-
t.variableDeclarator(indexId, lastIndex),
248
+
assignIndex.statement(),
...this.childNode.statements(),
···
263
-
t.variableDeclaration('var', [
264
-
t.variableDeclarator(indexId, lastIndex),
261
+
assignIndex.statement(),
...this.childNode.statements(),
} else if (quantifier && !quantifier.required) {
273
-
t.variableDeclaration('var', [
274
-
t.variableDeclarator(indexId, lastIndex),
276
-
...this.childNode.statements(),
268
+
statements = [assignIndex.statement(), ...this.childNode.statements()];
statements = this.childNode.statements();
···
constructor(ast, nameNode, transformNode) {
const indexId = t.identifier('last_index');
376
+
const node = t.callExpression(ids.tag, [ids.node, nameNode]);
this.returnStatement = t.returnStatement(
387
-
transformNode ? t.callExpression(transformNode, [ids.node]) : ids.node
379
+
transformNode ? t.callExpression(transformNode, [node]) : node
390
-
this.nameNode = nameNode;
382
+
this.assignIndex = new AssignIndexNode(indexId);
this.node = new AlternationNode(ast, 0, {
returnStatement: this.returnStatement,
restoreIndex: new RestoreIndexNode(indexId, true),
···
402
-
const indexId = t.identifier('last_index');
403
-
const lastIndex = t.memberExpression(ids.state, t.identifier('index'));
395
+
this.assignIndex.statement(),
t.variableDeclaration('var', [
t.variableDeclarator(ids.match),
408
-
t.variableDeclarator(indexId, lastIndex),
409
-
t.variableDeclarator(
411
-
t.callExpression(ids.tag, [t.arrayExpression(), this.nameNode])
398
+
t.variableDeclarator(ids.node, t.arrayExpression()),
...this.node.statements(),