Closed
Bug 775391
Opened 14 years ago
Closed 10 years ago
Fix potential erroneous comment in DefineArg
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: ejpbruel, Unassigned)
Details
(Whiteboard: [js:t])
Attachments
(1 file)
|
1.47 KB,
patch
|
n.nethercote
:
review+
|
Details | Diff | Splinter Review |
The comment in http://mxr.mozilla.org/mozilla-central/source/js/src/frontend/Parser.cpp#900 doesn't make sense. We assert that pnarg->op == JSOP_NOP before calling Define (causing pnarg to be added to tc->decls.), and before appending pnarg to pn->pn_body. Neither of those operations check the opcode of pnarg, nor do they perform a clone of pnarg. Yet immediately after we set pnarg->pn_op to JSOP_GETARG.
It seems to me that that comment is wrong, and we should be able to just set pnarg->op to JSOP_GETARG from the start.
| Reporter | ||
Comment 1•14 years ago
|
||
I've tested this patch with jit-tests and jstests and didn't find any regressions.
Attachment #643704 -
Flags: review?(n.nethercote)
Comment 2•14 years ago
|
||
Comment on attachment 643704 [details] [diff] [review]
Patch to be reviewed
Review of attachment 643704 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/frontend/Parser.cpp
@@ +919,5 @@
> ParseNode *argpn = NameNode::create(PNK_NAME, atom, parser, parser->tc);
> if (!argpn)
> return false;
> + argpn->setOp(JSOP_GETARG);
> + JS_ASSERT(argpn->isKind(PNK_NAME) && argpn->isOp(JSOP_GETARG));
In the same way we don't write this:
int x = 3;
JS_ASSERT(x == 3);
I think this assertion can now be removed :)
Attachment #643704 -
Flags: review?(n.nethercote) → review+
Updated•14 years ago
|
Whiteboard: [js:t]
| Reporter | ||
Updated•13 years ago
|
Assignee: ejpbruel → general
| Assignee | ||
Updated•12 years ago
|
Assignee: general → nobody
Comment 3•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•