ceylon/ceylon-spec — pull request #640 by tombentley (2013-04-23 10:16:34+00:00)
Title: Annotations

@gavinking, you're right, that last pull request *was* a PoS. I'd meant to rename the the classes but forgot. Sorry about that.

In this one I've included the Visitor I was using in the compiler which actually sets that property of `Method`. I'm sure you'll be able to improve it though.

The gist of it is that *currently* annotation constructors are only allowed to contain one statement: A `return` whose expression is the instantiation of an annotation class. And that instantiation is only allowed to have a few kinds of argument

* Literals (or `true`/`false`)

annotation Foo foo() => Foo("A literal string");

* Arguments that are parameters of the constructor

annotation Doc doc(String description) => Doc(description);

* Spread arguments that are parameters of the constructor

annotation See see(Anything* elements) => See(*elements);

I'm not sure we *really* need spread, and I think we could support other kinds of argument too, but since we're probably going to need to support another transformation for annotations anyway (e.g. using static fields/getters or whatever), I wanted to keep this fairly simple to start off with.