Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AST normalization: store multiple identifiers per declaration instead of multiplying the declaration #320

Merged

Conversation

Schottkyc137
Copy link
Contributor

For example, the declaration

signal a, b : std_logic;

would previously be stores as two separate declarations as if they had been declared like this:

signal a: std_logic;
signal b: std_logic;

Now, the AST element contains both identifiers.
This change is mostly for internal purposes. The only noticeable change is that hovers will now produce the former version, instead of the latter where applicable.

@Schottkyc137
Copy link
Contributor Author

@kraigher for this change I had to change the implementation of FoundDeclaration a bit. Effectively, instead of a single enum, this is now a struct defined as follows:

pub struct FoundDeclaration<'a> {
    pub reference: &'a Reference,
    pub ast: DeclarationItem<'a>,
}

and a declaration with multiple identifiers will emit multiple FoundDeclarations with different idents each, but the same AST element. Do you think, this change is ok? This is the best solutions I came up with for storing the AST as it occurs in the source file.

@Schottkyc137 Schottkyc137 merged commit f5546fa into VHDL-LS:master Jul 21, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant