Skip to content

Commit

Permalink
Merge #119
Browse files Browse the repository at this point in the history
119: Integer simplifications r=ptersilie a=ltratt

This PR makes two simplifications to yksom's internals that I've realised will be useful based on another PR I'm currently working on -- in both cases, the APIs were created very early in yksom's development when we weren't quite sure what the right shape of things should be. The commit messages hopefully make clear the motivation for each change.

Co-authored-by: Laurence Tratt <[email protected]>
  • Loading branch information
bors[bot] and ltratt authored May 24, 2020
2 parents 91c1627 + 92809e0 commit 8a3b105
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 118 deletions.
9 changes: 4 additions & 5 deletions src/lib/vm/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,7 @@ impl VM {
pc += 1;
}
Instr::Int(i) => {
// from_isize(i) cannot fail so the unwrap() is safe.
let v = Val::from_isize(self, i).unwrap();
let v = Val::from_isize(self, i);
self.stack.push(v);
pc += 1;
}
Expand Down Expand Up @@ -1154,10 +1153,10 @@ mod tests {
#[serial]
fn test_frame() {
let mut vm = VM::new_no_bootstrap();
let selfv = Val::from_isize(&mut vm, 42).unwrap();
let v = Val::from_isize(&mut vm, 43).unwrap();
let selfv = Val::from_isize(&mut vm, 42);
let v = Val::from_isize(&mut vm, 43);
vm.stack.push(v);
let v = Val::from_isize(&mut vm, 44).unwrap();
let v = Val::from_isize(&mut vm, 44);
vm.stack.push(v);
let f = Frame::new(&mut vm, true, selfv, None, 3, 2);
assert_eq!(f.var_lookup(0, 0).as_isize(&mut vm).unwrap(), 42);
Expand Down
Loading

0 comments on commit 8a3b105

Please sign in to comment.