Closed
Bug 229244
Opened 22 years ago
Closed 22 years ago
nested function cannot access local variables
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 220362
1.5R5
People
(Reporter: yaar, Assigned: igor)
Details
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Build Identifier: Rhino v1.5.3
A nested function cannot access var declarations which are declared in the
same scope.
Reproducible: Always
Steps to Reproduce:
The following code performs only partialy:
function MyObject()
{
this.x = 'XXX';
var y = 'YYY';
this.f1 = _f1;
this.f2 = _f2;
function _f1(){
this.x;
}
function _f2(){
return y;
}
}
var instance = new MyObject();
instance.f1();
instance.f2();
Actual Results:
Calling instance.f1() works but instance.f2() crashes.
Expected Results:
Execution of the same code using Microsoft JScript engine succeeds. I'm not
sure however that this construct is standard.
We embed Rhino in a java application.
| Assignee | ||
Comment 1•22 years ago
|
||
I just run the script in the Rhino shell and it did not crash. Do you use
dynamic scoping? If yes, then it is a bug that was fixed in Rhino CVS tip.
Assignee: nboyd → igor
| Assignee | ||
Comment 2•22 years ago
|
||
See bug 220362 for the dynamic scoping bug.
| Assignee | ||
Comment 3•22 years ago
|
||
Assuming no-reporting \equiv agreement with my last comments.
*** This bug has been marked as a duplicate of 220362 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•