Skip to content

attr: decls doesn't attach attribute to the decls #73

Open

Description

@adamdruppe
$ dscanner --ast


@test void foo();


<?xml version="1.0"?>
<module>
<declaration>
<attribute>
<atAttribute>
<identifier>test</identifier>
</atAttribute>
</attribute>
<functionDeclaration line="1">
<name>foo</name><type pretty="void">
<type2>void</type2>
</type>
<parameters>
</parameters>
</functionDeclaration>
</declaration>
</module>

Yet:

$ dscanner --ast


@test: void foo();


<?xml version="1.0"?>
<module>
<declaration>
<attributeDeclaration>
<attribute>
<atAttribute>
<identifier>test</identifier>
</atAttribute>
</attribute>
</attributeDeclaration>
</declaration>
<declaration>
<functionDeclaration line="1">
<name>foo</name><type pretty="void">
<type2>void</type2>
</type>
<parameters>
</parameters>
</functionDeclaration>
</declaration>
</module>

Notice that the first one has the attribute inside the declaration, but the second one has it in a different declaration.

I think the way dmd does this is the colon starts a declaration list and the attribute is attached to everything in that list. Does the same with privacy keywords btw.

But, I think dmd also does that attachment as part of semantic analysis, so I'm not sure this is a bug strictly speaking... but I'd like to be sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions