Closed
Bug 193555
Opened 22 years ago
Closed 22 years ago
1.5R4 regression: function expression has no access to its name
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
1.5R4.1
People
(Reporter: user, Assigned: norrisboyd)
References
Details
Attachments
(1 file)
|
657 bytes,
patch
|
Details | Diff | Splinter Review |
In 1.5R4 a function expression can not access its function name. To test, run
the following test case in the Rhino shell with arbitrary optimization:
var x = function f() { return f.toString(); };
var ok = (x.toString() === x());
print(ok ? "OK" : "FAILED");
In Rhino 1.5R3 it prints OK while running 1.5R4 produces:
js: "/home/igor/js/x/f_rec.js", line 2: uncaught JavaScript exception:
ReferenceError: "f" is not defined. (/home/igor/js/x/f_rec.js; line 2)
| Reporter | ||
Comment 1•22 years ago
|
||
I wish I would be more careful when made the changes to VraibaleTable. In
NodeTransformer.addVariables() in 1.4R3 had a condition "vars.getLocal(name) ==
null" which I replaced by "vars.hasLocal(name)" thus disabling access to the
function name. On the other hand even the test suite does not have a check for
that, so it seems this feature quite unknown.
In any case, this one line patch to NodeTransformer.addVariables() restores the
functionality.
Comment 2•22 years ago
|
||
Testcase added to JS testsuite:
mozilla/js/tests/ecma_3/Function/regress-193555.js
Comment 3•22 years ago
|
||
Testcase passes in SpiderMonkey; and as Igor reports, it passes if I run
version 1.5R3 of Rhino. Fails in 1.5RC4 with the error Igor reports -
| Reporter | ||
Comment 4•22 years ago
|
||
Marking fixed as I commited the fix some time ago
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 5•22 years ago
|
||
Verified FIXED.
The above testcase now passes in the Rhino shell, in both
compiled and interpreted mode -
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•