UNPKG

@newos/upgradeability-transpiler

Version:

Transpiles Solidity contracts to updgradable versions compatible with NewOs.

18 lines 816 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const ast_utils_1 = require("../solc/ast-utils"); function prependBaseClass(contractNode, source, cls) { const hasInheritance = contractNode.baseContracts.length; const [start, , nodeSource] = ast_utils_1.getNodeSources(contractNode, source); const regExp = RegExp(`\\bcontract\\s+${contractNode.name}(\\s+is)?`); const match = regExp.exec(nodeSource); if (!match) throw new Error(`Can't find ${contractNode.name} in ${nodeSource}`); return { start: start + match.index + match[0].length, end: start + match.index + match[0].length, text: hasInheritance ? ` ${cls},` : ` is ${cls}`, }; } exports.prependBaseClass = prependBaseClass; //# sourceMappingURL=prepend-base-class.js.map