···
const loopId = t.identifier(`loop_${this.depth}`);
const iterId = t.identifier(`iter_${this.depth}`);
const indexId = t.identifier(`index_${this.depth}`);
-
const lastIndex = t.memberExpression(ids.state, t.identifier('index'));
if (quantifier && !quantifier.singular && quantifier.required) {
···
t.updateExpression('++', iterId),
-
t.variableDeclaration('var', [
-
t.variableDeclarator(indexId, lastIndex),
...this.childNode.statements(),
···
-
t.variableDeclaration('var', [
-
t.variableDeclarator(indexId, lastIndex),
...this.childNode.statements(),
} else if (quantifier && !quantifier.required) {
-
t.variableDeclaration('var', [
-
t.variableDeclarator(indexId, lastIndex),
-
...this.childNode.statements(),
statements = this.childNode.statements();
···
constructor(ast, nameNode, transformNode) {
const indexId = t.identifier('last_index');
this.returnStatement = t.returnStatement(
-
transformNode ? t.callExpression(transformNode, [ids.node]) : ids.node
-
this.nameNode = nameNode;
this.node = new AlternationNode(ast, 0, {
returnStatement: this.returnStatement,
restoreIndex: new RestoreIndexNode(indexId, true),
···
-
const indexId = t.identifier('last_index');
-
const lastIndex = t.memberExpression(ids.state, t.identifier('index'));
t.variableDeclaration('var', [
t.variableDeclarator(ids.match),
-
t.variableDeclarator(indexId, lastIndex),
-
t.callExpression(ids.tag, [t.arrayExpression(), this.nameNode])
...this.node.statements(),
···
const loopId = t.identifier(`loop_${this.depth}`);
const iterId = t.identifier(`iter_${this.depth}`);
const indexId = t.identifier(`index_${this.depth}`);
+
const assignIndex = new AssignIndexNode(indexId);
if (quantifier && !quantifier.singular && quantifier.required) {
···
t.updateExpression('++', iterId),
+
assignIndex.statement(),
...this.childNode.statements(),
···
+
assignIndex.statement(),
...this.childNode.statements(),
} else if (quantifier && !quantifier.required) {
+
statements = [assignIndex.statement(), ...this.childNode.statements()];
statements = this.childNode.statements();
···
constructor(ast, nameNode, transformNode) {
const indexId = t.identifier('last_index');
+
const node = t.callExpression(ids.tag, [ids.node, nameNode]);
this.returnStatement = t.returnStatement(
+
transformNode ? t.callExpression(transformNode, [node]) : node
+
this.assignIndex = new AssignIndexNode(indexId);
this.node = new AlternationNode(ast, 0, {
returnStatement: this.returnStatement,
restoreIndex: new RestoreIndexNode(indexId, true),
···
+
this.assignIndex.statement(),
t.variableDeclaration('var', [
t.variableDeclarator(ids.match),
+
t.variableDeclarator(ids.node, t.arrayExpression()),
...this.node.statements(),