google/traceur-compiler — pull request #660 by tpodom (2014-01-12 17:05:05+00:00)
Title: Annotations & type assertions extensions

Added new extensions to support annotations on classes, functions, and parameters. Annotations are written in the Java style of @Annotation(param). They can appear before a class or function declaration, class elements as well as formal parameters. The annotations on the class/function declarations and class elements are written out to an annotations property array on the element. Annotations on formal parameters are written out in a parameters two dimensional array (one array per-parameter) on the parent element.

For example:
```javascript
@Anno
class Test {
@Anno
method(@Anno x) {}

@Anno
get getter() { return 1; }
}
```

would write the following metadata:
```javascript
Test.annotations = [new Anno];
Test.prototype.method.annotations = [new Anno];
Test.prototype.method.parameters = [[new Anno]];
Object.getOwnPropertyDescriptor(Test.prototype, "getter").get.annotations = [new Anno];
```

I also added a type assertion flag to insert calls to assert.type(expr, type) for type annotations. The flag assumes that the user is providing an a library to supply the assert.type. We could explore providing one as part of Traceur but it seemed more flexible and less overhead to let users supply an implementation.