luaur-analysis 0.1.0

Luau type checker and type inference (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Node: `cxx:Function:Luau.Analysis:Analysis/src/ToString.cpp:2135:to_string`
//! Source: `Analysis/src/ToString.cpp:2135-2139` (hand-ported)

use alloc::format;
use alloc::string::String;
use luaur_ast::records::location::Location;

/// C++ `std::string toString(const Location& location, int offset = 0, bool useBegin = true)`.
/// NOTE: C++ ignores `useBegin` in the body (it prints both ends); preserved.
pub fn to_string_location_i32_bool(location: &Location, offset: i32, _use_begin: bool) -> String {
    format!(
        "({}, {}) - ({}, {})",
        location.begin.line as i64 + offset as i64,
        location.begin.column as i64 + offset as i64,
        location.end.line as i64 + offset as i64,
        location.end.column as i64 + offset as i64,
    )
}