Skip to content
This repository has been archived by the owner on Mar 29, 2018. It is now read-only.

Computed methods are not supported #11

Open
fkling opened this issue Oct 31, 2014 · 2 comments
Open

Computed methods are not supported #11

fkling opened this issue Oct 31, 2014 · 2 comments

Comments

@fkling
Copy link

fkling commented Oct 31, 2014

It seems like computed methods are not properly supported. Something like

class A {
  [foo](){...}
}

produces

$__Object$defineProperties(Graph.prototype, {
  foo: {
    value: ...
  }
});

Not sure what the best solution is here, but given that this is used with https://github.com/esnext/esnext, can we preserve the dynamic property name, i.e. produce

$__Object$defineProperties(Graph.prototype, {
  [foo]: {
    value: ...
  }
});

and run the computed properties transform after the class transform?

eventualbuddha added a commit that referenced this issue Oct 31, 2014
@eventualbuddha
Copy link
Contributor

@fkling thanks for the issue. I looked into this and it seems that support for this is in esprima#harmony but not yet in esprima-fb.

@fkling
Copy link
Author

fkling commented Oct 31, 2014

Oh I see. I thought it was a problem with the transform, but you are right, esprima-fb has no indication that the method (name) is dynamic: http://felix-kling.de/esprima_ast_explorer/#/wLdvaQ27f7.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants