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

instanceof Array inconsistencies #1390

Closed
infynyxx opened this issue May 25, 2011 · 5 comments
Closed

instanceof Array inconsistencies #1390

infynyxx opened this issue May 25, 2011 · 5 comments
Labels

Comments

@infynyxx
Copy link

[1,2] instanceof Array
true

But

a = [1, 2]
a instanceof Array
false
@erisdev
Copy link

erisdev commented May 25, 2011

Interesting. This incorrect behavior only occurs in interactive mode for me. The compiled output is correct and so is the result when run as a script. 1.1.0

@infynyxx
Copy link
Author

yeah I forgot to add; it only happens in interactive mode

@michaelficarra
Copy link
Collaborator

Yes, the problem is that each statement is getting executed in a new VM instance, so the following occurs:

a = Array
a is Array # false

because it references a different Array each time. Shouldn't be a very difficult fix.

@michaelficarra
Copy link
Collaborator

Found the source of the bug: We're looping over the properties in global, but global.propertyIsEnumerable('Array') is false.

@michaelficarra
Copy link
Collaborator

@infynyxx: fixed by the above commit

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

No branches or pull requests

3 participants