From 19f2fc1405fcc8f8d7ef8efd5fdf098484f10722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Thu, 17 Oct 2024 10:26:05 -0300 Subject: [PATCH] Rename funcgtion --- src/lib.rs | 13 +++++++------ src/vm/array.rs | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 48068ed..88893fc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,24 +35,25 @@ pub fn find_entry_point_by_name<'a>( .find(|x| x.id.debug_name.as_ref().map(|x| x.as_str()) == Some(name)) } -// If type is a single element container, finds it's inner type +// If type is invisible to sierra (i.e. a single element container), +// finds it's actual concrete type recursively. // If not, returns the current type -pub fn find_inner_type( +pub fn find_real_type( registry: &ProgramRegistry, ty: &ConcreteTypeId, ) -> ConcreteTypeId { match registry.get_type(ty).unwrap() { cairo_lang_sierra::extensions::core::CoreTypeConcrete::Box(info) => { - find_inner_type(registry, &info.ty) + find_real_type(registry, &info.ty) } cairo_lang_sierra::extensions::core::CoreTypeConcrete::Uninitialized(info) => { - find_inner_type(registry, &info.ty) + find_real_type(registry, &info.ty) } cairo_lang_sierra::extensions::core::CoreTypeConcrete::Span(info) => { - find_inner_type(registry, &info.ty) + find_real_type(registry, &info.ty) } cairo_lang_sierra::extensions::core::CoreTypeConcrete::Snapshot(info) => { - find_inner_type(registry, &info.ty) + find_real_type(registry, &info.ty) } _ => ty.clone(), } diff --git a/src/vm/array.rs b/src/vm/array.rs index 0c9d092..4f45f56 100644 --- a/src/vm/array.rs +++ b/src/vm/array.rs @@ -1,5 +1,5 @@ use super::EvalAction; -use crate::{find_inner_type, Value}; +use crate::{find_real_type, Value}; use cairo_lang_sierra::{ extensions::{ array::ArrayConcreteLibfunc, @@ -47,7 +47,7 @@ fn eval_span_from_tuple( }; let ty = &info.branch_signatures()[0].vars[0].ty; - let ty = find_inner_type(registry, ty); + let ty = find_real_type(registry, ty); let CoreTypeConcrete::Array(info) = registry.get_type(&ty).unwrap() else { panic!()