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
|
@@ -0,0 +1,1475 @@
|
|
|
1
|
+
//! The definitions of the Ruby constructs in the source code.
|
|
2
|
+
//!
|
|
3
|
+
//! All the definitions constitute the `Declaration` of a name.
|
|
4
|
+
//!
|
|
5
|
+
//! Consider the following example:
|
|
6
|
+
//!
|
|
7
|
+
//! ```ruby
|
|
8
|
+
//! module Foo
|
|
9
|
+
//! class Bar; end
|
|
10
|
+
//! end
|
|
11
|
+
//!
|
|
12
|
+
//! class Foo::Bar; end
|
|
13
|
+
//! ```
|
|
14
|
+
//!
|
|
15
|
+
//! There are 3 definitions:
|
|
16
|
+
//!
|
|
17
|
+
//! 1. The module definition for `Foo`
|
|
18
|
+
//! 2. The class definition for `Foo::Bar` inside `Foo`
|
|
19
|
+
//! 3. The class definition for `Foo::Bar` again
|
|
20
|
+
//!
|
|
21
|
+
//! And there are 2 declarations:
|
|
22
|
+
//!
|
|
23
|
+
//! 1. The declaration for the name `Foo`
|
|
24
|
+
//! 2. The declaration for the name `Foo::Bar`
|
|
25
|
+
|
|
26
|
+
use bitflags::bitflags;
|
|
27
|
+
|
|
28
|
+
use crate::{
|
|
29
|
+
diagnostic::Diagnostic,
|
|
30
|
+
model::{
|
|
31
|
+
comment::Comment,
|
|
32
|
+
ids::ReferenceId,
|
|
33
|
+
ids::{DefinitionId, NameId, StringId, UriId},
|
|
34
|
+
visibility::Visibility,
|
|
35
|
+
},
|
|
36
|
+
offset::Offset,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
bitflags! {
|
|
40
|
+
#[derive(Debug, Clone)]
|
|
41
|
+
pub struct DefinitionFlags: u8 {
|
|
42
|
+
const DEPRECATED = 0b0001;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
impl DefinitionFlags {
|
|
47
|
+
#[must_use]
|
|
48
|
+
pub fn is_deprecated(&self) -> bool {
|
|
49
|
+
self.contains(Self::DEPRECATED)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#[derive(Debug)]
|
|
54
|
+
pub enum Definition {
|
|
55
|
+
Class(Box<ClassDefinition>),
|
|
56
|
+
SingletonClass(Box<SingletonClassDefinition>),
|
|
57
|
+
Module(Box<ModuleDefinition>),
|
|
58
|
+
Constant(Box<ConstantDefinition>),
|
|
59
|
+
ConstantAlias(Box<ConstantAliasDefinition>),
|
|
60
|
+
Method(Box<MethodDefinition>),
|
|
61
|
+
AttrAccessor(Box<AttrAccessorDefinition>),
|
|
62
|
+
AttrReader(Box<AttrReaderDefinition>),
|
|
63
|
+
AttrWriter(Box<AttrWriterDefinition>),
|
|
64
|
+
GlobalVariable(Box<GlobalVariableDefinition>),
|
|
65
|
+
InstanceVariable(Box<InstanceVariableDefinition>),
|
|
66
|
+
ClassVariable(Box<ClassVariableDefinition>),
|
|
67
|
+
MethodAlias(Box<MethodAliasDefinition>),
|
|
68
|
+
GlobalVariableAlias(Box<GlobalVariableAliasDefinition>),
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
macro_rules! all_definitions {
|
|
72
|
+
($value:expr, $var:ident => $expr:expr) => {
|
|
73
|
+
match $value {
|
|
74
|
+
Definition::Class($var) => $expr,
|
|
75
|
+
Definition::SingletonClass($var) => $expr,
|
|
76
|
+
Definition::Module($var) => $expr,
|
|
77
|
+
Definition::Constant($var) => $expr,
|
|
78
|
+
Definition::ConstantAlias($var) => $expr,
|
|
79
|
+
Definition::GlobalVariable($var) => $expr,
|
|
80
|
+
Definition::InstanceVariable($var) => $expr,
|
|
81
|
+
Definition::ClassVariable($var) => $expr,
|
|
82
|
+
Definition::AttrAccessor($var) => $expr,
|
|
83
|
+
Definition::AttrReader($var) => $expr,
|
|
84
|
+
Definition::AttrWriter($var) => $expr,
|
|
85
|
+
Definition::Method($var) => $expr,
|
|
86
|
+
Definition::MethodAlias($var) => $expr,
|
|
87
|
+
Definition::GlobalVariableAlias($var) => $expr,
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
impl Definition {
|
|
93
|
+
#[must_use]
|
|
94
|
+
pub fn id(&self) -> DefinitionId {
|
|
95
|
+
all_definitions!(self, it => it.id())
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#[must_use]
|
|
99
|
+
pub fn uri_id(&self) -> &UriId {
|
|
100
|
+
all_definitions!(self, it => &it.uri_id())
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
#[must_use]
|
|
104
|
+
pub fn offset(&self) -> &Offset {
|
|
105
|
+
all_definitions!(self, it => &it.offset())
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
#[must_use]
|
|
109
|
+
pub fn comments(&self) -> &[Comment] {
|
|
110
|
+
all_definitions!(self, it => it.comments())
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
#[must_use]
|
|
114
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
115
|
+
all_definitions!(self, it => &it.lexical_nesting_id())
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
#[must_use]
|
|
119
|
+
pub fn kind(&self) -> &'static str {
|
|
120
|
+
match self {
|
|
121
|
+
Definition::Class(_) => "Class",
|
|
122
|
+
Definition::SingletonClass(_) => "SingletonClass",
|
|
123
|
+
Definition::Module(_) => "Module",
|
|
124
|
+
Definition::Constant(_) => "Constant",
|
|
125
|
+
Definition::ConstantAlias(_) => "ConstantAlias",
|
|
126
|
+
Definition::Method(_) => "Method",
|
|
127
|
+
Definition::AttrAccessor(_) => "AttrAccessor",
|
|
128
|
+
Definition::AttrReader(_) => "AttrReader",
|
|
129
|
+
Definition::AttrWriter(_) => "AttrWriter",
|
|
130
|
+
Definition::GlobalVariable(_) => "GlobalVariable",
|
|
131
|
+
Definition::InstanceVariable(_) => "InstanceVariable",
|
|
132
|
+
Definition::ClassVariable(_) => "ClassVariable",
|
|
133
|
+
Definition::MethodAlias(_) => "AliasMethod",
|
|
134
|
+
Definition::GlobalVariableAlias(_) => "GlobalVariableAlias",
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
#[must_use]
|
|
139
|
+
pub fn name_id(&self) -> Option<&NameId> {
|
|
140
|
+
match self {
|
|
141
|
+
Definition::Class(d) => Some(d.name_id()),
|
|
142
|
+
Definition::SingletonClass(d) => Some(d.name_id()),
|
|
143
|
+
Definition::Module(d) => Some(d.name_id()),
|
|
144
|
+
Definition::Constant(d) => Some(d.name_id()),
|
|
145
|
+
_ => None,
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
#[must_use]
|
|
150
|
+
pub fn name_offset(&self) -> Option<&Offset> {
|
|
151
|
+
match self {
|
|
152
|
+
Definition::Class(d) => Some(d.name_offset()),
|
|
153
|
+
Definition::Module(d) => Some(d.name_offset()),
|
|
154
|
+
Definition::SingletonClass(d) => Some(d.name_offset()),
|
|
155
|
+
_ => None,
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
#[must_use]
|
|
160
|
+
pub fn is_deprecated(&self) -> bool {
|
|
161
|
+
all_definitions!(self, it => it.flags().is_deprecated())
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
#[must_use]
|
|
165
|
+
pub fn diagnostics(&self) -> &[Diagnostic] {
|
|
166
|
+
all_definitions!(self, it => &it.diagnostics)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
pub fn add_diagnostic(&mut self, diagnostic: Diagnostic) {
|
|
170
|
+
all_definitions!(self, it => it.diagnostics.push(diagnostic));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/// Represents a mixin: include, prepend, or extend.
|
|
175
|
+
/// During resolution, `Extend` mixins are attached to the singleton class.
|
|
176
|
+
#[derive(Debug, Clone)]
|
|
177
|
+
pub enum Mixin {
|
|
178
|
+
Include(IncludeDefinition),
|
|
179
|
+
Prepend(PrependDefinition),
|
|
180
|
+
Extend(ExtendDefinition),
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
impl Mixin {
|
|
184
|
+
#[must_use]
|
|
185
|
+
pub fn constant_reference_id(&self) -> &ReferenceId {
|
|
186
|
+
match self {
|
|
187
|
+
Mixin::Include(def) => def.constant_reference_id(),
|
|
188
|
+
Mixin::Prepend(def) => def.constant_reference_id(),
|
|
189
|
+
Mixin::Extend(def) => def.constant_reference_id(),
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
macro_rules! mixin_definition {
|
|
195
|
+
($variant:ident, $name:ident) => {
|
|
196
|
+
#[derive(Debug, Clone)]
|
|
197
|
+
pub struct $name {
|
|
198
|
+
constant_reference_id: ReferenceId,
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
impl $name {
|
|
202
|
+
#[must_use]
|
|
203
|
+
pub const fn new(constant_reference_id: ReferenceId) -> Self {
|
|
204
|
+
Self {
|
|
205
|
+
constant_reference_id,
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
#[must_use]
|
|
210
|
+
pub fn constant_reference_id(&self) -> &ReferenceId {
|
|
211
|
+
&self.constant_reference_id
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
mixin_definition!(Include, IncludeDefinition);
|
|
218
|
+
mixin_definition!(Prepend, PrependDefinition);
|
|
219
|
+
mixin_definition!(Extend, ExtendDefinition);
|
|
220
|
+
|
|
221
|
+
/// A class definition
|
|
222
|
+
///
|
|
223
|
+
/// # Example
|
|
224
|
+
/// ```ruby
|
|
225
|
+
/// class Foo
|
|
226
|
+
/// end
|
|
227
|
+
/// ```
|
|
228
|
+
#[derive(Debug)]
|
|
229
|
+
pub struct ClassDefinition {
|
|
230
|
+
name_id: NameId,
|
|
231
|
+
uri_id: UriId,
|
|
232
|
+
offset: Offset,
|
|
233
|
+
name_offset: Offset,
|
|
234
|
+
flags: DefinitionFlags,
|
|
235
|
+
comments: Vec<Comment>,
|
|
236
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
237
|
+
members: Vec<DefinitionId>,
|
|
238
|
+
superclass_ref: Option<ReferenceId>,
|
|
239
|
+
mixins: Vec<Mixin>,
|
|
240
|
+
diagnostics: Vec<Diagnostic>,
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
impl ClassDefinition {
|
|
244
|
+
#[must_use]
|
|
245
|
+
#[allow(clippy::too_many_arguments)]
|
|
246
|
+
pub const fn new(
|
|
247
|
+
name_id: NameId,
|
|
248
|
+
uri_id: UriId,
|
|
249
|
+
offset: Offset,
|
|
250
|
+
name_offset: Offset,
|
|
251
|
+
comments: Vec<Comment>,
|
|
252
|
+
flags: DefinitionFlags,
|
|
253
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
254
|
+
superclass_ref: Option<ReferenceId>,
|
|
255
|
+
) -> Self {
|
|
256
|
+
Self {
|
|
257
|
+
name_id,
|
|
258
|
+
uri_id,
|
|
259
|
+
offset,
|
|
260
|
+
name_offset,
|
|
261
|
+
flags,
|
|
262
|
+
comments,
|
|
263
|
+
lexical_nesting_id,
|
|
264
|
+
superclass_ref,
|
|
265
|
+
members: Vec::new(),
|
|
266
|
+
mixins: Vec::new(),
|
|
267
|
+
diagnostics: Vec::new(),
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
#[must_use]
|
|
272
|
+
pub fn id(&self) -> DefinitionId {
|
|
273
|
+
DefinitionId::from(&format!("{}{}{}", *self.uri_id, self.offset.start(), *self.name_id))
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
#[must_use]
|
|
277
|
+
pub fn name_id(&self) -> &NameId {
|
|
278
|
+
&self.name_id
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
#[must_use]
|
|
282
|
+
pub fn uri_id(&self) -> &UriId {
|
|
283
|
+
&self.uri_id
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
#[must_use]
|
|
287
|
+
pub fn offset(&self) -> &Offset {
|
|
288
|
+
&self.offset
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
#[must_use]
|
|
292
|
+
pub fn name_offset(&self) -> &Offset {
|
|
293
|
+
&self.name_offset
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
#[must_use]
|
|
297
|
+
pub fn comments(&self) -> &[Comment] {
|
|
298
|
+
&self.comments
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
#[must_use]
|
|
302
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
303
|
+
&self.lexical_nesting_id
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
#[must_use]
|
|
307
|
+
pub fn superclass_ref(&self) -> Option<&ReferenceId> {
|
|
308
|
+
self.superclass_ref.as_ref()
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
#[must_use]
|
|
312
|
+
pub fn members(&self) -> &[DefinitionId] {
|
|
313
|
+
&self.members
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
pub fn add_member(&mut self, member_id: DefinitionId) {
|
|
317
|
+
self.members.push(member_id);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
#[must_use]
|
|
321
|
+
pub fn mixins(&self) -> &[Mixin] {
|
|
322
|
+
&self.mixins
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
pub fn add_mixin(&mut self, mixin: Mixin) {
|
|
326
|
+
self.mixins.push(mixin);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
#[must_use]
|
|
330
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
331
|
+
&self.flags
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/// A singleton class definition created from `class << X` syntax.
|
|
336
|
+
/// This is created only when `class << X` syntax is encountered, NOT for `def self.foo`.
|
|
337
|
+
/// Methods with receivers (like `def self.foo`) have their `receiver` field set instead.
|
|
338
|
+
///
|
|
339
|
+
/// # Examples
|
|
340
|
+
/// ```ruby
|
|
341
|
+
/// class Foo
|
|
342
|
+
/// class << self # attached_target = NameId("Foo")
|
|
343
|
+
/// def bar; end
|
|
344
|
+
/// end
|
|
345
|
+
/// end
|
|
346
|
+
///
|
|
347
|
+
/// class << Foo # attached_target = NameId("Foo")
|
|
348
|
+
/// def baz; end
|
|
349
|
+
/// end
|
|
350
|
+
/// ```
|
|
351
|
+
#[derive(Debug)]
|
|
352
|
+
pub struct SingletonClassDefinition {
|
|
353
|
+
/// The name of this singleton class (e.g., `<Foo>` for `class << self` inside `class Foo`)
|
|
354
|
+
name_id: NameId,
|
|
355
|
+
uri_id: UriId,
|
|
356
|
+
offset: Offset,
|
|
357
|
+
name_offset: Offset,
|
|
358
|
+
flags: DefinitionFlags,
|
|
359
|
+
comments: Vec<Comment>,
|
|
360
|
+
/// The definition where `class << X` was found (lexical owner)
|
|
361
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
362
|
+
/// Members defined directly in this singleton class
|
|
363
|
+
members: Vec<DefinitionId>,
|
|
364
|
+
/// Mixins declared in this singleton class
|
|
365
|
+
mixins: Vec<Mixin>,
|
|
366
|
+
diagnostics: Vec<Diagnostic>,
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
impl SingletonClassDefinition {
|
|
370
|
+
#[must_use]
|
|
371
|
+
pub const fn new(
|
|
372
|
+
name_id: NameId,
|
|
373
|
+
uri_id: UriId,
|
|
374
|
+
offset: Offset,
|
|
375
|
+
name_offset: Offset,
|
|
376
|
+
comments: Vec<Comment>,
|
|
377
|
+
flags: DefinitionFlags,
|
|
378
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
379
|
+
) -> Self {
|
|
380
|
+
Self {
|
|
381
|
+
name_id,
|
|
382
|
+
uri_id,
|
|
383
|
+
offset,
|
|
384
|
+
name_offset,
|
|
385
|
+
flags,
|
|
386
|
+
comments,
|
|
387
|
+
lexical_nesting_id,
|
|
388
|
+
members: Vec::new(),
|
|
389
|
+
mixins: Vec::new(),
|
|
390
|
+
diagnostics: Vec::new(),
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
#[must_use]
|
|
395
|
+
pub fn id(&self) -> DefinitionId {
|
|
396
|
+
DefinitionId::from(&format!("{}{}{}", *self.uri_id, self.offset.start(), *self.name_id))
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
#[must_use]
|
|
400
|
+
pub fn name_id(&self) -> &NameId {
|
|
401
|
+
&self.name_id
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
#[must_use]
|
|
405
|
+
pub fn uri_id(&self) -> &UriId {
|
|
406
|
+
&self.uri_id
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
#[must_use]
|
|
410
|
+
pub fn offset(&self) -> &Offset {
|
|
411
|
+
&self.offset
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
#[must_use]
|
|
415
|
+
pub fn name_offset(&self) -> &Offset {
|
|
416
|
+
&self.name_offset
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
#[must_use]
|
|
420
|
+
pub fn comments(&self) -> &[Comment] {
|
|
421
|
+
&self.comments
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
#[must_use]
|
|
425
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
426
|
+
&self.lexical_nesting_id
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
#[must_use]
|
|
430
|
+
pub fn members(&self) -> &[DefinitionId] {
|
|
431
|
+
&self.members
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
pub fn add_member(&mut self, member_id: DefinitionId) {
|
|
435
|
+
self.members.push(member_id);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
#[must_use]
|
|
439
|
+
pub fn mixins(&self) -> &[Mixin] {
|
|
440
|
+
&self.mixins
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
pub fn add_mixin(&mut self, mixin: Mixin) {
|
|
444
|
+
self.mixins.push(mixin);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
#[must_use]
|
|
448
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
449
|
+
&self.flags
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/// A module definition
|
|
454
|
+
///
|
|
455
|
+
/// # Example
|
|
456
|
+
/// ```ruby
|
|
457
|
+
/// module Foo
|
|
458
|
+
/// end
|
|
459
|
+
/// ```
|
|
460
|
+
#[derive(Debug)]
|
|
461
|
+
pub struct ModuleDefinition {
|
|
462
|
+
name_id: NameId,
|
|
463
|
+
uri_id: UriId,
|
|
464
|
+
offset: Offset,
|
|
465
|
+
name_offset: Offset,
|
|
466
|
+
flags: DefinitionFlags,
|
|
467
|
+
comments: Vec<Comment>,
|
|
468
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
469
|
+
members: Vec<DefinitionId>,
|
|
470
|
+
mixins: Vec<Mixin>,
|
|
471
|
+
diagnostics: Vec<Diagnostic>,
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
impl ModuleDefinition {
|
|
475
|
+
#[must_use]
|
|
476
|
+
pub const fn new(
|
|
477
|
+
name_id: NameId,
|
|
478
|
+
uri_id: UriId,
|
|
479
|
+
offset: Offset,
|
|
480
|
+
name_offset: Offset,
|
|
481
|
+
comments: Vec<Comment>,
|
|
482
|
+
flags: DefinitionFlags,
|
|
483
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
484
|
+
) -> Self {
|
|
485
|
+
Self {
|
|
486
|
+
name_id,
|
|
487
|
+
uri_id,
|
|
488
|
+
offset,
|
|
489
|
+
name_offset,
|
|
490
|
+
flags,
|
|
491
|
+
comments,
|
|
492
|
+
lexical_nesting_id,
|
|
493
|
+
members: Vec::new(),
|
|
494
|
+
mixins: Vec::new(),
|
|
495
|
+
diagnostics: Vec::new(),
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
#[must_use]
|
|
500
|
+
pub fn id(&self) -> DefinitionId {
|
|
501
|
+
DefinitionId::from(&format!("{}{}{}", *self.uri_id, self.offset.start(), *self.name_id))
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
#[must_use]
|
|
505
|
+
pub fn name_id(&self) -> &NameId {
|
|
506
|
+
&self.name_id
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
#[must_use]
|
|
510
|
+
pub fn uri_id(&self) -> &UriId {
|
|
511
|
+
&self.uri_id
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
#[must_use]
|
|
515
|
+
pub fn offset(&self) -> &Offset {
|
|
516
|
+
&self.offset
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
#[must_use]
|
|
520
|
+
pub fn name_offset(&self) -> &Offset {
|
|
521
|
+
&self.name_offset
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
#[must_use]
|
|
525
|
+
pub fn comments(&self) -> &[Comment] {
|
|
526
|
+
&self.comments
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
#[must_use]
|
|
530
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
531
|
+
&self.lexical_nesting_id
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
#[must_use]
|
|
535
|
+
pub fn members(&self) -> &[DefinitionId] {
|
|
536
|
+
&self.members
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
pub fn add_member(&mut self, member_id: DefinitionId) {
|
|
540
|
+
self.members.push(member_id);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
#[must_use]
|
|
544
|
+
pub fn mixins(&self) -> &[Mixin] {
|
|
545
|
+
&self.mixins
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
pub fn add_mixin(&mut self, mixin: Mixin) {
|
|
549
|
+
self.mixins.push(mixin);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
#[must_use]
|
|
553
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
554
|
+
&self.flags
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/// A constant definition
|
|
559
|
+
///
|
|
560
|
+
/// # Example
|
|
561
|
+
/// ```ruby
|
|
562
|
+
/// FOO = 1
|
|
563
|
+
/// ```
|
|
564
|
+
#[derive(Debug)]
|
|
565
|
+
pub struct ConstantDefinition {
|
|
566
|
+
name_id: NameId,
|
|
567
|
+
uri_id: UriId,
|
|
568
|
+
offset: Offset,
|
|
569
|
+
flags: DefinitionFlags,
|
|
570
|
+
comments: Vec<Comment>,
|
|
571
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
572
|
+
diagnostics: Vec<Diagnostic>,
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
impl ConstantDefinition {
|
|
576
|
+
#[must_use]
|
|
577
|
+
pub const fn new(
|
|
578
|
+
name_id: NameId,
|
|
579
|
+
uri_id: UriId,
|
|
580
|
+
offset: Offset,
|
|
581
|
+
comments: Vec<Comment>,
|
|
582
|
+
flags: DefinitionFlags,
|
|
583
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
584
|
+
) -> Self {
|
|
585
|
+
Self {
|
|
586
|
+
name_id,
|
|
587
|
+
uri_id,
|
|
588
|
+
offset,
|
|
589
|
+
flags,
|
|
590
|
+
comments,
|
|
591
|
+
lexical_nesting_id,
|
|
592
|
+
diagnostics: Vec::new(),
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
#[must_use]
|
|
597
|
+
pub fn id(&self) -> DefinitionId {
|
|
598
|
+
DefinitionId::from(&format!("{}{}{}", *self.uri_id, self.offset.start(), *self.name_id))
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
#[must_use]
|
|
602
|
+
pub fn name_id(&self) -> &NameId {
|
|
603
|
+
&self.name_id
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
#[must_use]
|
|
607
|
+
pub fn uri_id(&self) -> &UriId {
|
|
608
|
+
&self.uri_id
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
#[must_use]
|
|
612
|
+
pub fn offset(&self) -> &Offset {
|
|
613
|
+
&self.offset
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
#[must_use]
|
|
617
|
+
pub fn comments(&self) -> &[Comment] {
|
|
618
|
+
&self.comments
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
#[must_use]
|
|
622
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
623
|
+
&self.lexical_nesting_id
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
#[must_use]
|
|
627
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
628
|
+
&self.flags
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/// A constant alias definition
|
|
633
|
+
///
|
|
634
|
+
/// # Example
|
|
635
|
+
/// ```ruby
|
|
636
|
+
/// module Foo; end
|
|
637
|
+
/// ALIAS = Foo
|
|
638
|
+
/// ```
|
|
639
|
+
#[derive(Debug)]
|
|
640
|
+
pub struct ConstantAliasDefinition {
|
|
641
|
+
alias_constant: ConstantDefinition,
|
|
642
|
+
target_name_id: NameId,
|
|
643
|
+
diagnostics: Vec<Diagnostic>,
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
impl ConstantAliasDefinition {
|
|
647
|
+
#[must_use]
|
|
648
|
+
pub const fn new(target_name_id: NameId, alias_constant: ConstantDefinition) -> Self {
|
|
649
|
+
Self {
|
|
650
|
+
alias_constant,
|
|
651
|
+
target_name_id,
|
|
652
|
+
diagnostics: Vec::new(),
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
#[must_use]
|
|
657
|
+
pub fn id(&self) -> DefinitionId {
|
|
658
|
+
DefinitionId::from(&format!(
|
|
659
|
+
"{}{}{}{}",
|
|
660
|
+
*self.alias_constant.uri_id(),
|
|
661
|
+
self.alias_constant.offset().start(),
|
|
662
|
+
*self.alias_constant.name_id(),
|
|
663
|
+
*self.target_name_id,
|
|
664
|
+
))
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
#[must_use]
|
|
668
|
+
pub fn name_id(&self) -> &NameId {
|
|
669
|
+
self.alias_constant.name_id()
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
#[must_use]
|
|
673
|
+
pub fn target_name_id(&self) -> &NameId {
|
|
674
|
+
&self.target_name_id
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
#[must_use]
|
|
678
|
+
pub fn uri_id(&self) -> &UriId {
|
|
679
|
+
self.alias_constant.uri_id()
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
#[must_use]
|
|
683
|
+
pub fn offset(&self) -> &Offset {
|
|
684
|
+
self.alias_constant.offset()
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
#[must_use]
|
|
688
|
+
pub fn comments(&self) -> &[Comment] {
|
|
689
|
+
self.alias_constant.comments()
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
#[must_use]
|
|
693
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
694
|
+
self.alias_constant.lexical_nesting_id()
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
#[must_use]
|
|
698
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
699
|
+
self.alias_constant.flags()
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/// A method definition
|
|
704
|
+
///
|
|
705
|
+
/// # Example
|
|
706
|
+
/// ```ruby
|
|
707
|
+
/// def foo(bar, baz)
|
|
708
|
+
/// end
|
|
709
|
+
/// ```
|
|
710
|
+
#[derive(Debug)]
|
|
711
|
+
pub struct MethodDefinition {
|
|
712
|
+
str_id: StringId,
|
|
713
|
+
uri_id: UriId,
|
|
714
|
+
offset: Offset,
|
|
715
|
+
flags: DefinitionFlags,
|
|
716
|
+
comments: Vec<Comment>,
|
|
717
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
718
|
+
parameters: Vec<Parameter>,
|
|
719
|
+
visibility: Visibility,
|
|
720
|
+
receiver: Option<NameId>,
|
|
721
|
+
diagnostics: Vec<Diagnostic>,
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
impl MethodDefinition {
|
|
725
|
+
#[allow(clippy::too_many_arguments)]
|
|
726
|
+
#[must_use]
|
|
727
|
+
pub const fn new(
|
|
728
|
+
str_id: StringId,
|
|
729
|
+
uri_id: UriId,
|
|
730
|
+
offset: Offset,
|
|
731
|
+
comments: Vec<Comment>,
|
|
732
|
+
flags: DefinitionFlags,
|
|
733
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
734
|
+
parameters: Vec<Parameter>,
|
|
735
|
+
visibility: Visibility,
|
|
736
|
+
receiver: Option<NameId>,
|
|
737
|
+
) -> Self {
|
|
738
|
+
Self {
|
|
739
|
+
str_id,
|
|
740
|
+
uri_id,
|
|
741
|
+
offset,
|
|
742
|
+
flags,
|
|
743
|
+
comments,
|
|
744
|
+
lexical_nesting_id,
|
|
745
|
+
parameters,
|
|
746
|
+
visibility,
|
|
747
|
+
receiver,
|
|
748
|
+
diagnostics: Vec::new(),
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
#[must_use]
|
|
753
|
+
pub fn id(&self) -> DefinitionId {
|
|
754
|
+
let mut formatted_id = format!("{}{}{}", *self.uri_id, self.offset.start(), *self.str_id);
|
|
755
|
+
|
|
756
|
+
if let Some(receiver) = self.receiver {
|
|
757
|
+
formatted_id.push_str(&receiver.to_string());
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
DefinitionId::from(&formatted_id)
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
#[must_use]
|
|
764
|
+
pub fn str_id(&self) -> &StringId {
|
|
765
|
+
&self.str_id
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
#[must_use]
|
|
769
|
+
pub fn uri_id(&self) -> &UriId {
|
|
770
|
+
&self.uri_id
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
#[must_use]
|
|
774
|
+
pub fn offset(&self) -> &Offset {
|
|
775
|
+
&self.offset
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
#[must_use]
|
|
779
|
+
pub fn comments(&self) -> &[Comment] {
|
|
780
|
+
&self.comments
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
#[must_use]
|
|
784
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
785
|
+
&self.lexical_nesting_id
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
#[must_use]
|
|
789
|
+
pub fn parameters(&self) -> &Vec<Parameter> {
|
|
790
|
+
&self.parameters
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
#[must_use]
|
|
794
|
+
pub fn receiver(&self) -> &Option<NameId> {
|
|
795
|
+
&self.receiver
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
#[must_use]
|
|
799
|
+
pub fn visibility(&self) -> &Visibility {
|
|
800
|
+
&self.visibility
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
#[must_use]
|
|
804
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
805
|
+
&self.flags
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
#[derive(Debug, Clone)]
|
|
810
|
+
pub enum Parameter {
|
|
811
|
+
RequiredPositional(ParameterStruct),
|
|
812
|
+
OptionalPositional(ParameterStruct),
|
|
813
|
+
RestPositional(ParameterStruct),
|
|
814
|
+
Post(ParameterStruct),
|
|
815
|
+
RequiredKeyword(ParameterStruct),
|
|
816
|
+
OptionalKeyword(ParameterStruct),
|
|
817
|
+
RestKeyword(ParameterStruct),
|
|
818
|
+
Forward(ParameterStruct),
|
|
819
|
+
Block(ParameterStruct),
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
#[derive(Debug, Clone)]
|
|
823
|
+
pub struct ParameterStruct {
|
|
824
|
+
offset: Offset,
|
|
825
|
+
str: StringId,
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
impl ParameterStruct {
|
|
829
|
+
#[must_use]
|
|
830
|
+
pub const fn new(offset: Offset, str: StringId) -> Self {
|
|
831
|
+
Self { offset, str }
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
#[must_use]
|
|
835
|
+
pub fn offset(&self) -> &Offset {
|
|
836
|
+
&self.offset
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
#[must_use]
|
|
840
|
+
pub fn str(&self) -> &StringId {
|
|
841
|
+
&self.str
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
/// An attr accessor definition
|
|
846
|
+
///
|
|
847
|
+
/// # Example
|
|
848
|
+
/// ```ruby
|
|
849
|
+
/// attr_accessor :foo
|
|
850
|
+
/// ```
|
|
851
|
+
#[derive(Debug)]
|
|
852
|
+
pub struct AttrAccessorDefinition {
|
|
853
|
+
str_id: StringId,
|
|
854
|
+
uri_id: UriId,
|
|
855
|
+
offset: Offset,
|
|
856
|
+
flags: DefinitionFlags,
|
|
857
|
+
comments: Vec<Comment>,
|
|
858
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
859
|
+
visibility: Visibility,
|
|
860
|
+
diagnostics: Vec<Diagnostic>,
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
impl AttrAccessorDefinition {
|
|
864
|
+
#[must_use]
|
|
865
|
+
pub const fn new(
|
|
866
|
+
str_id: StringId,
|
|
867
|
+
uri_id: UriId,
|
|
868
|
+
offset: Offset,
|
|
869
|
+
comments: Vec<Comment>,
|
|
870
|
+
flags: DefinitionFlags,
|
|
871
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
872
|
+
visibility: Visibility,
|
|
873
|
+
) -> Self {
|
|
874
|
+
Self {
|
|
875
|
+
str_id,
|
|
876
|
+
uri_id,
|
|
877
|
+
offset,
|
|
878
|
+
flags,
|
|
879
|
+
comments,
|
|
880
|
+
lexical_nesting_id,
|
|
881
|
+
visibility,
|
|
882
|
+
diagnostics: Vec::new(),
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
#[must_use]
|
|
887
|
+
pub fn id(&self) -> DefinitionId {
|
|
888
|
+
DefinitionId::from(&format!("{}{}{}", *self.uri_id, self.offset.start(), *self.str_id))
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
#[must_use]
|
|
892
|
+
pub fn str_id(&self) -> &StringId {
|
|
893
|
+
&self.str_id
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
#[must_use]
|
|
897
|
+
pub fn uri_id(&self) -> &UriId {
|
|
898
|
+
&self.uri_id
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
#[must_use]
|
|
902
|
+
pub fn offset(&self) -> &Offset {
|
|
903
|
+
&self.offset
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
#[must_use]
|
|
907
|
+
pub fn comments(&self) -> &[Comment] {
|
|
908
|
+
&self.comments
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
#[must_use]
|
|
912
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
913
|
+
&self.lexical_nesting_id
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
#[must_use]
|
|
917
|
+
pub fn visibility(&self) -> &Visibility {
|
|
918
|
+
&self.visibility
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
#[must_use]
|
|
922
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
923
|
+
&self.flags
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/// An attr reader definition
|
|
928
|
+
///
|
|
929
|
+
/// # Example
|
|
930
|
+
/// ```ruby
|
|
931
|
+
/// attr_reader :foo
|
|
932
|
+
/// ```
|
|
933
|
+
#[derive(Debug)]
|
|
934
|
+
pub struct AttrReaderDefinition {
|
|
935
|
+
str_id: StringId,
|
|
936
|
+
uri_id: UriId,
|
|
937
|
+
offset: Offset,
|
|
938
|
+
flags: DefinitionFlags,
|
|
939
|
+
comments: Vec<Comment>,
|
|
940
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
941
|
+
visibility: Visibility,
|
|
942
|
+
diagnostics: Vec<Diagnostic>,
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
impl AttrReaderDefinition {
|
|
946
|
+
#[must_use]
|
|
947
|
+
pub const fn new(
|
|
948
|
+
str_id: StringId,
|
|
949
|
+
uri_id: UriId,
|
|
950
|
+
offset: Offset,
|
|
951
|
+
comments: Vec<Comment>,
|
|
952
|
+
flags: DefinitionFlags,
|
|
953
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
954
|
+
visibility: Visibility,
|
|
955
|
+
) -> Self {
|
|
956
|
+
Self {
|
|
957
|
+
str_id,
|
|
958
|
+
uri_id,
|
|
959
|
+
offset,
|
|
960
|
+
flags,
|
|
961
|
+
comments,
|
|
962
|
+
lexical_nesting_id,
|
|
963
|
+
visibility,
|
|
964
|
+
diagnostics: Vec::new(),
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
#[must_use]
|
|
969
|
+
pub fn id(&self) -> DefinitionId {
|
|
970
|
+
DefinitionId::from(&format!("{}{}{}", *self.uri_id, self.offset.start(), *self.str_id))
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
#[must_use]
|
|
974
|
+
pub fn str_id(&self) -> &StringId {
|
|
975
|
+
&self.str_id
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
#[must_use]
|
|
979
|
+
pub fn uri_id(&self) -> &UriId {
|
|
980
|
+
&self.uri_id
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
#[must_use]
|
|
984
|
+
pub fn offset(&self) -> &Offset {
|
|
985
|
+
&self.offset
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
#[must_use]
|
|
989
|
+
pub fn comments(&self) -> &[Comment] {
|
|
990
|
+
&self.comments
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
#[must_use]
|
|
994
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
995
|
+
&self.lexical_nesting_id
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
#[must_use]
|
|
999
|
+
pub fn visibility(&self) -> &Visibility {
|
|
1000
|
+
&self.visibility
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
#[must_use]
|
|
1004
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
1005
|
+
&self.flags
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
/// An attr writer definition
|
|
1010
|
+
///
|
|
1011
|
+
/// # Example
|
|
1012
|
+
/// ```ruby
|
|
1013
|
+
/// attr_writer :foo
|
|
1014
|
+
/// ```
|
|
1015
|
+
#[derive(Debug)]
|
|
1016
|
+
pub struct AttrWriterDefinition {
|
|
1017
|
+
str_id: StringId,
|
|
1018
|
+
uri_id: UriId,
|
|
1019
|
+
offset: Offset,
|
|
1020
|
+
flags: DefinitionFlags,
|
|
1021
|
+
comments: Vec<Comment>,
|
|
1022
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1023
|
+
visibility: Visibility,
|
|
1024
|
+
diagnostics: Vec<Diagnostic>,
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
impl AttrWriterDefinition {
|
|
1028
|
+
#[must_use]
|
|
1029
|
+
pub const fn new(
|
|
1030
|
+
str_id: StringId,
|
|
1031
|
+
uri_id: UriId,
|
|
1032
|
+
offset: Offset,
|
|
1033
|
+
comments: Vec<Comment>,
|
|
1034
|
+
flags: DefinitionFlags,
|
|
1035
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1036
|
+
visibility: Visibility,
|
|
1037
|
+
) -> Self {
|
|
1038
|
+
Self {
|
|
1039
|
+
str_id,
|
|
1040
|
+
uri_id,
|
|
1041
|
+
offset,
|
|
1042
|
+
flags,
|
|
1043
|
+
comments,
|
|
1044
|
+
lexical_nesting_id,
|
|
1045
|
+
visibility,
|
|
1046
|
+
diagnostics: Vec::new(),
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
#[must_use]
|
|
1051
|
+
pub fn id(&self) -> DefinitionId {
|
|
1052
|
+
DefinitionId::from(&format!("{}{}{}", *self.uri_id, self.offset.start(), *self.str_id))
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
#[must_use]
|
|
1056
|
+
pub fn str_id(&self) -> &StringId {
|
|
1057
|
+
&self.str_id
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
#[must_use]
|
|
1061
|
+
pub fn comments(&self) -> &[Comment] {
|
|
1062
|
+
&self.comments
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
#[must_use]
|
|
1066
|
+
pub fn uri_id(&self) -> &UriId {
|
|
1067
|
+
&self.uri_id
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
#[must_use]
|
|
1071
|
+
pub fn offset(&self) -> &Offset {
|
|
1072
|
+
&self.offset
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
#[must_use]
|
|
1076
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
1077
|
+
&self.lexical_nesting_id
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
#[must_use]
|
|
1081
|
+
pub fn visibility(&self) -> &Visibility {
|
|
1082
|
+
&self.visibility
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
#[must_use]
|
|
1086
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
1087
|
+
&self.flags
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/// A global variable definition
|
|
1092
|
+
///
|
|
1093
|
+
/// # Example
|
|
1094
|
+
/// ```ruby
|
|
1095
|
+
/// $foo = 1
|
|
1096
|
+
/// ```
|
|
1097
|
+
#[derive(Debug)]
|
|
1098
|
+
pub struct GlobalVariableDefinition {
|
|
1099
|
+
str_id: StringId,
|
|
1100
|
+
uri_id: UriId,
|
|
1101
|
+
offset: Offset,
|
|
1102
|
+
flags: DefinitionFlags,
|
|
1103
|
+
comments: Vec<Comment>,
|
|
1104
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1105
|
+
diagnostics: Vec<Diagnostic>,
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
impl GlobalVariableDefinition {
|
|
1109
|
+
#[must_use]
|
|
1110
|
+
pub const fn new(
|
|
1111
|
+
str_id: StringId,
|
|
1112
|
+
uri_id: UriId,
|
|
1113
|
+
offset: Offset,
|
|
1114
|
+
comments: Vec<Comment>,
|
|
1115
|
+
flags: DefinitionFlags,
|
|
1116
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1117
|
+
) -> Self {
|
|
1118
|
+
Self {
|
|
1119
|
+
str_id,
|
|
1120
|
+
uri_id,
|
|
1121
|
+
offset,
|
|
1122
|
+
flags,
|
|
1123
|
+
comments,
|
|
1124
|
+
lexical_nesting_id,
|
|
1125
|
+
diagnostics: Vec::new(),
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
#[must_use]
|
|
1130
|
+
pub fn id(&self) -> DefinitionId {
|
|
1131
|
+
DefinitionId::from(&format!("{}{}{}", *self.uri_id, self.offset.start(), *self.str_id))
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
#[must_use]
|
|
1135
|
+
pub fn str_id(&self) -> &StringId {
|
|
1136
|
+
&self.str_id
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
#[must_use]
|
|
1140
|
+
pub fn uri_id(&self) -> &UriId {
|
|
1141
|
+
&self.uri_id
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
#[must_use]
|
|
1145
|
+
pub fn offset(&self) -> &Offset {
|
|
1146
|
+
&self.offset
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
#[must_use]
|
|
1150
|
+
pub fn comments(&self) -> &[Comment] {
|
|
1151
|
+
&self.comments
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
#[must_use]
|
|
1155
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
1156
|
+
&self.lexical_nesting_id
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
#[must_use]
|
|
1160
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
1161
|
+
&self.flags
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
/// An instance variable definition
|
|
1166
|
+
///
|
|
1167
|
+
/// # Example
|
|
1168
|
+
/// ```ruby
|
|
1169
|
+
/// @foo = 1
|
|
1170
|
+
/// ```
|
|
1171
|
+
#[derive(Debug)]
|
|
1172
|
+
pub struct InstanceVariableDefinition {
|
|
1173
|
+
str_id: StringId,
|
|
1174
|
+
uri_id: UriId,
|
|
1175
|
+
offset: Offset,
|
|
1176
|
+
flags: DefinitionFlags,
|
|
1177
|
+
comments: Vec<Comment>,
|
|
1178
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1179
|
+
diagnostics: Vec<Diagnostic>,
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
impl InstanceVariableDefinition {
|
|
1183
|
+
#[must_use]
|
|
1184
|
+
pub const fn new(
|
|
1185
|
+
str_id: StringId,
|
|
1186
|
+
uri_id: UriId,
|
|
1187
|
+
offset: Offset,
|
|
1188
|
+
comments: Vec<Comment>,
|
|
1189
|
+
flags: DefinitionFlags,
|
|
1190
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1191
|
+
) -> Self {
|
|
1192
|
+
Self {
|
|
1193
|
+
str_id,
|
|
1194
|
+
uri_id,
|
|
1195
|
+
offset,
|
|
1196
|
+
flags,
|
|
1197
|
+
comments,
|
|
1198
|
+
lexical_nesting_id,
|
|
1199
|
+
diagnostics: Vec::new(),
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
#[must_use]
|
|
1204
|
+
pub fn id(&self) -> DefinitionId {
|
|
1205
|
+
DefinitionId::from(&format!("{}{}{}", *self.uri_id, self.offset.start(), *self.str_id))
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
#[must_use]
|
|
1209
|
+
pub fn str_id(&self) -> &StringId {
|
|
1210
|
+
&self.str_id
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
#[must_use]
|
|
1214
|
+
pub fn uri_id(&self) -> &UriId {
|
|
1215
|
+
&self.uri_id
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
#[must_use]
|
|
1219
|
+
pub fn offset(&self) -> &Offset {
|
|
1220
|
+
&self.offset
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
#[must_use]
|
|
1224
|
+
pub fn comments(&self) -> &[Comment] {
|
|
1225
|
+
&self.comments
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
#[must_use]
|
|
1229
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
1230
|
+
&self.lexical_nesting_id
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
#[must_use]
|
|
1234
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
1235
|
+
&self.flags
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
/// A class variable definition
|
|
1240
|
+
///
|
|
1241
|
+
/// # Example
|
|
1242
|
+
/// ```ruby
|
|
1243
|
+
/// @@foo = 1
|
|
1244
|
+
/// ```
|
|
1245
|
+
#[derive(Debug)]
|
|
1246
|
+
pub struct ClassVariableDefinition {
|
|
1247
|
+
str_id: StringId,
|
|
1248
|
+
uri_id: UriId,
|
|
1249
|
+
offset: Offset,
|
|
1250
|
+
flags: DefinitionFlags,
|
|
1251
|
+
comments: Vec<Comment>,
|
|
1252
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1253
|
+
diagnostics: Vec<Diagnostic>,
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
impl ClassVariableDefinition {
|
|
1257
|
+
#[must_use]
|
|
1258
|
+
pub const fn new(
|
|
1259
|
+
str_id: StringId,
|
|
1260
|
+
uri_id: UriId,
|
|
1261
|
+
offset: Offset,
|
|
1262
|
+
comments: Vec<Comment>,
|
|
1263
|
+
flags: DefinitionFlags,
|
|
1264
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1265
|
+
) -> Self {
|
|
1266
|
+
Self {
|
|
1267
|
+
str_id,
|
|
1268
|
+
uri_id,
|
|
1269
|
+
offset,
|
|
1270
|
+
flags,
|
|
1271
|
+
comments,
|
|
1272
|
+
lexical_nesting_id,
|
|
1273
|
+
diagnostics: Vec::new(),
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
#[must_use]
|
|
1278
|
+
pub fn id(&self) -> DefinitionId {
|
|
1279
|
+
DefinitionId::from(&format!("{}{}{}", *self.uri_id, self.offset.start(), *self.str_id))
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
#[must_use]
|
|
1283
|
+
pub fn str_id(&self) -> &StringId {
|
|
1284
|
+
&self.str_id
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
#[must_use]
|
|
1288
|
+
pub fn uri_id(&self) -> &UriId {
|
|
1289
|
+
&self.uri_id
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
#[must_use]
|
|
1293
|
+
pub fn offset(&self) -> &Offset {
|
|
1294
|
+
&self.offset
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
#[must_use]
|
|
1298
|
+
pub fn comments(&self) -> &[Comment] {
|
|
1299
|
+
&self.comments
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
#[must_use]
|
|
1303
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
1304
|
+
&self.lexical_nesting_id
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
#[must_use]
|
|
1308
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
1309
|
+
&self.flags
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
#[derive(Debug)]
|
|
1314
|
+
pub struct MethodAliasDefinition {
|
|
1315
|
+
new_name_str_id: StringId,
|
|
1316
|
+
old_name_str_id: StringId,
|
|
1317
|
+
uri_id: UriId,
|
|
1318
|
+
offset: Offset,
|
|
1319
|
+
flags: DefinitionFlags,
|
|
1320
|
+
comments: Vec<Comment>,
|
|
1321
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1322
|
+
diagnostics: Vec<Diagnostic>,
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
impl MethodAliasDefinition {
|
|
1326
|
+
#[must_use]
|
|
1327
|
+
pub const fn new(
|
|
1328
|
+
new_name_str_id: StringId,
|
|
1329
|
+
old_name_str_id: StringId,
|
|
1330
|
+
uri_id: UriId,
|
|
1331
|
+
offset: Offset,
|
|
1332
|
+
comments: Vec<Comment>,
|
|
1333
|
+
flags: DefinitionFlags,
|
|
1334
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1335
|
+
) -> Self {
|
|
1336
|
+
Self {
|
|
1337
|
+
new_name_str_id,
|
|
1338
|
+
old_name_str_id,
|
|
1339
|
+
uri_id,
|
|
1340
|
+
offset,
|
|
1341
|
+
flags,
|
|
1342
|
+
comments,
|
|
1343
|
+
lexical_nesting_id,
|
|
1344
|
+
diagnostics: Vec::new(),
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
#[must_use]
|
|
1349
|
+
pub fn id(&self) -> DefinitionId {
|
|
1350
|
+
DefinitionId::from(&format!(
|
|
1351
|
+
"{}{}{}{}",
|
|
1352
|
+
*self.uri_id,
|
|
1353
|
+
self.offset.start(),
|
|
1354
|
+
*self.new_name_str_id,
|
|
1355
|
+
*self.old_name_str_id,
|
|
1356
|
+
))
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
#[must_use]
|
|
1360
|
+
pub fn new_name_str_id(&self) -> &StringId {
|
|
1361
|
+
&self.new_name_str_id
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
#[must_use]
|
|
1365
|
+
pub fn old_name_str_id(&self) -> &StringId {
|
|
1366
|
+
&self.old_name_str_id
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
#[must_use]
|
|
1370
|
+
pub fn uri_id(&self) -> &UriId {
|
|
1371
|
+
&self.uri_id
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
#[must_use]
|
|
1375
|
+
pub fn offset(&self) -> &Offset {
|
|
1376
|
+
&self.offset
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
#[must_use]
|
|
1380
|
+
pub fn comments(&self) -> &[Comment] {
|
|
1381
|
+
&self.comments
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
#[must_use]
|
|
1385
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
1386
|
+
&self.lexical_nesting_id
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
#[must_use]
|
|
1390
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
1391
|
+
&self.flags
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
#[derive(Debug)]
|
|
1396
|
+
pub struct GlobalVariableAliasDefinition {
|
|
1397
|
+
new_name_str_id: StringId,
|
|
1398
|
+
old_name_str_id: StringId,
|
|
1399
|
+
uri_id: UriId,
|
|
1400
|
+
offset: Offset,
|
|
1401
|
+
flags: DefinitionFlags,
|
|
1402
|
+
comments: Vec<Comment>,
|
|
1403
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1404
|
+
diagnostics: Vec<Diagnostic>,
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
impl GlobalVariableAliasDefinition {
|
|
1408
|
+
#[must_use]
|
|
1409
|
+
pub const fn new(
|
|
1410
|
+
new_name_str_id: StringId,
|
|
1411
|
+
old_name_str_id: StringId,
|
|
1412
|
+
uri_id: UriId,
|
|
1413
|
+
offset: Offset,
|
|
1414
|
+
comments: Vec<Comment>,
|
|
1415
|
+
flags: DefinitionFlags,
|
|
1416
|
+
lexical_nesting_id: Option<DefinitionId>,
|
|
1417
|
+
) -> Self {
|
|
1418
|
+
Self {
|
|
1419
|
+
new_name_str_id,
|
|
1420
|
+
old_name_str_id,
|
|
1421
|
+
uri_id,
|
|
1422
|
+
offset,
|
|
1423
|
+
flags,
|
|
1424
|
+
comments,
|
|
1425
|
+
lexical_nesting_id,
|
|
1426
|
+
diagnostics: Vec::new(),
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
#[must_use]
|
|
1431
|
+
pub fn id(&self) -> DefinitionId {
|
|
1432
|
+
DefinitionId::from(&format!(
|
|
1433
|
+
"{}{}{}{}",
|
|
1434
|
+
*self.uri_id,
|
|
1435
|
+
self.offset.start(),
|
|
1436
|
+
*self.new_name_str_id,
|
|
1437
|
+
*self.old_name_str_id,
|
|
1438
|
+
))
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
#[must_use]
|
|
1442
|
+
pub fn new_name_str_id(&self) -> &StringId {
|
|
1443
|
+
&self.new_name_str_id
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
#[must_use]
|
|
1447
|
+
pub fn old_name_str_id(&self) -> &StringId {
|
|
1448
|
+
&self.old_name_str_id
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
#[must_use]
|
|
1452
|
+
pub fn uri_id(&self) -> &UriId {
|
|
1453
|
+
&self.uri_id
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
#[must_use]
|
|
1457
|
+
pub fn offset(&self) -> &Offset {
|
|
1458
|
+
&self.offset
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
#[must_use]
|
|
1462
|
+
pub fn comments(&self) -> &[Comment] {
|
|
1463
|
+
&self.comments
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
#[must_use]
|
|
1467
|
+
pub fn lexical_nesting_id(&self) -> &Option<DefinitionId> {
|
|
1468
|
+
&self.lexical_nesting_id
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
#[must_use]
|
|
1472
|
+
pub fn flags(&self) -> &DefinitionFlags {
|
|
1473
|
+
&self.flags
|
|
1474
|
+
}
|
|
1475
|
+
}
|