Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

fix(struct-alias): Support struct typedef aliasing #58

Merged
merged 2 commits into from
Jun 16, 2022

Conversation

bengreenier
Copy link
Contributor

This adds support for

typedef struct MyStruct { int fieldA; } MyStruct;
typedef struct MyStruct AliasToMyStruct;

such that AliasToMyStruct is parsed properly.

Previously, we'd relied on elaborated type parsing for typedefs assuming that we'd process all necessary children. However, given that struct is included in the alias definition, it incorrectly triggers that assumption and is then never processed.

This fix compares a simpleDesugar-ed type name with the current cursor symbolName and if they don't align, identifies it as the alias case, and generates the alias as expected (e.g. type AliasToMyStruct = MyStruct).

@bengreenier bengreenier added the bug Something isn't working label Jun 16, 2022
@@ -14,5 +14,8 @@
"license": "MIT",
"devDependencies": {
"lerna": "^4.0.0"
},
"volta": {
"node": "17.9.1"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adds support for volta correctly

@bengreenier bengreenier enabled auto-merge (squash) June 16, 2022 22:09
@bengreenier bengreenier merged commit 94b867a into main Jun 16, 2022
@bengreenier bengreenier deleted the fix/typedef-struct-alias branch June 16, 2022 22:11
@github-actions github-actions bot mentioned this pull request Jun 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant