compiler: Add a DebugHook expression

You can not create this expression manually, but there
is a pass in the compiler that adds it to all set
properties in a compilation run.

All it does is basically associate an id with an expression,
so that we can then in a later step have the interpreter do
something with that information. Apart from that, it tries to
be as transparent as possible.

The LLR lowering removes that expression again, just so we can
be sure it does not end up in the generated live code.
This commit is contained in:
Tobias Hunger 2025-03-26 11:20:41 +00:00 committed by Tobias Hunger
parent e613ffb319
commit aaeb4a0df5
16 changed files with 147 additions and 23 deletions

View file

@ -641,6 +641,9 @@ pub struct ElementDebugInfo {
// The id qualified with the enclosing component name. Given `foo := Bar {}` this is `EnclosingComponent::foo`
pub qualified_id: Option<SmolStr>,
pub type_name: String,
// Hold an id for each element that is unique during this build.
// It helps to cross-reference the element in the different build stages the LSP has to deal with.
pub element_id: u64,
pub node: syntax_nodes::Element,
// Field to indicate whether this element was a layout that had
// been lowered into a rectangle in the lower_layouts pass.
@ -997,6 +1000,7 @@ impl Element {
base_type,
debug: vec![ElementDebugInfo {
qualified_id,
element_id: 0,
type_name,
node: node.clone(),
layout: None,