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

parser,fmt: inform about invalid interop function bodies instead of removing them #21070

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Mar 21, 2024

Fixes #12966

Where formatting

fn JS.state_is_ready_on_leave(retval int) {
	println('Hooked callback')
}

results in

fn JS.state_is_ready_on_leave(retval int)

With the changes it would throw an error instead

error: interop functions cannot have a body
    1 | fn JS.state_is_ready_on_leave(retval int) {
      |                                           ^
    2 |     println('Hooked callback')
    3 | }

@spytheman spytheman merged commit 39eef1d into vlang:master Mar 21, 2024
54 checks passed
@ttytm ttytm deleted the parser/fix-js-interop-fn-body branch March 21, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v fmt removes function bodies without warning
2 participants