Skip to main content

luaur_analysis/functions/
string_part_of_interp_string.rs

1use luaur_ast::records::ast_expr_interp_string::AstExprInterpString;
2use luaur_ast::records::ast_node::AstNode;
3use luaur_ast::records::position::Position;
4
5pub fn string_part_of_interp_string(node: *const AstNode, position: Position) -> bool {
6    if node.is_null() {
7        return false;
8    }
9
10    let interp_string = unsafe { (*node).as_item::<AstExprInterpString>() };
11
12    if interp_string.is_null() {
13        return false;
14    }
15
16    let expressions = unsafe { &(*interp_string).expressions };
17
18    for expression in unsafe { expressions.as_slice() } {
19        let expression = *expression;
20        if expression.is_null() {
21            continue;
22        }
23
24        let expr_location = unsafe { &(*expression).base.location };
25        if expr_location.contains(position) {
26            return false;
27        }
28    }
29
30    true
31}