Skip to content
This repository has been archived by the owner on Dec 22, 2021. It is now read-only.

Commit

Permalink
[spec] Fix algorithm (#1375)
Browse files Browse the repository at this point in the history
  • Loading branch information
rossberg authored Oct 13, 2021
1 parent 5893af5 commit efb35b2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions document/core/appendix/algorithm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,13 @@ However, these variables are not manipulated directly by the main checking funct
func pop_val(expect : val_type | Unknown) : val_type | Unknown =
let actual = pop_val()
if (actual = Unknown) return expect
if (expect = Unknown) return actual
error_if(actual =/= expect)
error_if(actual =/= expect && actual =/= Unknown && expect =/= Unknown)
return actual
func push_vals(types : list(val_type)) = foreach (t in types) push_val(t)
func pop_vals(types : list(val_type)) : list(val_type) =
var popped := []
foreach (t in reverse(types)) popped.append(pop_val(t))
foreach (t in reverse(types)) popped.prepend(pop_val(t))
return popped
Pushing an operand value simply pushes the respective type to the value stack.
Expand Down

0 comments on commit efb35b2

Please sign in to comment.