Rename special CommonPropertyNames
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox118 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
(Blocks 1 open bug)
Details
Attachments
(17 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
CommonPropertyNames contains some entries where the id and the content different.
before exposing it to public API, we should rename them to clarify the id is different than the content.
MACRO1(star, star, "*") \
MACRO0(empty, empty, "") \
MACRO_(defineGetter, defineGetter, "__defineGetter__") \
Also, if we're to use JS::WellKnownAtomId
with gecko atoms, we might be better aligning the underline position, for simplicity:
MACRO_(for, for_, "for") \
https://searchfox.org/mozilla-central/source/__GENERATED__/xpcom/ds/nsGkAtomList.h#438
GK_ATOM(_for, "for", 0xb87ea068, true, nsStaticAtom, Atom)
Assignee | ||
Comment 1•1 year ago
|
||
Comment 2•1 year ago
|
||
We should try to avoid _
followed by an upper-case character, because all identifiers which start with _[A-Z]
are reserved by implementations. Same goes for identifiers which include two consecutive _
characters.
From https://en.cppreference.com/w/cpp/language/identifiers:
Identifiers that appear as appearing as a token or preprocessing token (i.e., not in user-defined-string-literal like operator ""id) (since C++11) of one of the following forms are reserved:
- identifiers with a double underscore anywhere;
- identifiers that begin with an underscore followed by an uppercase letter;
- in the global namespace, identifiers that begin with an underscore.
Assignee | ||
Comment 3•1 year ago
|
||
thank you for pointing that out :)
so, if double underscore cannot be used, we cannot use leading or trailing underscore unless we stop using js_*_str
format identifier.
given the js_*_str
is used in very limited places, we could switch to something else, or maybe directly use js::wellKnownAtomInfos[n].content
, without declaring js_*_str
variables.
(bug 1847677 will remove most of the consumers anyway)
#define DECLARE_CONST_CHAR_STR(IDPART, _, TEXT) char js_##IDPART##_str[] = TEXT;
...
js::WellKnownAtomInfo js::wellKnownAtomInfos[] = {
#define ENUM_ENTRY_(IDPART, _, _2) \
{uint32_t(sizeof(js_##IDPART##_str) - 1), \
"underscore + uppercase" matches the following. maybe using trailing underscore is safer? or perhaps we should look into some other way to clarify the text content is different than the id.
MACRO_(_Array_Iterator, _Array_Iterator, "Array Iterator") \
MACRO_(_Async_from_Sync_Iterator, _Async_from_Sync_Iterator, \
MACRO_(_Invalid_Date, _Invalid_Date, "Invalid Date") \
MACRO_(_Iterator_Helper, _Iterator_Helper, "Iterator Helper") \
MACRO_(_Map_Iterator, _Map_Iterator, "Map Iterator") \
MACRO_(_NegativeInfinity, _NegativeInfinity, "-Infinity") \
MACRO_(_RegExp_String_Iterator, _RegExp_String_Iterator, \
MACRO_(_Set_Iterator, _Set_Iterator, "Set Iterator") \
MACRO_(_String_Iterator, _String_Iterator, "String Iterator") \
Assignee | ||
Comment 4•1 year ago
•
|
||
actually, I was wrong. the underscore isn't used in js_*_str
in current set because the IDPART is used instead, but that's still misleading.
I'll add class static in order to use the same identifier between the enum class and the strings.
Assignee | ||
Comment 5•1 year ago
|
||
Updated•1 year ago
|
Assignee | ||
Comment 6•1 year ago
|
||
Depends on D186288
Assignee | ||
Comment 7•1 year ago
|
||
Depends on D186289
Assignee | ||
Comment 8•1 year ago
|
||
Depends on D186290
Assignee | ||
Comment 9•1 year ago
|
||
Depends on D186291
Assignee | ||
Comment 10•1 year ago
|
||
Depends on D186292
Assignee | ||
Comment 11•1 year ago
|
||
Depends on D186293
Assignee | ||
Comment 12•1 year ago
|
||
Depends on D186294
Assignee | ||
Comment 13•1 year ago
|
||
Depends on D186295
Assignee | ||
Comment 14•1 year ago
|
||
Depends on D186296
Assignee | ||
Comment 15•1 year ago
|
||
Depends on D186297
Assignee | ||
Comment 16•1 year ago
|
||
Depends on D186298
Assignee | ||
Comment 17•1 year ago
|
||
Depends on D186299
Assignee | ||
Comment 18•1 year ago
|
||
Depends on D186300
Assignee | ||
Comment 19•1 year ago
|
||
Depends on D186301
Assignee | ||
Comment 20•1 year ago
|
||
defineGetter etc are currently unused, but will be used again in bug 1847677.
Depends on D186302
Assignee | ||
Comment 21•1 year ago
|
||
Depends on D186303
Comment 22•1 year ago
|
||
Comment 23•1 year ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/10b649b5c9fd
https://hg.mozilla.org/mozilla-central/rev/26b92aa12caf
https://hg.mozilla.org/mozilla-central/rev/8f78f353f710
https://hg.mozilla.org/mozilla-central/rev/ab946ba7672e
https://hg.mozilla.org/mozilla-central/rev/945782fb21a5
https://hg.mozilla.org/mozilla-central/rev/c95fdd620848
https://hg.mozilla.org/mozilla-central/rev/91993e04a2f1
https://hg.mozilla.org/mozilla-central/rev/a302a27df9f8
https://hg.mozilla.org/mozilla-central/rev/04e9a9e2a084
https://hg.mozilla.org/mozilla-central/rev/11997cbcead7
https://hg.mozilla.org/mozilla-central/rev/67d32f150e98
https://hg.mozilla.org/mozilla-central/rev/e44e553c9fd9
https://hg.mozilla.org/mozilla-central/rev/6b4381c2af09
https://hg.mozilla.org/mozilla-central/rev/8b9e0d861cc5
https://hg.mozilla.org/mozilla-central/rev/fc61e359ad38
https://hg.mozilla.org/mozilla-central/rev/ce9f337c7f60
https://hg.mozilla.org/mozilla-central/rev/d86693cc6243
Description
•