fix todo and list and tuple not equal comparator

This commit is contained in:
Kasey White 2022-12-22 01:09:06 -05:00
parent 7867793bcd
commit b1dec1259d
1 changed files with 70 additions and 74 deletions

View File

@ -2675,63 +2675,63 @@ impl<'a> CodeGenerator<'a> {
} else if tipo.is_tuple() } else if tipo.is_tuple()
&& matches!(tipo.clone().get_uplc_type(), UplcType::Pair(_, _)) && matches!(tipo.clone().get_uplc_type(), UplcType::Pair(_, _))
{ {
// let term = Term::Apply { let mut term = Term::Apply {
// function: Term::Apply {
// function: default_builtin.into(),
// argument: Term::Apply {
// function: DefaultFunction::MapData.into(),
// argument: Term::Apply {
// function: Term::Apply {
// function: Term::Builtin(DefaultFunction::MkCons)
// .force_wrap()
// .into(),
// argument: left.into(),
// }
// .into(),
// argument: Term::Constant(UplcConstant::ProtoList(
// UplcType::Pair(
// UplcType::Data.into(),
// UplcType::Data.into(),
// ),
// vec![],
// ))
// .into(),
// }
// .into(),
// }
// .into(),
// }
// .into(),
// argument: Term::Apply {
// function: Term::Apply {
// function: Term::Builtin(DefaultFunction::MkCons)
// .force_wrap()
// .into(),
// argument: right.into(),
// }
// .into(),
// argument: Term::Constant(UplcConstant::ProtoList(
// UplcType::Pair(
// UplcType::Data.into(),
// UplcType::Data.into(),
// ),
// vec![],
// ))
// .into(),
// }
// .into(),
// };
// arg_stack.push(term);
// return;
todo!()
} else if tipo.is_list() {
let term = Term::Apply {
function: Term::Apply { function: Term::Apply {
function: default_builtin.into(),
argument: Term::Apply {
function: DefaultFunction::MapData.into(),
argument: Term::Apply {
function: Term::Apply { function: Term::Apply {
function: Term::Builtin(DefaultFunction::IfThenElse) function: Term::Builtin(DefaultFunction::MkCons)
.force_wrap() .force_wrap()
.into(), .into(),
argument: left.into(),
}
.into(),
argument: Term::Constant(UplcConstant::ProtoList(
UplcType::Pair(
UplcType::Data.into(),
UplcType::Data.into(),
),
vec![],
))
.into(),
}
.into(),
}
.into(),
}
.into(),
argument: Term::Apply { argument: Term::Apply {
function: Term::Apply {
function: Term::Builtin(DefaultFunction::MkCons)
.force_wrap()
.into(),
argument: right.into(),
}
.into(),
argument: Term::Constant(UplcConstant::ProtoList(
UplcType::Pair(
UplcType::Data.into(),
UplcType::Data.into(),
),
vec![],
))
.into(),
}
.into(),
};
term = if_else(
term,
Term::Constant(UplcConstant::Bool(false)),
Term::Constant(UplcConstant::Bool(true)),
);
arg_stack.push(term);
return;
} else if tipo.is_list() {
let term = if_else(
Term::Apply {
function: Term::Apply { function: Term::Apply {
function: default_builtin.into(), function: default_builtin.into(),
argument: Term::Apply { argument: Term::Apply {
@ -2750,15 +2750,10 @@ impl<'a> CodeGenerator<'a> {
.into(), .into(),
} }
.into(), .into(),
} },
.into(), Term::Constant(UplcConstant::Bool(false)),
} Term::Constant(UplcConstant::Bool(true)),
.into(), );
argument: Term::Constant(UplcConstant::Bool(false)).into(),
}
.into(),
argument: Term::Constant(UplcConstant::Bool(true)).into(),
};
arg_stack.push(term); arg_stack.push(term);
return; return;
@ -3542,8 +3537,9 @@ impl<'a> CodeGenerator<'a> {
.into(), .into(),
} }
.into(), .into(),
argument: Term::Error.into(), argument: Term::Delay(Term::Error.into()).into(),
}; }
.force_wrap();
arg_stack.push(term); arg_stack.push(term);
} }
@ -3713,7 +3709,7 @@ impl<'a> CodeGenerator<'a> {
function: Term::Apply { function: Term::Apply {
function: Term::Builtin(DefaultFunction::Trace).force_wrap().into(), function: Term::Builtin(DefaultFunction::Trace).force_wrap().into(),
argument: Term::Constant(UplcConstant::String( argument: Term::Constant(UplcConstant::String(
text.unwrap_or_else(|| "aike::trace".to_string()), text.unwrap_or_else(|| "aiken::trace".to_string()),
)) ))
.into(), .into(),
} }