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

Implement global undefined property #481

Closed
HalidOdat opened this issue Jun 11, 2020 · 2 comments · Fixed by #501
Closed

Implement global undefined property #481

HalidOdat opened this issue Jun 11, 2020 · 2 comments · Fixed by #501
Labels
builtins PRs and Issues related to builtins/intrinsics E-Easy Easy enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@HalidOdat
Copy link
Member

ECMASCript feature

undefined is not a keyword, but a global property.

We can add this by adding a new module like NaN https://github.com/boa-dev/boa/tree/master/boa/src/builtins/nan and then adding it to the builtin init function in builtins/mod.rs the value it should contain should be Value::undefined()

More information
- ECMAScript reference
- MDN

@HalidOdat HalidOdat added enhancement New feature or request builtins PRs and Issues related to builtins/intrinsics E-Easy Easy good first issue Good for newcomers labels Jun 11, 2020
@AnirudhKonduru
Copy link
Contributor

AnirudhKonduru commented Jun 16, 2020

@HalidOdat , I could use some help with testing this. Doing it like NaN is tested won't do much, as

let scenario = r#"
        undeclared_identifier; //or undefined;
        "#;

will always evaluate to undefined, even when we don't add undefined as a global property.

@Razican
Copy link
Member

Razican commented Jun 16, 2020

@HalidOdat , I could use some help with testing this. Doing it like NaN is tested won't do much, as

let scenario = r#"
        undeclared_identifier; //or undefined;
        "#;

will always evaluate to undefined, even when we don't add undefined as a global property.

Yes, this is a bug we have, where we don't throw a ReferenceError exception. This should be solved once #488 gets merged, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics E-Easy Easy enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants