Skip to content

Assert failed while error statements #720

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

Closed
ssrlive opened this issue Nov 24, 2024 · 4 comments · Fixed by #722 or #723
Closed

Assert failed while error statements #720

ssrlive opened this issue Nov 24, 2024 · 4 comments · Fixed by #722 or #723

Comments

@ssrlive
Copy link

ssrlive commented Nov 24, 2024

 assert(list_empty(&rt->gc_obj_list));

image

@bnoordhuis
Copy link
Contributor

Which commit?

@ssrlive
Copy link
Author

ssrlive commented Nov 24, 2024

master branch current commit.

4ca6d9b

@saghul
Copy link
Contributor

saghul commented Nov 24, 2024

❯ ./build/qjs -D0x4000
QuickJS-ng - Type ".help" for help
qjs > exit()
ReferenceError: exit is not defined
    at <eval> (<evalScript>:1:1)
qjs > exit
ReferenceError: exit is not defined
    at <eval> (<evalScript>:1:1)
qjs > exit 0;
SyntaxError: expecting ';'
    at <evalScript>:1:1

Object leaks:
       ADDRESS REFS SHRF          PROTO      CLASS PROPS
0x6000002702d0    1   0* 0x6000002602d0      Error { message: "expecting ';'", stack: "    at <evalScript>:1:1\n" }
Assertion failed: (list_empty(&rt->gc_obj_list)), function JS_FreeRuntime, file quickjs.c, line 2139.
Abort trap: 6

It's the last error. I'll take a look and see if it's related to the patch I made to exit the interpreter with an error code in case of error.

@saghul
Copy link
Contributor

saghul commented Nov 24, 2024

This is weird though:

❯ ./build/qjs -D0x4000
QuickJS-ng - Type ".help" for help
qjs > foo;
ReferenceError: foo is not defined
    at <eval> (<evalScript>:1:1)
qjs > foo 0;
SyntaxError: expecting ';'
    at <evalScript>:1:1

Object leaks:
       ADDRESS REFS SHRF          PROTO      CLASS PROPS
0x600001e182d0    1   0* 0x600001e0c2d0      Error { message: "expecting ';'", stack: "    at <evalScript>:1:1\n" }
Assertion failed: (list_empty(&rt->gc_obj_list)), function JS_FreeRuntime, file quickjs.c, line 2139.
Abort trap: 6

It shouldn't exit the interpreter.

saghul added a commit that referenced this issue Nov 25, 2024
saghul added a commit that referenced this issue Nov 25, 2024
In case of a syntax error, the function throws syncrnonously.

I'll admit I wondered when Promise.try would be useful... I guess I know
now!

Fixes: #720 (comment)
@saghul saghul closed this as completed in 9631492 Nov 25, 2024
saghul added a commit that referenced this issue Nov 25, 2024
saghul added a commit that referenced this issue Nov 25, 2024
bluesky950520 pushed a commit to bluesky950520/quickjs that referenced this issue Mar 14, 2025
In case of a syntax error, the function throws syncrnonously.

I'll admit I wondered when Promise.try would be useful... I guess I know
now!

Fixes: quickjs-ng/quickjs#720 (comment)
bluesky950520 pushed a commit to bluesky950520/quickjs that referenced this issue Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants