Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug in fallthrough of $internalize pointer types. #1301

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
davewalker-wk opened this issue Apr 26, 2024 · 1 comment
Closed

Bug in fallthrough of $internalize pointer types. #1301

davewalker-wk opened this issue Apr 26, 2024 · 1 comment
Labels

Comments

@davewalker-wk
Copy link

davewalker-wk commented Apr 26, 2024

The following highlights a problem when $internalize ing a pointer type. It only will internalize if the pointer is a struct; otherwise it will fallthrough into internalizing as a slice.

Suspect code: https://github.com/gopherjs/gopherjs/blob/master/compiler/prelude/jsmapping.js#L329-L334

//go:build js

package test

import (
	"fmt"
	"github.com/gopherjs/gopherjs/js"
	"testing"
)

type Bar struct {
	*js.Object
	V *string `js:"V"`
}

func makeJsObject() *js.Object {
	if js.Global != nil {
		return js.Global.Get("Object").New()
	}

	return nil
}

func TestExposeBug(t *testing.T) {
	b := Bar{Object: makeJsObject()}
	b.V = nil
	elem := b.V
	fmt.Println(elem)
}
@nevkontakte nevkontakte closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
@nevkontakte nevkontakte reopened this Apr 30, 2024
@nevkontakte
Copy link
Member

Duplicate of #1231.

@nevkontakte nevkontakte closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 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

2 participants