|
139 | 139 | //!
|
140 | 140 | //! Adds a new internal scope node to this file.
|
141 | 141 | //!
|
| 142 | +//! #### `jump_to_node` |
| 143 | +//! |
| 144 | +//! ``` lua |
| 145 | +//! local node = file:jump_to_node() |
| 146 | +//! ``` |
| 147 | +//! |
| 148 | +//! Returns the root node of the graph containing this file. |
| 149 | +//! |
142 | 150 | //! #### `pop_scoped_symbol_node`
|
143 | 151 | //!
|
144 | 152 | //! ``` lua
|
|
185 | 193 | //! Adds a new definition node to this file. `symbol` must be a string, or an instance that can be
|
186 | 194 | //! converted to a string via its `tostring` method.
|
187 | 195 | //!
|
| 196 | +//! #### `root_node` |
| 197 | +//! |
| 198 | +//! ``` lua |
| 199 | +//! local node = file:root_node() |
| 200 | +//! ``` |
| 201 | +//! |
| 202 | +//! Returns the root node of the graph containing this file. |
| 203 | +//! |
188 | 204 | //! #### `scoped_definition_node`
|
189 | 205 | //!
|
190 | 206 | //! ``` lua
|
@@ -494,6 +510,14 @@ impl UserData for Handle<File> {
|
494 | 510 | Ok(node_ud)
|
495 | 511 | });
|
496 | 512 |
|
| 513 | + methods.add_function("jump_to_node", |l, file_ud: AnyUserData| { |
| 514 | + let graph_ud = file_ud.user_value::<AnyUserData>()?; |
| 515 | + let node = StackGraph::jump_to_node(); |
| 516 | + let node_ud = l.create_userdata(node)?; |
| 517 | + node_ud.set_user_value(graph_ud)?; |
| 518 | + Ok(node_ud) |
| 519 | + }); |
| 520 | + |
497 | 521 | methods.add_function(
|
498 | 522 | "pop_scoped_symbol_node",
|
499 | 523 | |l, (file_ud, symbol): (AnyUserData, String)| {
|
@@ -599,6 +623,14 @@ impl UserData for Handle<File> {
|
599 | 623 | },
|
600 | 624 | );
|
601 | 625 |
|
| 626 | + methods.add_function("root_node", |l, file_ud: AnyUserData| { |
| 627 | + let graph_ud = file_ud.user_value::<AnyUserData>()?; |
| 628 | + let node = StackGraph::root_node(); |
| 629 | + let node_ud = l.create_userdata(node)?; |
| 630 | + node_ud.set_user_value(graph_ud)?; |
| 631 | + Ok(node_ud) |
| 632 | + }); |
| 633 | + |
602 | 634 | methods.add_function(
|
603 | 635 | "scoped_definition_node",
|
604 | 636 | |l, (file_ud, symbol): (AnyUserData, String)| {
|
|
0 commit comments