Open
Bug 774702
Opened 12 years ago
Updated 2 years ago
Remove dead code in BindVarOrConst
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
NEW
People
(Reporter: ejpbruel, Unassigned)
Details
(Whiteboard: [js:t])
Attachments
(1 file)
1.04 KB,
patch
|
Details | Diff | Splinter Review |
http://mxr.mozilla.org/mozilla-central/source/js/src/frontend/Parser.cpp#2228 I believe this code is redundant. stmt != NULL implies that an enclosing statement has an associated scope object on which a binding for the given name exists. However, when that binding was created, we also did a call to Define to add the corresponding definition to tc->decls. The only exception to this seems to be BindLet, which doesn't call Define until after all bindings for the letBlock have been parsed (that is, until after we have pushed the statement for the letBlock on the list of enclosing statements, see letBlock for details). However, no variable bindings can occur during this window, so for all intents and purposes, stmt != NULL here implies !defs.empty() I've double checked this with an JS_ASSERT_IF(stmt, !defs.empty()). This doesn't break any jit-tests. We should thus be able to change this condition to simply !defs.empty(). Furthermore, we can get rid of lines 2137-2138 completely, which misleadingly suggest that it is possible for defs.empty() to be true inside this block (leading to me unnecessarily spending considerable time pondering how that could be possible).
Attachment #642986 -
Flags: review?(n.nethercote)
Reporter | ||
Updated•12 years ago
|
QA Contact: ejpbruel
Comment 1•12 years ago
|
||
Comment on attachment 642986 [details] [diff] [review] Patch to be reviewed Again, sorry, I'm not comfortable reviewing this :( But it looks pretty plausible. Again, use jstests.py to get better test coverage.
Attachment #642986 -
Flags: review?(n.nethercote)
Updated•12 years ago
|
Whiteboard: [js:t]
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•