Closed
Bug 150032
Opened 22 years ago
Closed 22 years ago
Conflict between function members and vars
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
DUPLICATE
of bug 137000
People
(Reporter: john, Assigned: rogerl)
Details
From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530 BuildID: Gecko/20020530 Mozilla gets confused by a var inside a function, that has the same name as a function member. Reproducible: Always Steps to Reproduce: 1. Run the following html and script code: <html> <body> <script> function funcA(){ var classpropA = funcA.classpropA; var classpropFoo = funcA.classpropBar; this.print = function(){ alert(classpropA + ', ' + classpropFoo); }; } funcA.classpropA = 'classpropA'; funcA.classpropBar = 'classpropBar'; var myfunc = new funcA(); myfunc.print(); </script> </body> <html> Actual Results: classpropA is undefined but should have the string value of "classpropA". Expected Results: classpropA is undefined but should have the string value of "classpropA".
Comment 1•22 years ago
|
||
Confirming bug with Mozilla trunk binary 20020530xx and cc'ing Brendan. Output from the reporter's test: IE6 'classpropA, classpropBar' Moz 'undefined', classpropBar' This is similar enough to bug 137000 to mark this as a duplicate, I think. I will add the reporter's test to the testcase for the other bug: mozilla/js/tests/js1_5/Object/regress-137000.js In bug 137000, the problem is a parameter to a function f() with the same name as an object property of f. In this bug, a local variable declared inside f() has the same name as a property of f. Brendan: please reopen this bug if this dupe was inappropriate; thanks - jrgm and john@statesoftware.com: I'll cc you on the other bug. *** This bug has been marked as a duplicate of 137000 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Comment 3•22 years ago
|
||
Oops, forgot to cc Brendan. No action necessary; just checking that it was appropriate to mark this as a duplicate of bug 137000 -
You need to log in
before you can comment on or make changes to this bug.
Description
•