Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions crates/noirc_evaluator/src/ssa_refactor/acir_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,19 @@ impl Context {

Ok(Self::convert_vars_to_values(out_vars, dfg, result_ids))
}
Intrinsic::ArrayLen => {
let argument = arguments.first().expect("arraylen must have one argument");
let value = self.convert_value(dfg.resolve(*argument), dfg);
let len = match value {
AcirValue::Var(_, _) => unreachable!("ICE - expected an array"),
AcirValue::Array(values) => values.len(),
AcirValue::DynamicArray(array) => array.len,
};
Ok(vec![AcirValue::Var(
self.acir_context.add_constant(FieldElement::from(len as u128)),
AcirType::NumericType(NumericType::NativeField),
)])
}
_ => todo!("expected a black box function"),
}
}
Expand Down