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

TranslationUnitContext uses empty struct as a placeholder for forward declaration #504

Open
ForNeVeR opened this issue Dec 23, 2023 · 0 comments
Labels
area:compiler Related to code compilation or type checking kind:refactor Internal changes not affecting the compiler behavior status:help-wanted Open for contributors

Comments

@ForNeVeR
Copy link
Owner

See this snippet:

if (structType.Members.Count != 0 && structType.Identifier is not null)
{
if (_types.TryGetValue(structType.Identifier, out var existingType))
{
if (existingType is StructType existingStructType && existingStructType.Members.Count == 0)
{
existingStructType.Members = members;
return existingType;
}
}
}

From this, it looks like we use an empty struct (with no members) as a placeholder for a forward declaration, or something similar.

Empty structs is a useful standard extension, and we may choose to implement it later; thus this will break.

We should improve the architecture here and make the placeholder more explicit.

@ForNeVeR ForNeVeR added status:help-wanted Open for contributors area:compiler Related to code compilation or type checking kind:refactor Internal changes not affecting the compiler behavior labels Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:compiler Related to code compilation or type checking kind:refactor Internal changes not affecting the compiler behavior status:help-wanted Open for contributors
Projects
None yet
Development

No branches or pull requests

1 participant