fix: trace and scope issues

fix scope issues involving fieldsexpose and other destructureing pattern
fix trace to extract string from term.
This commit is contained in:
Kasey White
2023-03-21 12:38:13 -04:00
parent 77f58cf5cb
commit bb820ebdd8
4 changed files with 37 additions and 21 deletions

View File

@@ -38,8 +38,8 @@ impl Term<Name> {
Term::Constant(Constant::Integer(i).into())
}
pub fn string(s: String) -> Self {
Term::Constant(Constant::String(s).into())
pub fn string(s: impl ToString) -> Self {
Term::Constant(Constant::String(s.to_string()).into())
}
pub fn byte_string(b: Vec<u8>) -> Self {
@@ -203,10 +203,10 @@ impl Term<Name> {
.force()
}
pub fn trace(self, msg: String) -> Self {
pub fn trace(self, msg_term: Term<Name>) -> Self {
Term::Builtin(DefaultFunction::Trace)
.force()
.apply(Term::string(msg))
.apply(msg_term)
.apply(self.delay())
.force()
}