pub trait SignatureSpecializationContext: TypeSpecializationContext {
// Required methods
fn try_get_concrete_type(
&self,
id: GenericTypeId,
generic_args: &[GenericArg],
) -> Option<ConcreteTypeId>;
fn try_get_function_signature(
&self,
function_id: &FunctionId,
) -> Option<FunctionSignature>;
fn try_get_function_ap_change(
&self,
function_id: &FunctionId,
) -> Option<SierraApChange>;
fn as_type_specialization_context(&self) -> &dyn TypeSpecializationContext;
// Provided methods
fn get_concrete_type(
&self,
id: GenericTypeId,
generic_args: &[GenericArg],
) -> Result<ConcreteTypeId, SpecializationError> { ... }
fn get_function_signature(
&self,
function_id: &FunctionId,
) -> Result<FunctionSignature, SpecializationError> { ... }
fn get_function_ap_change(
&self,
function_id: &FunctionId,
) -> Result<SierraApChange, SpecializationError> { ... }
fn get_wrapped_concrete_type(
&self,
id: GenericTypeId,
wrapped: ConcreteTypeId,
) -> Result<ConcreteTypeId, SpecializationError> { ... }
}
Expand description
Trait for the specialization of libfunc signatures.
Required Methods§
Sourcefn try_get_concrete_type(
&self,
id: GenericTypeId,
generic_args: &[GenericArg],
) -> Option<ConcreteTypeId>
fn try_get_concrete_type( &self, id: GenericTypeId, generic_args: &[GenericArg], ) -> Option<ConcreteTypeId>
Returns concrete type id given a generic type and the generic arguments.
Sourcefn try_get_function_signature(
&self,
function_id: &FunctionId,
) -> Option<FunctionSignature>
fn try_get_function_signature( &self, function_id: &FunctionId, ) -> Option<FunctionSignature>
Returns the function’s signature object associated with the given FunctionId.
Sourcefn try_get_function_ap_change(
&self,
function_id: &FunctionId,
) -> Option<SierraApChange>
fn try_get_function_ap_change( &self, function_id: &FunctionId, ) -> Option<SierraApChange>
Returns the ap-change of the given function.
Sourcefn as_type_specialization_context(&self) -> &dyn TypeSpecializationContext
fn as_type_specialization_context(&self) -> &dyn TypeSpecializationContext
Upcasting to the TypeSpecializationContext, since trait upcasting is still experimental.
Provided Methods§
Sourcefn get_concrete_type(
&self,
id: GenericTypeId,
generic_args: &[GenericArg],
) -> Result<ConcreteTypeId, SpecializationError>
fn get_concrete_type( &self, id: GenericTypeId, generic_args: &[GenericArg], ) -> Result<ConcreteTypeId, SpecializationError>
Wraps Self::try_get_concrete_type with a result object.
Sourcefn get_function_signature(
&self,
function_id: &FunctionId,
) -> Result<FunctionSignature, SpecializationError>
fn get_function_signature( &self, function_id: &FunctionId, ) -> Result<FunctionSignature, SpecializationError>
Wraps Self::try_get_function_signature with a result object.
Sourcefn get_function_ap_change(
&self,
function_id: &FunctionId,
) -> Result<SierraApChange, SpecializationError>
fn get_function_ap_change( &self, function_id: &FunctionId, ) -> Result<SierraApChange, SpecializationError>
Wraps Self::try_get_function_ap_change with a result object.
Sourcefn get_wrapped_concrete_type(
&self,
id: GenericTypeId,
wrapped: ConcreteTypeId,
) -> Result<ConcreteTypeId, SpecializationError>
fn get_wrapped_concrete_type( &self, id: GenericTypeId, wrapped: ConcreteTypeId, ) -> Result<ConcreteTypeId, SpecializationError>
Returns the concrete id of T<S>
given generic type T and concrete type S.