Skip to main content

luaur_ast/methods/
parser_parse_local_deprecated.rs

1use crate::records::ast_array::AstArray;
2use crate::records::ast_attr::AstAttr;
3use crate::records::ast_stat::AstStat;
4use crate::records::parser::Parser;
5
6impl Parser {
7    #[allow(non_snake_case)]
8    pub fn parseLocal_DEPRECATED(&mut self, attributes: &AstArray<*mut AstAttr>) -> *mut AstStat {
9        // C++: `Location start = lexer.current().location; if (attributes.size > 0)
10        // start = attributes.data[0]->location;` — when attributes are present the
11        // statement begins at the attribute, so a `local function` start location
12        // includes the leading `@native`/`@checked`. The port ignored attributes.
13        let mut start = self.lexer.current().location;
14        if attributes.size > 0 {
15            start = unsafe { (**attributes.data.add(0)).base.location };
16        }
17        self.parse_local(
18            start,
19            self.lexer.current().location.begin,
20            attributes,
21            false,
22        )
23    }
24}