google / traceur-compiler

Traceur is a JavaScript.next-to-JavaScript-of-today compiler
Apache License 2.0
8.17k stars 581 forks source link

Cannot apply annotations to function() { @Anno this.method = function(){} } #1639

Open allenbrubaker opened 9 years ago

allenbrubaker commented 9 years ago

Cannot apply annotations to function() { @Anno this.method = function(){} }

I have only been able to apply annotations to methods defined in a class. Is there a workaround for this? I noticed in the source code that applying an annotation to a var is not supported yet.

arv commented 9 years ago

At this point, annotations only work on declarations:

function A() {}
@A function B() {}

http://google.github.io/traceur-compiler/demo/repl.html#%2F%2F%20Options%3A%20--annotations%20--script%20--source-maps%20%0A%0Afunction%20A()%20%7B%7D%0A%0A%40A%20function%20B()%20%7B%7D%0A