remove need to clone instructions.

This commit is contained in:
Mark Thom
2018-10-04 22:18:29 -06:00
parent 4bd805cc76
commit 054def4cc7
4 changed files with 95 additions and 65 deletions

View File

@@ -3,7 +3,6 @@ use prolog_parser::ast::*;
use prolog::instructions::*;
use std::collections::{HashMap, VecDeque};
use std::hash::Hash;
use std::rc::Rc;
#[derive(Clone, Copy)]
enum IntIndex {
@@ -141,7 +140,7 @@ impl CodeOffsets {
if con_ind.len() > 1 {
let index = Self::flatten_index(con_ind, prelude.len());
let instr = IndexingInstruction::SwitchOnConstant(index.len(), Rc::new(index));
let instr = IndexingInstruction::SwitchOnConstant(index.len(), index);
prelude.push_front(Line::from(instr));
@@ -161,7 +160,7 @@ impl CodeOffsets {
if str_ind.len() > 1 {
let index = Self::flatten_index(str_ind, prelude.len());
let instr = IndexingInstruction::SwitchOnStructure(index.len(), Rc::new(index));
let instr = IndexingInstruction::SwitchOnStructure(index.len(), index);
prelude.push_front(Line::from(instr));