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

Fix #584 #837

Merged
merged 1 commit into from
Mar 22, 2020
Merged

Fix #584 #837

merged 1 commit into from
Mar 22, 2020

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Mar 22, 2020

The cause of this issue is that Goby pops the incorrect call frame when evaluating a break statement inside a built-in method's block.

When evaluating a built-in method's call frame, Goby should pop it after the evaluation is finished. And we do this by calling t.callFrameStack.pop() directly, which makes sense in most cases.

However, because the "break" instruction pops out 3 call frames every time (which is necessary, please read the comments inside Break instruction for more detail), it'd pop the built-in method's frame in advance. So when Goby finishes the built-in frame's evaluation later and tries to pop the frame from the stack, it actually pops the top frame, which later causes the nil pointer error.

@codecov
Copy link

codecov bot commented Mar 22, 2020

Codecov Report

Merging #837 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #837   +/-   ##
=======================================
  Coverage   81.08%   81.08%           
=======================================
  Files          54       54           
  Lines        7433     7434    +1     
=======================================
+ Hits         6027     6028    +1     
  Misses       1182     1182           
  Partials      224      224           
Impacted Files Coverage Δ
vm/thread.go 90.45% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c21b38e...9c2e449. Read the comment docs.

@st0012 st0012 merged commit c642dbc into master Mar 22, 2020
@st0012 st0012 deleted the fix-#584 branch March 22, 2020 15:10
@st0012 st0012 linked an issue Apr 26, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Top level break instruction causes panic on REPL
2 participants