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

Method new

crates/csharp/src/function.rs:41–77  ·  view source on GitHub ↗
(
        interface_gen: &'b mut InterfaceGenerator<'a>,
        func_name: &'b str,
        kind: &'b FunctionKind,
        params: Box<[String]>,
        results: Vec<TypeId>,
        parameter_type

Source from the content-addressed store, hash-verified

39
40impl<'a, 'b> FunctionBindgen<'a, 'b> {
41 pub(crate) fn new(
42 interface_gen: &'b mut InterfaceGenerator<'a>,
43 func_name: &'b str,
44 kind: &'b FunctionKind,
45 params: Box<[String]>,
46 results: Vec<TypeId>,
47 parameter_type: ParameterType,
48 result_type: Option<Type>,
49 ) -> FunctionBindgen<'a, 'b> {
50 let mut locals = Ns::default();
51 // Ensure temporary variable names don't clash with parameter names:
52 for param in &params[..] {
53 locals.tmp(param);
54 }
55
56 Self {
57 interface_gen,
58 func_name,
59 kind,
60 params,
61 results,
62 src: String::new(),
63 locals,
64 block_storage: Vec::new(),
65 blocks: Vec::new(),
66 payloads: Vec::new(),
67 needs_cleanup: false,
68 import_return_pointer_area_size: 0,
69 import_return_pointer_area_align: 0,
70 resource_drops: Vec::new(),
71 is_block: false,
72 fixed_statments: Vec::new(),
73 parameter_type: parameter_type,
74 result_type: result_type,
75 resource_type_name: None,
76 }
77 }
78
79 fn lower_variant(
80 &mut self,

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
tmpMethod · 0.45

Tested by

no test coverage detected