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,
)
| 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, |
no test coverage detected