Skip to content

Commit 4c38226

Browse files
small renaming
1 parent 0a1c14b commit 4c38226

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/bin/wagmi_inspect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
148148
for (name, export) in exports {
149149
match export {
150150
ExportValue::Function(func) => {
151-
println!(" {} : function (params: {}, result: {})", name, func.ty().n_params(), if func.ty().has_result() { "yes" } else { "no" });
151+
println!(" {} : function (params: {}, result: {})", name, func.signature().n_params(), if func.signature().has_result() { "yes" } else { "no" });
152152
}
153153
ExportValue::Table(table) => {
154154
let t = table.borrow();

src/bin/wagmi_run.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
134134
for (name, export) in &instance.exports {
135135
if let ExportValue::Function(func) = export {
136136
print!(" {} (", name);
137-
let n_params = func.ty().n_params();
137+
let n_params = func.signature().n_params();
138138
for i in 0..n_params {
139139
if i > 0 { print!(", "); }
140140
print!("param{}", i);
141141
}
142142
print!(")");
143-
if func.ty().has_result() {
143+
if func.signature().has_result() {
144144
print!(" -> result");
145145
}
146146
println!();
@@ -168,11 +168,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
168168
wasm_args.push(parse_value(arg_str)?);
169169
}
170170

171-
if wasm_args.len() != func.ty().n_params() as usize {
171+
if wasm_args.len() != func.signature().n_params() as usize {
172172
return Err(format!(
173173
"Function '{}' expects {} arguments, but {} provided",
174174
func_name,
175-
func.ty().n_params(),
175+
func.signature().n_params(),
176176
wasm_args.len()
177177
).into());
178178
}

src/instance.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ pub enum RuntimeFunction {
266266
}
267267

268268
impl RuntimeFunction {
269-
pub fn ty(&self) -> RuntimeSignature {
269+
pub fn signature(&self) -> RuntimeSignature {
270270
match self {
271271
RuntimeFunction::Wasm { runtime_sig, .. } => *runtime_sig,
272272
RuntimeFunction::Host { runtime_sig, .. } => *runtime_sig,
273273
}
274274
}
275275

276276
pub fn param_count(&self) -> usize {
277-
self.ty().n_params() as usize
277+
self.signature().n_params() as usize
278278
}
279279

280280
pub fn new_host(
@@ -384,7 +384,7 @@ impl Instance {
384384
let runtime_sig = RuntimeSignature::from_signature(&function.ty);
385385
match imported {
386386
ExportValue::Function(f) => {
387-
if f.ty() != runtime_sig { return Err(Error::Link(INCOMPATIBLE_IMPORT)); }
387+
if f.signature() != runtime_sig { return Err(Error::Link(INCOMPATIBLE_IMPORT)); }
388388
inst.functions.push(f.clone());
389389
}
390390
_ => return Err(Error::Link(INCOMPATIBLE_IMPORT)),
@@ -539,7 +539,7 @@ impl Instance {
539539
if module.start != u32::MAX {
540540
let fi = module.start as usize;
541541
let function = &inst_rc.functions[fi];
542-
if function.ty().n_params() != 0 || function.ty().has_result() { return Err(Error::Validation(START_FUNC)); }
542+
if function.signature().n_params() != 0 || function.signature().has_result() { return Err(Error::Validation(START_FUNC)); }
543543
let mut stack = Vec::with_capacity(64);
544544
let mut return_pc = 0usize;
545545
let mut control: Vec<ControlFrame> = Vec::new();
@@ -1083,7 +1083,7 @@ impl Instance {
10831083
InstanceManager::with(|mgr| {
10841084
if let Some(owner) = mgr.get_instance(owner_id) {
10851085
let callee = &owner.functions[func_idx];
1086-
sig_ok = callee.ty() == expected;
1086+
sig_ok = callee.signature() == expected;
10871087
if sig_ok {
10881088
let n_params = callee.param_count();
10891089
let params_start = stack.len() - n_params;
@@ -1115,7 +1115,7 @@ impl Instance {
11151115
}
11161116

11171117
let callee = self.functions[func_idx].clone();
1118-
if callee.ty() != expected {
1118+
if callee.signature() != expected {
11191119
return Err(Error::Trap(INDIRECT_CALL_MISMATCH));
11201120
}
11211121

0 commit comments

Comments
 (0)