MCPcopy Index your code
hub / github.com/endbasic/endbasic / exec

Method exec

core/src/testutils.rs:67–110  ·  view source on GitHub ↗
(&self, scope: Scope<'_>)

Source from the content-addressed store, hash-verified

65 }
66
67 fn exec(&self, scope: Scope<'_>) -> CallResult<()> {
68 let mut first = true;
69 let mut text = String::new();
70 let mut reg = 0;
71 loop {
72 if !first {
73 text += " ";
74 }
75 first = false;
76
77 let sep = match scope.get_type(reg) {
78 VarArgTag::Immediate(sep, etype) => {
79 reg += 1;
80 match etype {
81 ExprType::Boolean => text.push_str(&format!("{}", scope.get_boolean(reg))),
82 ExprType::Double => text.push_str(&format!("{}", scope.get_double(reg))),
83 ExprType::Integer => text.push_str(&format!("{}", scope.get_integer(reg))),
84 ExprType::Text => text.push_str(scope.get_string(reg)),
85 }
86 sep
87 }
88 VarArgTag::Missing(sep) => {
89 text.push_str("<EMPTY>");
90 sep
91 }
92 VarArgTag::Pointer(sep) => {
93 reg += 1;
94 let typed_ptr = scope.get_ref(reg);
95 text.push_str(&typed_ptr.to_string());
96 sep
97 }
98 };
99 reg += 1;
100
101 if sep == ArgSep::End {
102 break;
103 }
104 text.push(' ');
105 text.push_str(&sep.to_string());
106 text.push(' ');
107 }
108 self.data.borrow_mut().push(text);
109 Ok(())
110 }
111}

Callers

nothing calls this directly

Calls 5

get_typeMethod · 0.80
push_strMethod · 0.80
get_stringMethod · 0.80
get_refMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected