Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function symbol is evaluated in bracket-less body of false if-statement #2

Closed
GoogleCodeExporter opened this issue Mar 24, 2015 · 10 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

1. Precondition: foo is undefined
2. Run this code: if (foo !== undefined) foo();
3. Gives error message: "Expecting 'foo' to be a function"
4. This works: if (foo !== undefined) { foo(); }

What is the expected output? What do you see instead?

Expected bracket-less body to work.
Works when function is defined, for example: 
if (foo !== undefined) print('Hello');
Hello is not printed, as expected.

The implementation seems to take the value of the function symbol, even when 
the condition in the if-statement is false (have not looked at this in the 
actual implementation, I'm guessing).

What version of the product are you using? On what operating system?

TinyJS r11 (Tested on the MoSync port: http://code.google.com/p/mobile-tiny-js/ 
Have not tested with the original code, but I think it behaves the same as the 
port.)

Original issue reported on code.google.com by mikael.k...@gtempaccount.com on 28 Jul 2010 at 7:01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant