On Jan 15, 2:38 pm, [EMAIL PROTECTED] wrote:
> hmmm. We're using the latest binary you can download... I believe
> it's 1.6R7
>
> could you try
>
> function foo( param ) {
> return (param || 0);
>
> }
>
> foo();
>
> thanks
>
> On Jan 15, 10:27 pm, Norris Boyd <[EMAIL PROTECTED]> wrote:
>
> > On Jan 15, 8:50 am, "Tiest Vilee" <[EMAIL PROTECTED]> wrote:
>
> > > We are getting JSLint to work in Rhino so it can be part of our check-in
> > > process. We found two places where JSLint doesn't work, and both are of
> > > the form -
>
> > > var i = (variableName || 0);
>
> > > The intent being that, if the variableName is falsey then i defaults to
> > > 0.
>
> > > This doesn't happen, instead 'i' gets an undefined value, resulting in
> > > errors.
>
> > > So it seems to me that there is a bug in Rhino. I believe that if all
> > > the values in a list of OR'ed values are falsey, then the last value
> > > should be returned.
>
> > > Am I correct? Has this bug been addressed in a more recent version of
> > > Rhino?
>
> > > I look forward to your replies,
> > > Tiest
>
> > Works for me in the latest CVS and in the released 1.6R7:
>
> > js> var variableName = false;
> > js> var i = (variableName || 0);
> > js> i
> > 0
>
> > I don't remember this being a bug in prior versions; seems like a
> > pretty basic thing. What version are you on?
>
> > --N
Hmm. I tried
[rhino] cat test.js
function foo(param) {
return (param || 0);
}
print(foo());
[rhino] java -jar build/rhino1_6R7/js.jar test.js
0
[rhino] java -jar build/rhino1_6R7/js.jar -opt -1 test.js
0
[rhino] java -jar build/rhino1_6R7/js.jar -opt 9 test.js
0
How about creating a bug with a test case and we can continue the
discussion on the bug so we don't make too much noise for others?
Create a bug here: https://bugzilla.mozilla.org/enter_bug.cgi?product=Rhino
Thanks,
Norris
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino