MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / def_var

Method def_var

cranelift/frontend/src/frontend.rs:507–517  ·  view source on GitHub ↗

Register a new definition of a user variable. The type of the value must be the same as the type registered for the variable.

(&mut self, var: Variable, val: Value)

Source from the content-addressed store, hash-verified

505 /// Register a new definition of a user variable. The type of the value must be
506 /// the same as the type registered for the variable.
507 pub fn def_var(&mut self, var: Variable, val: Value) {
508 self.try_def_var(var, val)
509 .unwrap_or_else(|error| match error {
510 DefVariableError::TypeMismatch(var, val) => {
511 panic!("declared type of variable {var:?} doesn't match type of value {val}");
512 }
513 DefVariableError::DefinedBeforeDeclared(var) => {
514 panic!("variable {var:?} is used but its type has not been declared");
515 }
516 })
517 }
518
519 /// Set label for [`Value`]
520 ///

Callers 3

try_def_varMethod · 0.45
sample_functionFunction · 0.45
try_callFunction · 0.45

Calls 1

try_def_varMethod · 0.80

Tested by 1

try_callFunction · 0.36