Skip to content

Relax current limitations for UDA syntax parsing. #2924

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

Merged
merged 10 commits into from
Mar 9, 2014

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Dec 4, 2013

Issue 11677 - user defined attributes must be first
Issue 11678 - user defined attributes cannot appear as postfixes
Issue 11679 - user defined attributes not allowed for local auto declarations
Issue 11680 - user defined attributes for type inference

Additionally, I added test cases for ddoc unittest feature to avoid silent breaking.

@WalterBright
Copy link
Member

Being an enhancement, I'm going to leave this for 2.066!

@IgorStepanov
Copy link
Contributor

BTW, why UDAs don't allowed for module declaration?

@reflect!basic module test; //determine the reflection strategy for the "test" module
import my.reflection: reflect, basic;
...

@9rnsr
Copy link
Contributor Author

9rnsr commented Dec 6, 2013

@WalterBright Thanks.

@IgorStepanov Because it is not allowed in grammar. Instead you can use @reflect!basic: immediately after the module declaration.

@IgorStepanov
Copy link
Contributor

Because it is not allowed in grammar.

May be we should allow it? Does fundamental objections aganist it exists?

Instead you can use @reflect!basic: immediately after the module declaration.

No, I need to annotate module, not all module symbols. In my example, I collect data for all symbols to use it in runtime. But I start collect only if scoped symbol annotated with special attribute.
E.g.

@reflect!basic class MyClass //Reflection is on. Information about MyClass members will be saved in special structure
{
   ...
}

@reflect!none class MyClass2 //Reflection is off. Reflection data structure for MyClass2 will be created but will not store any data.
{
   ...
}

class MyClass3 //Reflection is off (by default).
{
   ...
}

class MyClass4 //Reflection is off and MyClass will not know about his members (include MyNestedClass), but Reflection is on for MyNestedClass and it will know about his members
{
   @reflect!basic class MyNestedClass
   {

   }
}

Thus I need to annotate module to say that it should be reflected (or shouldn't).
Of course, this issue (module's UDA) doesn't limited by my task. All times when user need to annotate a class, he may need to annotate the module, because "module" is the same language object as the "class".

@ghost
Copy link

ghost commented Dec 8, 2013

Should we try to use the milestone feature to tag this pull request for 2.066? I'm wondering whether adding some kind of tagging would enable us to quickly see e.g. which pulls need reviewing, which are stalled for later, etc.

@mihails-strasuns
Copy link

@AndrejMitrovic Will also reduce amount of "will it be in next release?" questions. I'd love to see a milestone for every release, but is something that needs to be done by commiters/reviewers.

@9rnsr
Copy link
Contributor Author

9rnsr commented Dec 10, 2013

Added this enhancement in the list of 2.066 targets on Agenda page.

@WalterBright
Copy link
Member

BTW, I don't think we should allow prefixes on module statements. The appearance of module as the first token in the file is handy for detecting D source code.

@dnadlinger
Copy link
Contributor

… except that a module statement isn't mandatory?

Scope *newsc = sc;
if (sc->protection != protection ||
sc->explicitProtection != 1)
if (decl)
Copy link

Choose a reason for hiding this comment

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

Might as well make it:

if (!decl) 
    return;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the style if (decl) { ... } is consistent with other functions style in attrib.c.

@ghost
Copy link

ghost commented Feb 5, 2014

It looks ok, but will probably need another reviewer as there's quite a few changes.

@9rnsr
Copy link
Contributor Author

9rnsr commented Feb 27, 2014

Rebased.

WalterBright added a commit that referenced this pull request Mar 9, 2014
Relax current limitations for UDA syntax parsing.
@WalterBright WalterBright merged commit 8979950 into dlang:master Mar 9, 2014
@9rnsr 9rnsr deleted the fix_uda_parsing branch March 9, 2014 12:33
@9rnsr
Copy link
Contributor Author

9rnsr commented Mar 10, 2014

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants