1#![allow(clippy::wildcard_imports)]
2#![allow(clippy::exhaustive_enums)]
3#![allow(clippy::float_arithmetic)]
4#![allow(clippy::pub_use)]
5#![allow(clippy::else_if_without_else)]
6#![allow(clippy::match_wildcard_for_single_variants)]
7
8use mago_database::file::File;
9use mago_span::Span;
10use mago_word::Word;
11use mago_word::concat_word;
12
13pub mod assertion;
14pub mod consts;
15pub mod context;
16pub mod diff;
17pub mod differ;
18pub mod flags;
19pub mod identifier;
20pub mod issue;
21pub mod metadata;
22pub mod misc;
23pub mod operator_overloading;
24pub mod populator;
25pub mod reference;
26pub mod scanner;
27pub mod signature;
28pub mod signature_builder;
29pub mod symbol;
30pub mod ttype;
31pub mod visibility;
32
33mod utils;
34
35#[must_use]
42pub fn build_synthetic_name(prefix: &str, file: &File, span: Span) -> Word {
43 let line = file.line_number(span.start.offset).saturating_add(1);
44 let column = file.column_number(span.start.offset).saturating_add(1);
45
46 let mut line_buffer = itoa::Buffer::new();
47 let mut column_buffer = itoa::Buffer::new();
48
49 concat_word!(
50 b"{",
51 prefix.as_bytes(),
52 b":",
53 file.name.as_ref(),
54 b":",
55 line_buffer.format(line).as_bytes(),
56 b":",
57 column_buffer.format(column).as_bytes(),
58 b"}",
59 )
60}
61
62#[must_use]
63pub fn get_anonymous_class_name(file: &File, span: Span) -> Word {
64 build_synthetic_name("anonymous-class", file, span)
65}