Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8164467

ES6 computed properties are implemented wrongly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • core-libs
    • None
    • b138
    • generic
    • generic

      var foo = "bar";
      var obj = { [foo] : 45 };

      Expected:

      obj.bar == 45

      Actual:

      typeof(obj.bar) == "undefined"
      obj.foo == 45

      Also, the same is broken for special __proto__ property:

      var o = { x: 4 }
      var obj = { [__proto__] : o }

      Expected:

      obj.__proto__ is not "o" as __proto__ is used "computed".

      Actual:

      obj.__proto__ === o

      I think only string concatenation expression as computed property key works. Everything else does not seem to work.

      In the list of "not implemented yet" ES6 features, we should include computed properties as well - at least for the cases not implemented.

            hannesw Hannes Wallnoefer
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: