MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / is_special_method

Function is_special_method

crates/cpp/src/lib.rs:3610–3628  ·  view source on GitHub ↗
(func: &Function)

Source from the content-addressed store, hash-verified

3608}
3609
3610fn is_special_method(func: &Function) -> SpecialMethod {
3611 if matches!(func.kind, FunctionKind::Static(_)) {
3612 if func.name.starts_with("[resource-drop]") {
3613 SpecialMethod::ResourceDrop
3614 } else if func.name.starts_with("[resource-new]") {
3615 SpecialMethod::ResourceNew
3616 } else if func.name.starts_with("[resource-rep]") {
3617 SpecialMethod::ResourceRep
3618 } else if func.name.starts_with("[dtor]") {
3619 SpecialMethod::Dtor
3620 } else if func.name == "$alloc" {
3621 SpecialMethod::Allocate
3622 } else {
3623 SpecialMethod::None
3624 }
3625 } else {
3626 SpecialMethod::None
3627 }
3628}
3629
3630/// Sort the specified types topologically, taking the parameter and result
3631/// types of resource functions into consideration.

Callers 5

func_namespace_nameMethod · 0.85
high_level_signatureMethod · 0.85
print_signatureMethod · 0.85
generate_functionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected