/* jshint esnext: true */
traceur-annotations
A shim for Traceur's annotations. Can be used directly as an annotation in Traceur:
var Foo = Annotation;@Foo {}
or as a regular function in ES5/CoffeeScript/etc.:
Foo = AnnotationextendFoo = ->
Traceur instantiates the class and adds it to the
annotatee's annotations
array, so we simulate
that in other environments.
{}
has :: Object → Maybe Annotation
If the object is annotated with this annotation, return the instance. Otherwise, return undefined.
Annotation { return objannotations || ;};
extend :: Object → typeof Annotation
Create a new annotation based on this one. Can't do
this with regular subclassing, as we wouldn't be
able to dynamically delegate to the original class
if we need to instantiate it ourselves without
resorting to arguments.callee
.
Annotation { var sub = { ifthis instanceof Annotation this; else var obj = args || this; objannotations = objannotations || ; objannotations; return obj; // for chaining } ; Object; return sub;}; moduleexports = Annotation;