Skip to content

Check for fields in externalize, internalize #824

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
wants to merge 7 commits into from

Conversation

dave
Copy link
Contributor

@dave dave commented May 25, 2018

Check for fields before accessing first struct field in externalize and internalize functions.

Fixes this bug: https://play.jsgo.io/308c189e795b573511cbc4d4606af6b0a60a065a

Note: I don't have node so I can't generated the minified prelude.

Check for fields before accessing first struct field in externalize and internalize functions.

Fixes this bug: https://play.jsgo.io/308c189e795b573511cbc4d4606af6b0a60a065a

Note: I don't have node so I can't generated the minified prelude.
Copy link
Member

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

CC @shurcooL

@@ -113,6 +113,9 @@ var $externalize = function(v, t) {
}
return searchJsObject(v.$get(), t.elem);
case $kindStruct:
if (t.fields.length == 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=== would be better

@@ -347,6 +350,9 @@ var $internalize = function(v, t, recv) {
case $kindPtr:
return searchJsObject(t.elem);
case $kindStruct:
if (t.fields.length == 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@hajimehoshi
Copy link
Member

Note: I don't have node so I can't generated the minified prelude.

Oh I missed this comment. Then I'll try this later. If anyone can do this now, I'm also fine :-)

@dave
Copy link
Contributor Author

dave commented May 25, 2018

Oooh I'll change == to ===...

@hajimehoshi
Copy link
Member

ping @shurcooL

@dmitshur
Copy link
Member

dmitshur commented Jun 20, 2018

Sorry about the delay.

The code in jsmapping.go looks reasonable.

There have been changes to how prelude is stored by now, so we'll need to rebase and regenerate it (as was mentioned in comments above) in order to make it mergeable. We should also add 2 tests for this bug/behavior.

@hajimehoshi
Copy link
Member

Ah right. Thank you.

@dave I was wondering if you still can't do go generate on your environment. I'd do later if you want.

@dave
Copy link
Contributor Author

dave commented Aug 15, 2018

This should be ready to merge now I think?

@hajimehoshi
Copy link
Member

I think yes.

@hajimehoshi
Copy link
Member

Oh wait, @dmitshur suggested that we should add tests.

We should also add 2 tests for this bug/behavior.

@flimzy
Copy link
Member

flimzy commented Dec 28, 2021

@dave We're looking at all old PRs, and see that this one is still outstanding. Unfortunately, the bug link in the original description has died. Are you able to either describe the bug this fixes, or provide a new reproduction case? Thanks.

@flimzy
Copy link
Member

flimzy commented Jun 7, 2023

Superceded by #1194

@flimzy flimzy closed this Jun 7, 2023
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.

4 participants