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

js: objects are always references #222

Open
serkonda7 opened this issue Apr 9, 2024 · 0 comments
Open

js: objects are always references #222

serkonda7 opened this issue Apr 9, 2024 · 0 comments
Labels

Comments

@serkonda7
Copy link
Member

serkonda7 commented Apr 9, 2024

Description and Reproduction Sample

struct Foo {
    mut x i32
}

fun main() {
	mut a := Foo{}
	b := a
	a.x = 3
	println(a)
	println(b)
}

Current Behavior

JS backend:

Foo{
  x = 3
}
Foo{
  x = 3
}

C backend:

Foo{
  x = 3
}
Foo{
  x = 0
}

Expected Behavior

JS should behave like C

Possible Solution and Additional Information

No response

Environment details (bait doctor)

Version: Bait 0.0.7 81a5a9a
OS: linux/x64
Git: git version 2.47.0
Node.js: v23.1.0
CC: cc (GCC) 14.2.1 20240910

@serkonda7 serkonda7 added the bug label Apr 9, 2024
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

1 participant