GNOME Bugzilla – Bug 566863
vala semantic analyser turns abstract syntax tree into abstract syntax DAG
Last modified: 2018-05-22 13:14:09 UTC
the semantic analyser contains code that turns the AST into a non-tree directed acyclic graph. if you have a function defined: void func (bool arg = true); and later: void func2 () { func (); } then the semantic analyser turns that into: void func2 () { func (true); } but it does so without copying the "true". the "true" here is actually the "true" from the function declaration (including sharing its source_reference). more to the point, if you set the ccodenode while visiting the first true, then when you arrive at the second true you will find that it has already been set. this is pretty harmless, but it means the AST is not really a tree anymore. it may also confuse code generators (because of the ccodenode thing).
it also does it in the case that you have function bodies in the vapi, in which case it copies the entire function body. both of these cases are being compiled multiple times under the current visitor setup.
In the first case we might want to clone the AST nodes. Are you sure about the second case? I know that we visit the same AST nodes multiple times in the code generator in this case, but we never actually inline the bodies of the VAPI methods in the AST, if I remember correctly.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/20.