[meta] Add the ability to bind any type to an instruction;
This commit is contained in:
@@ -376,11 +376,17 @@ pub struct Apply {
|
||||
|
||||
impl Apply {
|
||||
pub fn new(target: InstSpec, args: Vec<Expr>) -> Self {
|
||||
let (inst, value_types) = match target.into() {
|
||||
let (inst, value_types) = match target {
|
||||
InstSpec::Inst(inst) => (inst, Vec::new()),
|
||||
InstSpec::Bound(bound_inst) => (bound_inst.inst, bound_inst.value_types),
|
||||
};
|
||||
|
||||
// Apply should only operate on concrete value types, not "any".
|
||||
let value_types = value_types
|
||||
.into_iter()
|
||||
.map(|vt| vt.expect("shouldn't be Any"))
|
||||
.collect();
|
||||
|
||||
// Basic check on number of arguments.
|
||||
assert!(
|
||||
inst.operands_in.len() == args.len(),
|
||||
|
||||
Reference in New Issue
Block a user