« Bugzilla Issues Index
#3302 — Classes with computed names can see incomplete object
- bug_id:
3302
- creation_ts:
2014-10-28 13:36:00 -0700
- short_desc:
Classes with computed names can see incomplete object
- delta_ts:
2015-07-10 08:34:20 -0700
- product:
Draft for 6th Edition
- component:
technical issue
- version:
Rev 28: October 14, 2014 Draft
- rep_platform:
All
- op_sys:
All
- bug_status:
RESOLVED
- resolution:
INVALID
- priority:
Normal
- bug_severity:
major
- everconfirmed:
true
- reporter:
Erik Arvidsson
- assigned_to:
Allen Wirfs-Brock
- cc:
["andrebargull", "erik.arvidsson"]
- commentid:
10542
- comment_count:
0
- who:
Erik Arvidsson
- bug_when:
2014-10-28 13:36:10 -0700
Given the following class declaration
class C {
a() {}
[(console.log(C.prototype), 42]() {}
b() {}
}
The expression for the computed property name is executed in a scope where C has a binding, allowing us to see an incomplete prototype object.
This is bad for performance.
Can we change this to have the class name as a TDZ until after all the method definitions have been installed on the prototype and the constructor.
- commentid:
10543
- comment_count:
1
- who:
André Bargull
- bug_when:
2014-10-28 13:46:06 -0700
Accessing "C" during evaluation of the computed property name will throw a ReferenceError because the binding is not yet initialized (cf. 14.5.14 step 5c and 14.5.14 step 19).
- commentid:
10544
- comment_count:
2
- who:
Erik Arvidsson
- bug_when:
2014-10-28 13:53:03 -0700
Thanks André. Perfect.