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

Method flags

crates/wit-bindgen/src/config.rs:67–96  ·  view source on GitHub ↗

Returns the set of configuration flags associated with `func`. The `name` provided should include the full name of the function including its interface. The `kind` is the classification of the function in WIT which affects the default set of flags.

(
        &mut self,
        resolve: &Resolve,
        ns: Option<&WorldKey>,
        func: &Function,
    )

Source from the content-addressed store, hash-verified

65 /// including its interface. The `kind` is the classification of the
66 /// function in WIT which affects the default set of flags.
67 pub(crate) fn flags(
68 &mut self,
69 resolve: &Resolve,
70 ns: Option<&WorldKey>,
71 func: &Function,
72 ) -> FunctionFlags {
73 let mut wit_flags = FunctionFlags::empty();
74
75 // If the kind is async, then set the async/store flags as that's a
76 // concurrent function which requires access to both.
77 match &func.kind {
78 FunctionKind::Freestanding
79 | FunctionKind::Method(_)
80 | FunctionKind::Static(_)
81 | FunctionKind::Constructor(_) => {}
82
83 FunctionKind::AsyncFreestanding
84 | FunctionKind::AsyncMethod(_)
85 | FunctionKind::AsyncStatic(_) => {
86 wit_flags |= FunctionFlags::ASYNC | FunctionFlags::STORE;
87 }
88 }
89
90 let mut ret = FunctionFlags::empty();
91 self.add_function_flags(resolve, ns, &func.name, &mut ret);
92 if !ret.contains(FunctionFlags::IGNORE_WIT) {
93 ret |= wit_flags;
94 }
95 ret
96 }
97
98 pub(crate) fn resource_drop_flags(
99 &mut self,

Callers 8

disasFunction · 0.45
detect_precompiledFunction · 0.45
newMethod · 0.45
hashMethod · 0.45

Calls 3

add_function_flagsMethod · 0.80
emptyFunction · 0.50
containsMethod · 0.45

Tested by

no test coverage detected