ericmckean / traceur-compiler

Automatically exported from code.google.com/p/traceur-compiler
Apache License 2.0
0 stars 0 forks source link

method declaration on classes doesn't preserve the method name #127

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When creating a method inside a class declaration the name of the function 
isn't copied. Instead, an anonymous function is added to the prototype.

For example...

class Foo {
  bar() {
  }
}

...compiles to...

var Foo = traceur.runtime.createClass("Foo", null, null, null, undefined, { 
bar: function() { } }, function $static() { }, null); 

...when it should be...

var Foo = traceur.runtime.createClass("Foo", null, null, null, undefined, { 
bar: function bar() { } }, function $static() { }, null); 

Original issue reported on code.google.com by dopazo.juan on 21 Sep 2012 at 5:01

GoogleCodeExporter commented 9 years ago
This has been fixed already. The current generated code is:

var Foo = traceur.runtime.createClass(function Foo() { }, 
traceur.runtime.markMethods({ bar: function bar() { } },["bar"]), Object); 

Original comment by arv@chromium.org on 21 Sep 2012 at 5:08

GoogleCodeExporter commented 9 years ago
Oh! Thanks! I just don't see the fix when using the latest commit

Original comment by dopazo.juan on 21 Sep 2012 at 5:21

GoogleCodeExporter commented 9 years ago
Make sure you are using git. The svn repo has been retired.

Original comment by arv@chromium.org on 21 Sep 2012 at 5:22