rubydex 0.1.0.beta11 → 0.1.0.beta13
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/LICENSE.txt +23 -23
- data/README.md +125 -125
- data/THIRD_PARTY_LICENSES.html +2018 -945
- data/exe/rdx +47 -47
- data/ext/rubydex/declaration.c +453 -388
- data/ext/rubydex/declaration.h +23 -23
- data/ext/rubydex/definition.c +284 -197
- data/ext/rubydex/definition.h +28 -28
- data/ext/rubydex/diagnostic.c +6 -6
- data/ext/rubydex/diagnostic.h +11 -11
- data/ext/rubydex/document.c +97 -98
- data/ext/rubydex/document.h +10 -10
- data/ext/rubydex/extconf.rb +146 -127
- data/ext/rubydex/graph.c +701 -512
- data/ext/rubydex/graph.h +10 -10
- data/ext/rubydex/handle.h +44 -44
- data/ext/rubydex/location.c +22 -22
- data/ext/rubydex/location.h +15 -15
- data/ext/rubydex/reference.c +123 -104
- data/ext/rubydex/reference.h +15 -16
- data/ext/rubydex/rubydex.c +22 -22
- data/ext/rubydex/utils.c +108 -86
- data/ext/rubydex/utils.h +34 -28
- data/lib/rubydex/comment.rb +17 -17
- data/lib/rubydex/declaration.rb +11 -0
- data/lib/rubydex/diagnostic.rb +21 -21
- data/lib/rubydex/failures.rb +15 -15
- data/lib/rubydex/graph.rb +98 -92
- data/lib/rubydex/keyword.rb +17 -0
- data/lib/rubydex/keyword_parameter.rb +13 -0
- data/lib/rubydex/location.rb +90 -90
- data/lib/rubydex/mixin.rb +22 -0
- data/lib/rubydex/version.rb +5 -5
- data/lib/rubydex.rb +24 -20
- data/rbi/rubydex.rbi +425 -310
- data/rust/Cargo.lock +1851 -1851
- data/rust/Cargo.toml +29 -29
- data/rust/about.toml +10 -10
- data/rust/{about.hbs → about_templates/about.hbs} +81 -78
- data/rust/about_templates/mingw_licenses.hbs +1071 -0
- data/rust/rubydex/Cargo.toml +42 -42
- data/rust/rubydex/src/compile_assertions.rs +13 -13
- data/rust/rubydex/src/diagnostic.rs +110 -109
- data/rust/rubydex/src/errors.rs +28 -28
- data/rust/rubydex/src/indexing/local_graph.rs +224 -224
- data/rust/rubydex/src/indexing/rbs_indexer.rs +1551 -1554
- data/rust/rubydex/src/indexing/ruby_indexer.rs +2329 -6753
- data/rust/rubydex/src/indexing/ruby_indexer_tests.rs +4962 -0
- data/rust/rubydex/src/indexing.rs +210 -210
- data/rust/rubydex/src/integrity.rs +279 -278
- data/rust/rubydex/src/job_queue.rs +199 -205
- data/rust/rubydex/src/lib.rs +17 -17
- data/rust/rubydex/src/listing.rs +371 -272
- data/rust/rubydex/src/main.rs +160 -160
- data/rust/rubydex/src/model/built_in.rs +83 -0
- data/rust/rubydex/src/model/comment.rs +24 -24
- data/rust/rubydex/src/model/declaration.rs +679 -588
- data/rust/rubydex/src/model/definitions.rs +1682 -1602
- data/rust/rubydex/src/model/document.rs +222 -252
- data/rust/rubydex/src/model/encoding.rs +22 -22
- data/rust/rubydex/src/model/graph.rs +3782 -3556
- data/rust/rubydex/src/model/id.rs +110 -110
- data/rust/rubydex/src/model/identity_maps.rs +58 -58
- data/rust/rubydex/src/model/ids.rs +60 -38
- data/rust/rubydex/src/model/keywords.rs +256 -256
- data/rust/rubydex/src/model/name.rs +298 -298
- data/rust/rubydex/src/model/references.rs +111 -111
- data/rust/rubydex/src/model/string_ref.rs +50 -50
- data/rust/rubydex/src/model/visibility.rs +41 -41
- data/rust/rubydex/src/model.rs +15 -14
- data/rust/rubydex/src/offset.rs +147 -147
- data/rust/rubydex/src/position.rs +6 -6
- data/rust/rubydex/src/query.rs +1841 -1700
- data/rust/rubydex/src/resolution.rs +1852 -5895
- data/rust/rubydex/src/resolution_tests.rs +4701 -0
- data/rust/rubydex/src/stats/memory.rs +71 -71
- data/rust/rubydex/src/stats/orphan_report.rs +264 -263
- data/rust/rubydex/src/stats/timer.rs +127 -127
- data/rust/rubydex/src/stats.rs +11 -11
- data/rust/rubydex/src/test_utils/context.rs +226 -226
- data/rust/rubydex/src/test_utils/graph_test.rs +730 -679
- data/rust/rubydex/src/test_utils/local_graph_test.rs +602 -602
- data/rust/rubydex/src/test_utils.rs +52 -52
- data/rust/rubydex/src/visualization/dot.rs +192 -176
- data/rust/rubydex/src/visualization.rs +6 -6
- data/rust/rubydex/tests/cli.rs +185 -167
- data/rust/rubydex-mcp/Cargo.toml +28 -28
- data/rust/rubydex-mcp/src/main.rs +48 -48
- data/rust/rubydex-mcp/src/server.rs +1145 -1145
- data/rust/rubydex-mcp/src/tools.rs +49 -49
- data/rust/rubydex-mcp/tests/mcp.rs +302 -302
- data/rust/rubydex-sys/Cargo.toml +20 -20
- data/rust/rubydex-sys/build.rs +14 -14
- data/rust/rubydex-sys/cbindgen.toml +12 -12
- data/rust/rubydex-sys/src/declaration_api.rs +485 -469
- data/rust/rubydex-sys/src/definition_api.rs +443 -352
- data/rust/rubydex-sys/src/diagnostic_api.rs +99 -99
- data/rust/rubydex-sys/src/document_api.rs +85 -54
- data/rust/rubydex-sys/src/graph_api.rs +1017 -700
- data/rust/rubydex-sys/src/lib.rs +79 -9
- data/rust/rubydex-sys/src/location_api.rs +79 -79
- data/rust/rubydex-sys/src/name_api.rs +187 -135
- data/rust/rubydex-sys/src/reference_api.rs +267 -195
- data/rust/rubydex-sys/src/utils.rs +70 -70
- data/rust/rustfmt.toml +2 -2
- metadata +16 -9
- data/lib/rubydex/librubydex_sys.so +0 -0
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
use std::{marker::PhantomData, num::NonZeroU64, ops::Deref};
|
|
2
|
-
use xxhash_rust::xxh3;
|
|
3
|
-
|
|
4
|
-
/// Maps a u64 hash to a `NonZeroU64` by replacing 0 with `u64::MAX`.
|
|
5
|
-
/// The probability of a 64-bit hash being exactly 0 is 2^-64 (~5.4e-20),
|
|
6
|
-
/// and remapping 0 → MAX just means those two inputs collide — the same
|
|
7
|
-
/// risk as any other hash collision, which the system already handles.
|
|
8
|
-
const MAX_NONZERO: NonZeroU64 = NonZeroU64::new(u64::MAX).unwrap();
|
|
9
|
-
|
|
10
|
-
#[inline]
|
|
11
|
-
fn to_non_zero(value: u64) -> NonZeroU64 {
|
|
12
|
-
NonZeroU64::new(value).unwrap_or(MAX_NONZERO)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/// A deterministic type-safe ID representation.
|
|
16
|
-
///
|
|
17
|
-
/// Uses `NonZeroU64` internally so that `Option<Id<T>>` is 8 bytes (same as `Id<T>`)
|
|
18
|
-
/// via niche optimization, instead of 16 bytes with a plain `u64`.
|
|
19
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
20
|
-
pub struct Id<T> {
|
|
21
|
-
value: NonZeroU64,
|
|
22
|
-
_marker: PhantomData<T>,
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
impl<T> Id<T> {
|
|
26
|
-
#[must_use]
|
|
27
|
-
pub fn new(value: u64) -> Self {
|
|
28
|
-
Self {
|
|
29
|
-
value: to_non_zero(value),
|
|
30
|
-
_marker: PhantomData,
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/// Returns the underlying `u64` value.
|
|
35
|
-
#[must_use]
|
|
36
|
-
pub fn get(&self) -> u64 {
|
|
37
|
-
self.value.get()
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
impl<T> Deref for Id<T> {
|
|
42
|
-
type Target = u64;
|
|
43
|
-
|
|
44
|
-
fn deref(&self) -> &Self::Target {
|
|
45
|
-
// SAFETY: NonZeroU64 is #[repr(transparent)] over u64.
|
|
46
|
-
// Deref requires returning &u64, but NonZeroU64::get() returns by value,
|
|
47
|
-
// so the pointer cast is unavoidable here. Prefer Id::get() when a u64
|
|
48
|
-
// value (not a reference) is sufficient.
|
|
49
|
-
unsafe { &*std::ptr::from_ref(&self.value).cast::<u64>() }
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
impl<T> std::fmt::Display for Id<T> {
|
|
54
|
-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
55
|
-
write!(f, "{}", self.value)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
impl<T> From<&str> for Id<T> {
|
|
60
|
-
fn from(value: &str) -> Self {
|
|
61
|
-
let hash = xxh3::xxh3_64(value.as_bytes());
|
|
62
|
-
Self::new(hash)
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
impl<T> From<&String> for Id<T> {
|
|
67
|
-
fn from(value: &String) -> Self {
|
|
68
|
-
let hash = xxh3::xxh3_64(value.as_bytes());
|
|
69
|
-
Self::new(hash)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
#[cfg(test)]
|
|
74
|
-
mod tests {
|
|
75
|
-
use super::*;
|
|
76
|
-
|
|
77
|
-
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
78
|
-
pub struct Marker;
|
|
79
|
-
pub type TestId = Id<Marker>;
|
|
80
|
-
|
|
81
|
-
#[test]
|
|
82
|
-
fn test_create_hash() {
|
|
83
|
-
// Same input should produce same hash (deterministic)
|
|
84
|
-
let id1 = TestId::from("test_input");
|
|
85
|
-
let id2 = TestId::from("test_input");
|
|
86
|
-
assert_eq!(id1, id2);
|
|
87
|
-
|
|
88
|
-
// Different inputs should produce different hashes (unique)
|
|
89
|
-
let id3 = TestId::from("different_input");
|
|
90
|
-
assert_ne!(id1, id3);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
#[test]
|
|
94
|
-
fn get_returns_value() {
|
|
95
|
-
let id = TestId::new(123);
|
|
96
|
-
assert_eq!(id.get(), 123);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
#[test]
|
|
100
|
-
fn optional_id_is_still_8_bytes() {
|
|
101
|
-
assert_eq!(std::mem::size_of::<Option<TestId>>(), 8);
|
|
102
|
-
assert_eq!(std::mem::size_of::<TestId>(), 8);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
#[test]
|
|
106
|
-
fn zero_hash_maps_to_nonzero() {
|
|
107
|
-
let id = TestId::new(0);
|
|
108
|
-
assert_eq!(id.get(), u64::MAX);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
1
|
+
use std::{marker::PhantomData, num::NonZeroU64, ops::Deref};
|
|
2
|
+
use xxhash_rust::xxh3;
|
|
3
|
+
|
|
4
|
+
/// Maps a u64 hash to a `NonZeroU64` by replacing 0 with `u64::MAX`.
|
|
5
|
+
/// The probability of a 64-bit hash being exactly 0 is 2^-64 (~5.4e-20),
|
|
6
|
+
/// and remapping 0 → MAX just means those two inputs collide — the same
|
|
7
|
+
/// risk as any other hash collision, which the system already handles.
|
|
8
|
+
const MAX_NONZERO: NonZeroU64 = NonZeroU64::new(u64::MAX).unwrap();
|
|
9
|
+
|
|
10
|
+
#[inline]
|
|
11
|
+
fn to_non_zero(value: u64) -> NonZeroU64 {
|
|
12
|
+
NonZeroU64::new(value).unwrap_or(MAX_NONZERO)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/// A deterministic type-safe ID representation.
|
|
16
|
+
///
|
|
17
|
+
/// Uses `NonZeroU64` internally so that `Option<Id<T>>` is 8 bytes (same as `Id<T>`)
|
|
18
|
+
/// via niche optimization, instead of 16 bytes with a plain `u64`.
|
|
19
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
20
|
+
pub struct Id<T> {
|
|
21
|
+
value: NonZeroU64,
|
|
22
|
+
_marker: PhantomData<T>,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
impl<T> Id<T> {
|
|
26
|
+
#[must_use]
|
|
27
|
+
pub fn new(value: u64) -> Self {
|
|
28
|
+
Self {
|
|
29
|
+
value: to_non_zero(value),
|
|
30
|
+
_marker: PhantomData,
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/// Returns the underlying `u64` value.
|
|
35
|
+
#[must_use]
|
|
36
|
+
pub fn get(&self) -> u64 {
|
|
37
|
+
self.value.get()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
impl<T> Deref for Id<T> {
|
|
42
|
+
type Target = u64;
|
|
43
|
+
|
|
44
|
+
fn deref(&self) -> &Self::Target {
|
|
45
|
+
// SAFETY: NonZeroU64 is #[repr(transparent)] over u64.
|
|
46
|
+
// Deref requires returning &u64, but NonZeroU64::get() returns by value,
|
|
47
|
+
// so the pointer cast is unavoidable here. Prefer Id::get() when a u64
|
|
48
|
+
// value (not a reference) is sufficient.
|
|
49
|
+
unsafe { &*std::ptr::from_ref(&self.value).cast::<u64>() }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
impl<T> std::fmt::Display for Id<T> {
|
|
54
|
+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
55
|
+
write!(f, "{}", self.value)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
impl<T> From<&str> for Id<T> {
|
|
60
|
+
fn from(value: &str) -> Self {
|
|
61
|
+
let hash = xxh3::xxh3_64(value.as_bytes());
|
|
62
|
+
Self::new(hash)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
impl<T> From<&String> for Id<T> {
|
|
67
|
+
fn from(value: &String) -> Self {
|
|
68
|
+
let hash = xxh3::xxh3_64(value.as_bytes());
|
|
69
|
+
Self::new(hash)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#[cfg(test)]
|
|
74
|
+
mod tests {
|
|
75
|
+
use super::*;
|
|
76
|
+
|
|
77
|
+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
78
|
+
pub struct Marker;
|
|
79
|
+
pub type TestId = Id<Marker>;
|
|
80
|
+
|
|
81
|
+
#[test]
|
|
82
|
+
fn test_create_hash() {
|
|
83
|
+
// Same input should produce same hash (deterministic)
|
|
84
|
+
let id1 = TestId::from("test_input");
|
|
85
|
+
let id2 = TestId::from("test_input");
|
|
86
|
+
assert_eq!(id1, id2);
|
|
87
|
+
|
|
88
|
+
// Different inputs should produce different hashes (unique)
|
|
89
|
+
let id3 = TestId::from("different_input");
|
|
90
|
+
assert_ne!(id1, id3);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
#[test]
|
|
94
|
+
fn get_returns_value() {
|
|
95
|
+
let id = TestId::new(123);
|
|
96
|
+
assert_eq!(id.get(), 123);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
#[test]
|
|
100
|
+
fn optional_id_is_still_8_bytes() {
|
|
101
|
+
assert_eq!(std::mem::size_of::<Option<TestId>>(), 8);
|
|
102
|
+
assert_eq!(std::mem::size_of::<TestId>(), 8);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
#[test]
|
|
106
|
+
fn zero_hash_maps_to_nonzero() {
|
|
107
|
+
let id = TestId::new(0);
|
|
108
|
+
assert_eq!(id.get(), u64::MAX);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
//! This module contains identity maps that use externally hashed IDs as keys. They are used to avoid hashing the same
|
|
2
|
-
//! value twice, simply using the given key directly
|
|
3
|
-
|
|
4
|
-
use std::{
|
|
5
|
-
collections::{HashMap, HashSet},
|
|
6
|
-
hash::{BuildHasher, Hasher},
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
#[derive(Default)]
|
|
10
|
-
pub struct IdentityHasher {
|
|
11
|
-
hash: u64,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
impl Hasher for IdentityHasher {
|
|
15
|
-
fn write(&mut self, _bytes: &[u8]) {
|
|
16
|
-
unreachable!("IdentityHasher only supports write_u64");
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
fn write_u32(&mut self, i: u32) {
|
|
20
|
-
self.hash = u64::from(i);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
fn write_u64(&mut self, i: u64) {
|
|
24
|
-
self.hash = i;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
fn finish(&self) -> u64 {
|
|
28
|
-
self.hash
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
#[derive(Default)]
|
|
33
|
-
pub struct IdentityHashBuilder;
|
|
34
|
-
|
|
35
|
-
impl BuildHasher for IdentityHashBuilder {
|
|
36
|
-
type Hasher = IdentityHasher;
|
|
37
|
-
|
|
38
|
-
fn build_hasher(&self) -> Self::Hasher {
|
|
39
|
-
IdentityHasher::default()
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
pub type IdentityHashMap<K, V> = HashMap<K, V, IdentityHashBuilder>;
|
|
44
|
-
pub type IdentityHashSet<T> = HashSet<T, IdentityHashBuilder>;
|
|
45
|
-
|
|
46
|
-
#[cfg(test)]
|
|
47
|
-
mod tests {
|
|
48
|
-
use super::*;
|
|
49
|
-
|
|
50
|
-
#[test]
|
|
51
|
-
fn identity_hasher_uses_value_as_is() {
|
|
52
|
-
let builder = IdentityHashBuilder;
|
|
53
|
-
let mut hasher = builder.build_hasher();
|
|
54
|
-
|
|
55
|
-
hasher.write_u64(42);
|
|
56
|
-
assert_eq!(hasher.finish(), 42);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
1
|
+
//! This module contains identity maps that use externally hashed IDs as keys. They are used to avoid hashing the same
|
|
2
|
+
//! value twice, simply using the given key directly
|
|
3
|
+
|
|
4
|
+
use std::{
|
|
5
|
+
collections::{HashMap, HashSet},
|
|
6
|
+
hash::{BuildHasher, Hasher},
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
#[derive(Default)]
|
|
10
|
+
pub struct IdentityHasher {
|
|
11
|
+
hash: u64,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
impl Hasher for IdentityHasher {
|
|
15
|
+
fn write(&mut self, _bytes: &[u8]) {
|
|
16
|
+
unreachable!("IdentityHasher only supports write_u64");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
fn write_u32(&mut self, i: u32) {
|
|
20
|
+
self.hash = u64::from(i);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
fn write_u64(&mut self, i: u64) {
|
|
24
|
+
self.hash = i;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
fn finish(&self) -> u64 {
|
|
28
|
+
self.hash
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#[derive(Default)]
|
|
33
|
+
pub struct IdentityHashBuilder;
|
|
34
|
+
|
|
35
|
+
impl BuildHasher for IdentityHashBuilder {
|
|
36
|
+
type Hasher = IdentityHasher;
|
|
37
|
+
|
|
38
|
+
fn build_hasher(&self) -> Self::Hasher {
|
|
39
|
+
IdentityHasher::default()
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
pub type IdentityHashMap<K, V> = HashMap<K, V, IdentityHashBuilder>;
|
|
44
|
+
pub type IdentityHashSet<T> = HashSet<T, IdentityHashBuilder>;
|
|
45
|
+
|
|
46
|
+
#[cfg(test)]
|
|
47
|
+
mod tests {
|
|
48
|
+
use super::*;
|
|
49
|
+
|
|
50
|
+
#[test]
|
|
51
|
+
fn identity_hasher_uses_value_as_is() {
|
|
52
|
+
let builder = IdentityHashBuilder;
|
|
53
|
+
let mut hasher = builder.build_hasher();
|
|
54
|
+
|
|
55
|
+
hasher.write_u64(42);
|
|
56
|
+
assert_eq!(hasher.finish(), 42);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1,38 +1,60 @@
|
|
|
1
|
-
use crate::{assert_mem_size, model::id::Id};
|
|
2
|
-
|
|
3
|
-
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
4
|
-
pub struct DeclarationMarker;
|
|
5
|
-
/// `DeclarationId` represents the ID of a fully qualified name. For example, `Foo::Bar` or `Foo#my_method`
|
|
6
|
-
pub type DeclarationId = Id<DeclarationMarker>;
|
|
7
|
-
|
|
8
|
-
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
9
|
-
pub struct DefinitionMarker;
|
|
10
|
-
|
|
11
|
-
// DefinitionId represents the ID of a definition found in a specific file
|
|
12
|
-
pub type DefinitionId = Id<DefinitionMarker>;
|
|
13
|
-
assert_mem_size!(DefinitionId, 8);
|
|
14
|
-
|
|
15
|
-
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
16
|
-
pub struct UriMarker;
|
|
17
|
-
// UriId represents the ID of a URI, which is the unique identifier for a document
|
|
18
|
-
pub type UriId = Id<UriMarker>;
|
|
19
|
-
assert_mem_size!(UriId, 8);
|
|
20
|
-
|
|
21
|
-
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
22
|
-
pub struct StringMarker;
|
|
23
|
-
/// `StringId` represents an ID for an interned string value
|
|
24
|
-
pub type StringId = Id<StringMarker>;
|
|
25
|
-
assert_mem_size!(StringId, 8);
|
|
26
|
-
|
|
27
|
-
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
28
|
-
pub struct
|
|
29
|
-
/// `
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
use crate::{assert_mem_size, model::id::Id};
|
|
2
|
+
|
|
3
|
+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
4
|
+
pub struct DeclarationMarker;
|
|
5
|
+
/// `DeclarationId` represents the ID of a fully qualified name. For example, `Foo::Bar` or `Foo#my_method`
|
|
6
|
+
pub type DeclarationId = Id<DeclarationMarker>;
|
|
7
|
+
|
|
8
|
+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
9
|
+
pub struct DefinitionMarker;
|
|
10
|
+
|
|
11
|
+
// DefinitionId represents the ID of a definition found in a specific file
|
|
12
|
+
pub type DefinitionId = Id<DefinitionMarker>;
|
|
13
|
+
assert_mem_size!(DefinitionId, 8);
|
|
14
|
+
|
|
15
|
+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
16
|
+
pub struct UriMarker;
|
|
17
|
+
// UriId represents the ID of a URI, which is the unique identifier for a document
|
|
18
|
+
pub type UriId = Id<UriMarker>;
|
|
19
|
+
assert_mem_size!(UriId, 8);
|
|
20
|
+
|
|
21
|
+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
22
|
+
pub struct StringMarker;
|
|
23
|
+
/// `StringId` represents an ID for an interned string value
|
|
24
|
+
pub type StringId = Id<StringMarker>;
|
|
25
|
+
assert_mem_size!(StringId, 8);
|
|
26
|
+
|
|
27
|
+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
28
|
+
pub struct NameMarker;
|
|
29
|
+
/// `NameId` represents an ID for any constant name that we find as part of a reference or definition
|
|
30
|
+
pub type NameId = Id<NameMarker>;
|
|
31
|
+
assert_mem_size!(NameId, 8);
|
|
32
|
+
|
|
33
|
+
// Reference IDs
|
|
34
|
+
//
|
|
35
|
+
// This section is for specialized IDs for each type of declaration reference
|
|
36
|
+
|
|
37
|
+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
38
|
+
pub struct ConstantMarker;
|
|
39
|
+
pub type ConstantReferenceId = Id<ConstantMarker>;
|
|
40
|
+
assert_mem_size!(ConstantReferenceId, 8);
|
|
41
|
+
|
|
42
|
+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
43
|
+
pub struct MethodMarker;
|
|
44
|
+
pub type MethodReferenceId = Id<MethodMarker>;
|
|
45
|
+
assert_mem_size!(MethodReferenceId, 8);
|
|
46
|
+
|
|
47
|
+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
48
|
+
pub struct GlobalVariableMarker;
|
|
49
|
+
pub type GlobalVariableReferenceId = Id<GlobalVariableMarker>;
|
|
50
|
+
assert_mem_size!(GlobalVariableReferenceId, 8);
|
|
51
|
+
|
|
52
|
+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
53
|
+
pub struct ClassVariableMarker;
|
|
54
|
+
pub type ClassVariableReferenceId = Id<ClassVariableMarker>;
|
|
55
|
+
assert_mem_size!(ClassVariableReferenceId, 8);
|
|
56
|
+
|
|
57
|
+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
|
|
58
|
+
pub struct InstanceVariableMarker;
|
|
59
|
+
pub type InstanceVariableReferenceId = Id<InstanceVariableMarker>;
|
|
60
|
+
assert_mem_size!(InstanceVariableReferenceId, 8);
|