@gnus.ai/upgrade-safe-transpiler-diamond
Version:
Solidity preprocessor used to generate OpenZeppelin Contracts Upgrade Safe using Diamond Pattern (EIP-2535).
14 lines (13 loc) • 432 B
text/typescript
import {Node} from "solidity-ast/node";
import {findAll} from "solidity-ast/utils";
export function* findAllIdentifiers(node: Node) {
const seen = new Set();
for (const id of findAll(['UserDefinedTypeName', 'IdentifierPath', 'Identifier'], node)) {
if ('pathNode' in id && id.pathNode !== undefined) {
seen.add(id.pathNode);
}
if (!seen.has(id)) {
yield id;
}
}
}