-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
Tag name space #12567
Conversation
|
Thanks for your pull request, @WalterBright! Bugzilla referencesYour 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 locallyIf 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); | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise here, see issue.
By prefixing tag names with
__tab, a separate name space can be created for them without having to create a separate symbol table.