We can emit computed properties in ES5, using the following scheme: ``` ts var x = { a: 0, ["b"]: 0, ["c"]() {}, get ["d"]() { return 0 }, set ["d"](x) {}, e: 0 }; ``` emits as: ``` js var x = { a: 0 }; x["b"]: 0; x["c"] = function() {}; Object.defineProperty(x, "d" ...); Object.defineProperty(x, "d" ...); x.e = 0; ``` In any other expression context, we would emit a temp variable like we do for destructuring.
Activity
DanielRosenwasser commentedon Jan 30, 2015
I dunno about that emit - what about this?
I think we'll have to do something like the following:
JsonFreeman commentedon Jan 30, 2015
Yeah, when there are multiple variable declarations in the same variable statement, we would have to do that.