UNPKG

solidity-antlr4

Version:

Solidity Lang Lexer and Parser by official ANTLR4 grammar

28 lines (27 loc) 974 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VariableDeclarationTuple = void 0; var _base = require("../base.cjs"); var _antlr = require("../../antlr4/index.cjs"); const isVarCtx = ctx => ctx instanceof _antlr.VariableDeclarationContext; const VariableDeclarationTuple = class extends _base.BaseNodeList { type = "VariableDeclarationTuple"; constructor(ctx, visitor) { const list = []; const children = ctx.children ?? []; for (let index = 0; index < children.length; index += 1) { const current = children[index]; const next = children[index + 1]; if (!next) continue; if (!isVarCtx(current) && isVarCtx(next)) { list.push(next); } else if (!isVarCtx(current) && !isVarCtx(next)) { list.push(null); } } super(list, visitor, current => current === null ? null : current.accept(visitor)); } }; exports.VariableDeclarationTuple = VariableDeclarationTuple;