Refactor BaseAbstractBindingIter::init to take a struct with compound literals
Categories
(Core :: JavaScript Engine, enhancement, P5)
Tracking
()
Tracking | Status | |
---|---|---|
firefox89 | --- | fixed |
People
(Reporter: mgaudet, Assigned: ashwiniwankhede.aw, Mentored)
Details
Attachments
(2 files, 2 obsolete files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
Bug 1702601 Refactor BaseAbstractBindingIter::init to take a struct with compound literals r=mgaudet
48 bytes,
text/x-phabricator-request
|
Details | Review |
BaseAbstractBindingIter
has this horrible init
function that takes a bunch of uint32_t
parameters; but this leads to ugly ugly calls like this where you have a bunch of difficult to interpret parameters, and you end up counting zeros just to figure out what's relevant.
I'd like to see this refactored so that the init method takes a struct that we can use compound literals to make it much clearer what's going on; ie. instead of
init(0, 0, 0, length, length, length,
CanHaveFrameSlots | CanHaveEnvironmentSlots, firstFrameSlot,
JSSLOT_FREE(&VarEnvironmentObject::class_),
GetScopeDataTrailingNames(&data));
I'd like to see something akin to
BindingIndexes bindingIndex ={.positionalFormalStart = 0, .nonPositionalFormalStart=0, .varStart=0, .letStart=length, .constStart=length};
init(bindingIndexes, length,
CanHaveFrameSlots | CanHaveEnvironmentSlots, firstFrameSlot,
JSSLOT_FREE(&VarEnvironmentObject::class_),
GetScopeDataTrailingNames(&data));
}
That or, an easier refactoring would be just to label all the parameters with comments:
init(/* positionalFormalStart = */ 0,
/* nonPositionalFormalStart = */ 0,
...
Reporter | ||
Comment 1•3 years ago
|
||
ashwiniwankhede is taking a peek at this at the moment.
Assignee | ||
Comment 2•3 years ago
|
||
refactored by labelling all the parameters with comments
changed js/src/vm/Scope.cpp
Updated•3 years ago
|
Assignee | ||
Comment 3•3 years ago
|
||
implemented desired format changes.
refactored by labelling all the parameters with comments
changed js/src/vm/Scope.cpp
Assignee | ||
Comment 4•3 years ago
|
||
refactored by labelling all the parameters with comments(updated)
changed js/src/vm/Scope.cpp
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 5•3 years ago
|
||
Refactored BaseAbstractBindingIter::init to take parameters through struct BindingIndexes
Depends on D111380
Pushed by mgaudet@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dfec7a664567 Refactor BaseAbstractBindingIter::init with commented parameters r=mgaudet
Comment 7•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Description
•