forked from M-Labs/nac3
[meta] Minor simplification for PrimStore extraction
This commit is contained in:
parent
c37c7e8975
commit
a078481cd2
@ -41,7 +41,10 @@ use nac3core::{
|
|||||||
numpy::unpack_ndarray_var_tys,
|
numpy::unpack_ndarray_var_tys,
|
||||||
DefinitionId, GenCall,
|
DefinitionId, GenCall,
|
||||||
},
|
},
|
||||||
typecheck::typedef::{iter_type_vars, FunSignature, FuncArg, Type, TypeEnum, VarMap},
|
typecheck::{
|
||||||
|
type_inferencer::PrimitiveStore,
|
||||||
|
typedef::{iter_type_vars, FunSignature, FuncArg, Type, TypeEnum, VarMap},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The parallelism mode within a block.
|
/// The parallelism mode within a block.
|
||||||
@ -389,12 +392,7 @@ fn gen_rpc_tag(
|
|||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
use nac3core::typecheck::typedef::TypeEnum::*;
|
use nac3core::typecheck::typedef::TypeEnum::*;
|
||||||
|
|
||||||
let int32 = ctx.primitives.int32;
|
let PrimitiveStore { int32, int64, float, bool, str, none, .. } = ctx.primitives;
|
||||||
let int64 = ctx.primitives.int64;
|
|
||||||
let float = ctx.primitives.float;
|
|
||||||
let bool = ctx.primitives.bool;
|
|
||||||
let str = ctx.primitives.str;
|
|
||||||
let none = ctx.primitives.none;
|
|
||||||
|
|
||||||
if ctx.unifier.unioned(ty, int32) {
|
if ctx.unifier.unioned(ty, int32) {
|
||||||
buffer.push(b'i');
|
buffer.push(b'i');
|
||||||
|
@ -36,9 +36,7 @@ pub fn get_exn_constructor(
|
|||||||
unifier: &mut Unifier,
|
unifier: &mut Unifier,
|
||||||
primitives: &PrimitiveStore,
|
primitives: &PrimitiveStore,
|
||||||
) -> (TopLevelDef, TopLevelDef, Type, Type) {
|
) -> (TopLevelDef, TopLevelDef, Type, Type) {
|
||||||
let int32 = primitives.int32;
|
let PrimitiveStore { int32, int64, str: string, .. } = *primitives;
|
||||||
let int64 = primitives.int64;
|
|
||||||
let string = primitives.str;
|
|
||||||
let exception_fields = make_exception_fields(int32, int64, string);
|
let exception_fields = make_exception_fields(int32, int64, string);
|
||||||
let exn_cons_args = vec![
|
let exn_cons_args = vec![
|
||||||
FuncArg {
|
FuncArg {
|
||||||
|
@ -1521,8 +1521,7 @@ impl TopLevelComposer {
|
|||||||
.any(|ann| matches!(ann, TypeAnnotation::CustomClass { id, .. } if id.0 == 7))
|
.any(|ann| matches!(ann, TypeAnnotation::CustomClass { id, .. } if id.0 == 7))
|
||||||
{
|
{
|
||||||
// create constructor for these classes
|
// create constructor for these classes
|
||||||
let string = primitives_ty.str;
|
let PrimitiveStore { str: string, int64, .. } = *primitives_ty;
|
||||||
let int64 = primitives_ty.int64;
|
|
||||||
let signature = unifier.add_ty(TypeEnum::TFunc(FunSignature {
|
let signature = unifier.add_ty(TypeEnum::TFunc(FunSignature {
|
||||||
args: vec![
|
args: vec![
|
||||||
FuncArg {
|
FuncArg {
|
||||||
|
Loading…
Reference in New Issue
Block a user