Skip to content

ReferenceError thrown on assigning to undeclared global in script file (as if in strict mode/module) #634

@harig

Description

@harig

After 8cd59bf qjs throws ReferenceError for an undeclared global assignment in a script file.

Consider a js file with this code
a=1;console.log(typeof a);
This used to output "number" earlier but now without --script argument before the file path, an error is thrown.
ReferenceError: a is not defined
It seems the file is considered to be a module and strict mode is enforced if --script is not specified.

Shouldn't this work as it did before (raising the error only if strict mode is specified) ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions