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

Tag name space #12567

Merged
merged 2 commits into from
May 23, 2021
Merged

Tag name space #12567

merged 2 commits into from
May 23, 2021

Conversation

WalterBright
Copy link
Member

By prefixing tag names with __tab, a separate name space can be created for them without having to create a separate symbol table.

@WalterBright WalterBright added Review:Easy Review Feature:ImportC Pertaining to ImportC support labels May 23, 2021
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#12567"

@@ -2623,7 +2623,7 @@ final class CParser(AST) : Parser!AST
nextToken();
}

auto etag = new AST.EnumDeclaration(loc, tag, AST.Type.tint32);
auto etag = new AST.EnumDeclaration(loc, toTagIdentifier(tag), AST.Type.tint32);
Copy link
Member

Choose a reason for hiding this comment

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

FYI, this should be pooled in a symtab to avoid false duplicate errors.

https://issues.dlang.org/show_bug.cgi?id=21932

Copy link
Member Author

Choose a reason for hiding this comment

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

That's the job of the semantic routines, not the parser.

Copy link
Member

Choose a reason for hiding this comment

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

As we know you can't use a symbol without declaration or prototype, type/symbol merging in the parser is safe so long as it's not a redefinition (and saves memory). This is also required for attributes to work too.

@@ -2723,7 +2723,7 @@ final class CParser(AST) : Parser!AST
nextToken();
}

auto stag = new AST.StructDeclaration(loc, tag, false);
auto stag = new AST.StructDeclaration(loc, toTagIdentifier(tag), false);
Copy link
Member

Choose a reason for hiding this comment

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

Likewise here, see issue.

@dlang-bot dlang-bot merged commit 4033b91 into dlang:master May 23, 2021
@WalterBright WalterBright deleted the TagNameSpace branch June 27, 2021 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants