melt-umn / silver

An attribute grammar-based programming language for composable language extensions
http://melt.cs.umn.edu/silver/
GNU Lesser General Public License v3.0
58 stars 7 forks source link

Add utilities for use in debugger, to check whether a child/local is decorable #824

Closed krame505 closed 8 months ago

krame505 commented 8 months ago

Changes

Requested by Matthew, add a way to access children/locals on a DecoratedNode without knowing whether they should be decorated or not. In the translation we always know this statically, and can call getChildAsIs or getChildDecorated where appropriate, but in the runtime this is not available e.g. for a debugger.

This adds isChildDecorable/isLocalDecorable methods on Node, and child/local methods on DecoratedNode to do so. These are not otherwise used in the Java translation so they shouldn't impose additional overhead.

Documentation

Purely an internal change to the runtime API - added javadoc comments.

Testing

Added asserts on createDecoratedChild/evalLocalDecorated and ensured this works as expected when deep-rebuilding Silver.