-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Problem
Currently, plugins in brighterscript may create AST nodes using internal constructors, which can become outdated or incompatible as brighterscript evolves. This poses a risk because plugins may inadvertently construct old or broken versions of AST nodes if they're not using the latest creators directly from the core brighterscript package.
This issue was highlighted in rokucommunity/rooibos#358, where mixing versions between rooibos (which bundled its own bsc) and the host brighterscript led to malformed test output. The root cause was the plugin constructing AST nodes with outdated logic.
Proposal
Expose all of brighterscript's AST creator functions (such as for ClassStatement, MethodStatement, DottedGetExpression, etc.) to the plugin API surface. This ensures that plugins can reliably create up-to-date AST nodes, preventing subtle bugs caused by mismatched structures and eliminating the need for hacky workarounds (like leveraging hidden constructors).
Benefit
- Plugins will always generate AST consistent with the host's current brighterscript version.
- Avoids subtle breakages and hard-to-debug issues for plugin maintainers.
- Makes brighterscript's plugin API more robust and future-proof.
Reference
See the context and workaround discussion in rokucommunity/rooibos#358.