ljharb / es-abstract

ECMAScript spec abstract operations.
MIT License
114 stars 30 forks source link

ToPropertyKey does not seem correct? #26

Closed Xotic750 closed 7 years ago

Xotic750 commented 7 years ago

http://www.ecma-international.org/ecma-262/6.0/#sec-topropertykey

  1. Let key be ToPrimitive(argument, hint String).
  2. ReturnIfAbrupt(key).
  3. If Type(key) is Symbol, then a. Return key.
  4. Return ToString(key).

https://github.com/ljharb/es-abstract/blob/master/es2015.js#L150

But instead of return key, it is being converted to a string.

ToPropertyKey: function ToPropertyKey(argument) {
    var key = this.ToPrimitive(argument, String);
    return typeof key === 'symbol' ? symbolToStr.call(key) : this.ToString(key);
},
ljharb commented 7 years ago

Whoops, good call.