rubydex 0.1.0.beta1-x86_64-linux → 0.1.0.beta2-x86_64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/rubydex/declaration.c +146 -0
- data/ext/rubydex/declaration.h +10 -0
- data/ext/rubydex/definition.c +234 -0
- data/ext/rubydex/definition.h +28 -0
- data/ext/rubydex/diagnostic.c +6 -0
- data/ext/rubydex/diagnostic.h +11 -0
- data/ext/rubydex/document.c +98 -0
- data/ext/rubydex/document.h +10 -0
- data/ext/rubydex/extconf.rb +36 -15
- data/ext/rubydex/graph.c +405 -0
- data/ext/rubydex/graph.h +10 -0
- data/ext/rubydex/handle.h +44 -0
- data/ext/rubydex/location.c +22 -0
- data/ext/rubydex/location.h +15 -0
- data/ext/rubydex/reference.c +104 -0
- data/ext/rubydex/reference.h +16 -0
- data/ext/rubydex/rubydex.c +22 -0
- data/ext/rubydex/utils.c +27 -0
- data/ext/rubydex/utils.h +13 -0
- data/lib/rubydex/3.2/rubydex.so +0 -0
- data/lib/rubydex/3.3/rubydex.so +0 -0
- data/lib/rubydex/3.4/rubydex.so +0 -0
- data/lib/rubydex/4.0/rubydex.so +0 -0
- data/lib/rubydex/librubydex_sys.so +0 -0
- data/lib/rubydex/version.rb +1 -1
- data/rust/Cargo.lock +1275 -0
- data/rust/Cargo.toml +23 -0
- data/rust/about.hbs +78 -0
- data/rust/about.toml +9 -0
- data/rust/rubydex/Cargo.toml +41 -0
- data/rust/rubydex/src/diagnostic.rs +108 -0
- data/rust/rubydex/src/errors.rs +28 -0
- data/rust/rubydex/src/indexing/local_graph.rs +172 -0
- data/rust/rubydex/src/indexing/ruby_indexer.rs +5397 -0
- data/rust/rubydex/src/indexing.rs +128 -0
- data/rust/rubydex/src/job_queue.rs +186 -0
- data/rust/rubydex/src/lib.rs +15 -0
- data/rust/rubydex/src/listing.rs +249 -0
- data/rust/rubydex/src/main.rs +116 -0
- data/rust/rubydex/src/model/comment.rs +24 -0
- data/rust/rubydex/src/model/declaration.rs +541 -0
- data/rust/rubydex/src/model/definitions.rs +1475 -0
- data/rust/rubydex/src/model/document.rs +111 -0
- data/rust/rubydex/src/model/encoding.rs +22 -0
- data/rust/rubydex/src/model/graph.rs +1387 -0
- data/rust/rubydex/src/model/id.rs +90 -0
- data/rust/rubydex/src/model/identity_maps.rs +54 -0
- data/rust/rubydex/src/model/ids.rs +32 -0
- data/rust/rubydex/src/model/name.rs +188 -0
- data/rust/rubydex/src/model/references.rs +129 -0
- data/rust/rubydex/src/model/string_ref.rs +44 -0
- data/rust/rubydex/src/model/visibility.rs +41 -0
- data/rust/rubydex/src/model.rs +13 -0
- data/rust/rubydex/src/offset.rs +70 -0
- data/rust/rubydex/src/position.rs +6 -0
- data/rust/rubydex/src/query.rs +103 -0
- data/rust/rubydex/src/resolution.rs +4421 -0
- data/rust/rubydex/src/stats/memory.rs +71 -0
- data/rust/rubydex/src/stats/timer.rs +126 -0
- data/rust/rubydex/src/stats.rs +9 -0
- data/rust/rubydex/src/test_utils/context.rs +226 -0
- data/rust/rubydex/src/test_utils/graph_test.rs +229 -0
- data/rust/rubydex/src/test_utils/local_graph_test.rs +166 -0
- data/rust/rubydex/src/test_utils.rs +52 -0
- data/rust/rubydex/src/visualization/dot.rs +176 -0
- data/rust/rubydex/src/visualization.rs +6 -0
- data/rust/rubydex/tests/cli.rs +167 -0
- data/rust/rubydex-sys/Cargo.toml +20 -0
- data/rust/rubydex-sys/build.rs +14 -0
- data/rust/rubydex-sys/cbindgen.toml +12 -0
- data/rust/rubydex-sys/src/declaration_api.rs +114 -0
- data/rust/rubydex-sys/src/definition_api.rs +350 -0
- data/rust/rubydex-sys/src/diagnostic_api.rs +99 -0
- data/rust/rubydex-sys/src/document_api.rs +54 -0
- data/rust/rubydex-sys/src/graph_api.rs +493 -0
- data/rust/rubydex-sys/src/lib.rs +9 -0
- data/rust/rubydex-sys/src/location_api.rs +79 -0
- data/rust/rubydex-sys/src/name_api.rs +81 -0
- data/rust/rubydex-sys/src/reference_api.rs +191 -0
- data/rust/rubydex-sys/src/utils.rs +50 -0
- data/rust/rustfmt.toml +2 -0
- metadata +77 -2
data/rust/Cargo.toml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[workspace]
|
|
2
|
+
members = [
|
|
3
|
+
"rubydex",
|
|
4
|
+
"rubydex-sys",
|
|
5
|
+
]
|
|
6
|
+
|
|
7
|
+
resolver = "3"
|
|
8
|
+
|
|
9
|
+
[profile.release]
|
|
10
|
+
lto = true
|
|
11
|
+
opt-level = 3
|
|
12
|
+
codegen-units = 1
|
|
13
|
+
|
|
14
|
+
[workspace.lints.clippy]
|
|
15
|
+
# See: https://doc.rust-lang.org/clippy/lints.html
|
|
16
|
+
correctness = "deny"
|
|
17
|
+
suspicious = "deny"
|
|
18
|
+
perf = "deny"
|
|
19
|
+
complexity = "deny"
|
|
20
|
+
style = "deny"
|
|
21
|
+
pedantic = "warn"
|
|
22
|
+
|
|
23
|
+
ptr-as-ptr = { level = "deny", priority = 1 }
|
data/rust/about.hbs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<style>
|
|
5
|
+
@media (prefers-color-scheme: dark) {
|
|
6
|
+
body {
|
|
7
|
+
background: #333;
|
|
8
|
+
color: white;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
a {
|
|
12
|
+
color: skyblue;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.container {
|
|
17
|
+
font-family: sans-serif;
|
|
18
|
+
max-width: 800px;
|
|
19
|
+
margin: 0 auto;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.intro {
|
|
23
|
+
text-align: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.licenses-list {
|
|
27
|
+
list-style-type: none;
|
|
28
|
+
margin: 0;
|
|
29
|
+
padding: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.license-used-by {
|
|
33
|
+
margin-top: -10px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.license-text {
|
|
37
|
+
max-height: 200px;
|
|
38
|
+
overflow-y: scroll;
|
|
39
|
+
white-space: pre-wrap;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
42
|
+
</head>
|
|
43
|
+
|
|
44
|
+
<body>
|
|
45
|
+
<main class="container">
|
|
46
|
+
<div class="intro">
|
|
47
|
+
<h1>Third Party Licenses</h1>
|
|
48
|
+
<p>This page lists the licenses of the projects used in Rubydex.</p>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<h2>Overview of licenses:</h2>
|
|
52
|
+
<ul class="licenses-overview">
|
|
53
|
+
{{#each overview}}
|
|
54
|
+
<li><a href="#{{id}}">{{name}}</a> ({{count}})</li>
|
|
55
|
+
{{/each}}
|
|
56
|
+
</ul>
|
|
57
|
+
|
|
58
|
+
<h2>All license text:</h2>
|
|
59
|
+
<ul class="licenses-list">
|
|
60
|
+
{{#each licenses}}
|
|
61
|
+
<li class="license">
|
|
62
|
+
<h3 id="{{id}}">{{name}}</h3>
|
|
63
|
+
<h4>Used by:</h4>
|
|
64
|
+
<ul class="license-used-by">
|
|
65
|
+
{{#each used_by}}
|
|
66
|
+
<li><a
|
|
67
|
+
href="{{#if crate.repository}} {{crate.repository}} {{else}} https://crates.io/crates/{{crate.name}} {{/if}}">{{crate.name}}
|
|
68
|
+
{{crate.version}}</a></li>
|
|
69
|
+
{{/each}}
|
|
70
|
+
</ul>
|
|
71
|
+
<pre class="license-text">{{text}}</pre>
|
|
72
|
+
</li>
|
|
73
|
+
{{/each}}
|
|
74
|
+
</ul>
|
|
75
|
+
</main>
|
|
76
|
+
</body>
|
|
77
|
+
|
|
78
|
+
</html>
|
data/rust/about.toml
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "rubydex"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
rust-version = "1.89.0"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
|
|
8
|
+
[[bin]]
|
|
9
|
+
name = "rubydex_cli"
|
|
10
|
+
path = "src/main.rs"
|
|
11
|
+
|
|
12
|
+
[lib]
|
|
13
|
+
crate-type = ["rlib"]
|
|
14
|
+
|
|
15
|
+
[features]
|
|
16
|
+
test_utils = ["dep:tempfile"]
|
|
17
|
+
|
|
18
|
+
[dependencies]
|
|
19
|
+
ruby-prism = "1.6.0"
|
|
20
|
+
url = "2.5.4"
|
|
21
|
+
xxhash-rust = { version = "0.8.15", features = ["xxh3"] }
|
|
22
|
+
clap = { version = "4.5.16", features = ["derive"] }
|
|
23
|
+
glob = "0.3.2"
|
|
24
|
+
bitflags = "2.9"
|
|
25
|
+
bytecount = "0.6.9"
|
|
26
|
+
libc = "0.2"
|
|
27
|
+
line-index = "0.1.2"
|
|
28
|
+
tempfile = { version = "3.0", optional = true }
|
|
29
|
+
crossbeam-deque = "0.8"
|
|
30
|
+
crossbeam-utils = "0.8"
|
|
31
|
+
crossbeam-channel = "0.5"
|
|
32
|
+
|
|
33
|
+
[dev-dependencies]
|
|
34
|
+
rubydex = { path = ".", features = ["test_utils"] }
|
|
35
|
+
tempfile = "3.0"
|
|
36
|
+
assert_cmd = "2.0"
|
|
37
|
+
predicates = "3.1"
|
|
38
|
+
regex = "1.10"
|
|
39
|
+
|
|
40
|
+
[lints]
|
|
41
|
+
workspace = true
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#[cfg(any(test, feature = "test_utils"))]
|
|
2
|
+
use crate::model::document::Document;
|
|
3
|
+
use crate::{model::ids::UriId, offset::Offset};
|
|
4
|
+
|
|
5
|
+
#[derive(Debug)]
|
|
6
|
+
pub struct Diagnostic {
|
|
7
|
+
rule: Rule,
|
|
8
|
+
uri_id: UriId,
|
|
9
|
+
offset: Offset,
|
|
10
|
+
message: String,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
impl Diagnostic {
|
|
14
|
+
#[must_use]
|
|
15
|
+
pub fn new(rule: Rule, uri_id: UriId, offset: Offset, message: String) -> Self {
|
|
16
|
+
Self {
|
|
17
|
+
rule,
|
|
18
|
+
uri_id,
|
|
19
|
+
offset,
|
|
20
|
+
message,
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#[must_use]
|
|
25
|
+
pub fn rule(&self) -> &Rule {
|
|
26
|
+
&self.rule
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#[must_use]
|
|
30
|
+
pub fn uri_id(&self) -> &UriId {
|
|
31
|
+
&self.uri_id
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#[must_use]
|
|
35
|
+
pub fn offset(&self) -> &Offset {
|
|
36
|
+
&self.offset
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#[must_use]
|
|
40
|
+
pub fn message(&self) -> &str {
|
|
41
|
+
&self.message
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#[cfg(any(test, feature = "test_utils"))]
|
|
45
|
+
#[must_use]
|
|
46
|
+
pub fn formatted(&self, document: &Document) -> String {
|
|
47
|
+
format!(
|
|
48
|
+
"{}: {} ({})",
|
|
49
|
+
self.rule(),
|
|
50
|
+
self.message(),
|
|
51
|
+
self.offset().to_display_range(document)
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
fn camel_to_snake(s: &str) -> String {
|
|
57
|
+
let mut snake = String::new();
|
|
58
|
+
for (i, ch) in s.chars().enumerate() {
|
|
59
|
+
if ch.is_uppercase() {
|
|
60
|
+
if i != 0 {
|
|
61
|
+
snake.push('-');
|
|
62
|
+
}
|
|
63
|
+
for lc in ch.to_lowercase() {
|
|
64
|
+
snake.push(lc);
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
snake.push(ch);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
snake
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
macro_rules! rules {
|
|
74
|
+
(
|
|
75
|
+
$( $variant:ident );* $(;)?
|
|
76
|
+
) => {
|
|
77
|
+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
|
78
|
+
pub enum Rule {
|
|
79
|
+
$(
|
|
80
|
+
$variant,
|
|
81
|
+
)*
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
impl std::fmt::Display for Rule {
|
|
85
|
+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
86
|
+
write!(f, "{}", match self {
|
|
87
|
+
$(
|
|
88
|
+
Rule::$variant => camel_to_snake(stringify!($variant)),
|
|
89
|
+
)*
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
rules! {
|
|
97
|
+
// Parsing
|
|
98
|
+
ParseError;
|
|
99
|
+
ParseWarning;
|
|
100
|
+
|
|
101
|
+
// Indexing
|
|
102
|
+
DynamicConstantReference;
|
|
103
|
+
DynamicSingletonDefinition;
|
|
104
|
+
DynamicAncestor;
|
|
105
|
+
TopLevelMixinSelf;
|
|
106
|
+
|
|
107
|
+
// Resolution
|
|
108
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
macro_rules! errors {
|
|
2
|
+
(
|
|
3
|
+
$( $variant:ident );* $(;)?
|
|
4
|
+
) => {
|
|
5
|
+
#[derive(Debug, PartialEq, Eq)]
|
|
6
|
+
pub enum Errors {
|
|
7
|
+
$(
|
|
8
|
+
$variant(String),
|
|
9
|
+
)*
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl std::fmt::Display for Errors {
|
|
13
|
+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
14
|
+
match self {
|
|
15
|
+
$(
|
|
16
|
+
Errors::$variant(msg) => write!(f, "{}: {}", stringify!($variant), msg),
|
|
17
|
+
)*
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
impl std::error::Error for Errors {}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
errors!(
|
|
27
|
+
FileError;
|
|
28
|
+
);
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
use std::collections::hash_map::Entry;
|
|
2
|
+
|
|
3
|
+
use crate::diagnostic::{Diagnostic, Rule};
|
|
4
|
+
use crate::model::definitions::Definition;
|
|
5
|
+
use crate::model::document::Document;
|
|
6
|
+
use crate::model::identity_maps::IdentityHashMap;
|
|
7
|
+
use crate::model::ids::{DefinitionId, NameId, ReferenceId, StringId, UriId};
|
|
8
|
+
use crate::model::name::{Name, NameRef};
|
|
9
|
+
use crate::model::references::{ConstantReference, MethodRef};
|
|
10
|
+
use crate::model::string_ref::StringRef;
|
|
11
|
+
use crate::offset::Offset;
|
|
12
|
+
|
|
13
|
+
type LocalGraphParts = (
|
|
14
|
+
UriId,
|
|
15
|
+
Document,
|
|
16
|
+
IdentityHashMap<DefinitionId, Definition>,
|
|
17
|
+
IdentityHashMap<StringId, StringRef>,
|
|
18
|
+
IdentityHashMap<NameId, NameRef>,
|
|
19
|
+
IdentityHashMap<ReferenceId, ConstantReference>,
|
|
20
|
+
IdentityHashMap<ReferenceId, MethodRef>,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
#[derive(Debug)]
|
|
24
|
+
pub struct LocalGraph {
|
|
25
|
+
uri_id: UriId,
|
|
26
|
+
document: Document,
|
|
27
|
+
definitions: IdentityHashMap<DefinitionId, Definition>,
|
|
28
|
+
strings: IdentityHashMap<StringId, StringRef>,
|
|
29
|
+
names: IdentityHashMap<NameId, NameRef>,
|
|
30
|
+
constant_references: IdentityHashMap<ReferenceId, ConstantReference>,
|
|
31
|
+
method_references: IdentityHashMap<ReferenceId, MethodRef>,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
impl LocalGraph {
|
|
35
|
+
#[must_use]
|
|
36
|
+
pub fn new(uri_id: UriId, document: Document) -> Self {
|
|
37
|
+
Self {
|
|
38
|
+
uri_id,
|
|
39
|
+
document,
|
|
40
|
+
definitions: IdentityHashMap::default(),
|
|
41
|
+
strings: IdentityHashMap::default(),
|
|
42
|
+
names: IdentityHashMap::default(),
|
|
43
|
+
constant_references: IdentityHashMap::default(),
|
|
44
|
+
method_references: IdentityHashMap::default(),
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#[must_use]
|
|
49
|
+
pub fn uri_id(&self) -> UriId {
|
|
50
|
+
self.uri_id
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#[must_use]
|
|
54
|
+
pub fn document(&self) -> &Document {
|
|
55
|
+
&self.document
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Definitions
|
|
59
|
+
|
|
60
|
+
#[must_use]
|
|
61
|
+
pub fn definitions(&self) -> &IdentityHashMap<DefinitionId, Definition> {
|
|
62
|
+
&self.definitions
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#[must_use]
|
|
66
|
+
pub fn get_definition_mut(&mut self, definition_id: DefinitionId) -> Option<&mut Definition> {
|
|
67
|
+
self.definitions.get_mut(&definition_id)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
pub fn add_definition(&mut self, definition: Definition) -> DefinitionId {
|
|
71
|
+
let definition_id = definition.id();
|
|
72
|
+
self.definitions.insert(definition_id, definition);
|
|
73
|
+
self.document.add_definition(definition_id);
|
|
74
|
+
|
|
75
|
+
definition_id
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Strings
|
|
79
|
+
|
|
80
|
+
#[must_use]
|
|
81
|
+
pub fn strings(&self) -> &IdentityHashMap<StringId, StringRef> {
|
|
82
|
+
&self.strings
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
pub fn intern_string(&mut self, string: String) -> StringId {
|
|
86
|
+
let string_id = StringId::from(&string);
|
|
87
|
+
match self.strings.entry(string_id) {
|
|
88
|
+
Entry::Occupied(mut entry) => {
|
|
89
|
+
entry.get_mut().increment_ref_count(1);
|
|
90
|
+
}
|
|
91
|
+
Entry::Vacant(entry) => {
|
|
92
|
+
entry.insert(StringRef::new(string));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
string_id
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Names
|
|
99
|
+
|
|
100
|
+
#[must_use]
|
|
101
|
+
pub fn names(&self) -> &IdentityHashMap<NameId, NameRef> {
|
|
102
|
+
&self.names
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
pub fn add_name(&mut self, name: Name) -> NameId {
|
|
106
|
+
let name_id = name.id();
|
|
107
|
+
match self.names.entry(name_id) {
|
|
108
|
+
Entry::Occupied(mut entry) => {
|
|
109
|
+
entry.get_mut().increment_ref_count(1);
|
|
110
|
+
}
|
|
111
|
+
Entry::Vacant(entry) => {
|
|
112
|
+
entry.insert(NameRef::Unresolved(Box::new(name)));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
name_id
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Constant references
|
|
119
|
+
|
|
120
|
+
#[must_use]
|
|
121
|
+
pub fn constant_references(&self) -> &IdentityHashMap<ReferenceId, ConstantReference> {
|
|
122
|
+
&self.constant_references
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
pub fn add_constant_reference(&mut self, reference: ConstantReference) -> ReferenceId {
|
|
126
|
+
let reference_id = reference.id();
|
|
127
|
+
self.constant_references.insert(reference_id, reference);
|
|
128
|
+
self.document.add_constant_reference(reference_id);
|
|
129
|
+
reference_id
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Method references
|
|
133
|
+
|
|
134
|
+
#[must_use]
|
|
135
|
+
pub fn method_references(&self) -> &IdentityHashMap<ReferenceId, MethodRef> {
|
|
136
|
+
&self.method_references
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
pub fn add_method_reference(&mut self, reference: MethodRef) -> ReferenceId {
|
|
140
|
+
let reference_id = reference.id();
|
|
141
|
+
self.method_references.insert(reference_id, reference);
|
|
142
|
+
self.document.add_method_reference(reference_id);
|
|
143
|
+
reference_id
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Diagnostics
|
|
147
|
+
|
|
148
|
+
#[must_use]
|
|
149
|
+
pub fn diagnostics(&self) -> &[Diagnostic] {
|
|
150
|
+
self.document.diagnostics()
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
pub fn add_diagnostic(&mut self, rule: Rule, offset: Offset, message: String) {
|
|
154
|
+
let diagnostic = Diagnostic::new(rule, self.uri_id, offset, message);
|
|
155
|
+
self.document.add_diagnostic(diagnostic);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Into parts
|
|
159
|
+
|
|
160
|
+
#[must_use]
|
|
161
|
+
pub fn into_parts(self) -> LocalGraphParts {
|
|
162
|
+
(
|
|
163
|
+
self.uri_id,
|
|
164
|
+
self.document,
|
|
165
|
+
self.definitions,
|
|
166
|
+
self.strings,
|
|
167
|
+
self.names,
|
|
168
|
+
self.constant_references,
|
|
169
|
+
self.method_references,
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
}
|