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

Method exec

core/tests/testutils/callables/out_cmd.rs:56–93  ·  view source on GitHub ↗
(&self, scope: Scope<'_>)

Source from the content-addressed store, hash-verified

54 }
55
56 fn exec(&self, scope: Scope<'_>) -> CallResult<()> {
57 let mut line = String::new();
58 let mut argi = 0;
59 let mut reg = 0;
60 loop {
61 let sep = match scope.get_type(reg) {
62 VarArgTag::Immediate(sep, etype) => {
63 reg += 1;
64 let formatted = format_arg(&scope, reg, etype);
65 line.push_str(&format!("{}={}{}", argi, formatted, etype.annotation()));
66 sep
67 }
68 VarArgTag::Missing(sep) => {
69 line.push_str(&format!("{}=()", argi));
70 sep
71 }
72 VarArgTag::Pointer(sep) => {
73 reg += 1;
74 let typed_ptr = scope.get_ref(reg);
75 line.push_str(&format!("{}={}", argi, typed_ptr));
76 sep
77 }
78 };
79 argi += 1;
80 reg += 1;
81
82 if sep == ArgSep::End {
83 break;
84 }
85 line.push(' ');
86 line.push_str(&sep.to_string());
87 line.push(' ');
88 }
89 let mut output = self.output.borrow_mut();
90 output.push_str(&line);
91 output.push('\n');
92 Ok(())
93 }
94}

Callers 1

run_imageFunction · 0.45

Calls 5

format_argFunction · 0.85
get_typeMethod · 0.80
push_strMethod · 0.80
get_refMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected