43. AST type ussage collection

The ast_used module implements type collecting infrasturcture. It allows to determine, if enumeration and structure types are used in the code.

All functions and symbols are in “ast_used” module, use require to get access to it.

require daslib/ast_used
OnlyUsedTypes

OnlyUsedTypes fields are

st

table< ast::Structure ?;bool>

en

table< ast::Enumeration ?;bool>

Collection of all structure and enumeration types that are used in the AST.

43.1. Collecting type information

collect_used_types(vfun: array<Function?> const; vvar: array<Variable?> const; blk: block<(usedTypes:OnlyUsedTypes const):void> const)

argument

argument type

vfun

array< ast::Function ?> const

vvar

array< ast::Variable ?> const

blk

block<(usedTypes: ast_used::OnlyUsedTypes const):void> const

Goes through list of functions vfun and variables vvar and collects list of which enumeration and structure types are used in them. Calls blk with said list.