luaur_ast/methods/
parser_prepare_function_arguments.rs1use crate::records::ast_array::AstArray;
2use crate::records::ast_local::AstLocal;
3use crate::records::binding::Binding;
4use crate::records::location::Location;
5use crate::records::parser::Parser;
6use crate::records::temp_vector::TempVector;
7
8impl Parser {
9 #[allow(non_snake_case)]
10 pub fn prepare_function_arguments(
11 &mut self,
12 start: &Location,
13 hasself: bool,
14 args: &TempVector<'_, Binding>,
15 ) -> (*mut AstLocal, AstArray<*mut AstLocal>) {
16 let mut self_local: *mut AstLocal = core::ptr::null_mut();
17
18 if hasself {
19 let binding = Binding::new(
22 crate::records::name::Name {
23 name: self.name_self,
24 location: *start,
25 },
26 core::ptr::null_mut(),
27 crate::records::position::Position::default(),
28 false,
29 );
30 self_local = self.push_local(&binding);
31 }
32
33 let mut vars: alloc::vec::Vec<*mut AstLocal> = alloc::vec::Vec::new();
38 for i in 0..args.size() {
39 let local = self.push_local(&args[i]);
40 vars.push(local);
41 }
42
43 let copied = self.copy_initializer_list_t(&vars);
44 (self_local, copied)
45 }
46}