UNPKG

solidity-antlr4

Version:

Solidity Lang Lexer and Parser by official ANTLR4 grammar

26 lines (25 loc) 625 B
import { BaseNodeString } from "../base.js"; export class StateMutability extends BaseNodeString { // type = 'StateMutability' as const; name = null; constructor(ctx, visitor) { super(ctx, visitor); const format = (n) => { if (Array.isArray(n) && !!n.length) { return true; } else if (!!n) { return true; } return false; }; if (format(ctx.Payable?.())) { this.name = "payable"; } else if (format(ctx.Pure?.())) { this.name = "pure"; } else if (format(ctx.View?.())) { this.name = "view"; } else { this.name = null; } } }