On Mon, Nov 14, 2011 at 5:13 PM, Mark S. Miller <[email protected]> wrote:

>
>     function [[GetClass]](x) {
>       while (true) {
>         const proto = Object.getPrototypeOf(x);
>         if (proto === null) { return null; /* or void 0? */ }
>         let result;
>         if (hasOwnProperty(proto, 'constructor') &&
>             (result = proto.constructor) &&
>             typeof result === 'function' &&
>             result.prototype === proto) {
>           return result;
>         }
>       }
>     }
>

Oops. Should be

    function [[GetClass]](x) {
      while (true) {
        x = Object.getPrototypeOf(x);
        if (x === null) { return null; /* or void 0? */ }
        let result;
        if (hasOwnProperty(x, 'constructor') &&
            (result = x.constructor) &&
            typeof result === 'function' &&
            result.prototype === x) {
          return result;
        }
      }
    }

-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to