MaxID returns the upper-bound, non-inclusive, of ids present within the AST's Expr value.
(a *AST)
| 151 | |
| 152 | // MaxID returns the upper-bound, non-inclusive, of ids present within the AST's Expr value. |
| 153 | func MaxID(a *AST) int64 { |
| 154 | visitor := &maxIDVisitor{maxID: 1} |
| 155 | PostOrderVisit(a.Expr(), visitor) |
| 156 | for id, call := range a.SourceInfo().MacroCalls() { |
| 157 | PostOrderVisit(call, visitor) |
| 158 | if id > visitor.maxID { |
| 159 | visitor.maxID = id + 1 |
| 160 | } |
| 161 | } |
| 162 | return visitor.maxID + 1 |
| 163 | } |
| 164 | |
| 165 | // IDs returns the set of AST node IDs, including macro calls. |
| 166 | func (a *AST) IDs() map[int64]bool { |