Skip to content

Commit

Permalink
fix(Rust parser): Use Declare instead of Assign for variable decl…
Browse files Browse the repository at this point in the history
…arations
  • Loading branch information
nokome committed Jan 26, 2022
1 parent 60095f7 commit ab77d38
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
4 changes: 2 additions & 2 deletions rust/parser-rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ impl ParserTrait for RustParser {
.iter()
.filter_map(|(pattern, captures)| match pattern {
1 | 2 | 3 => {
// Assigns a variable
// Declares a variable
let range = captures[0].range;
let name = captures[0].text.clone();
Some((
relations::assigns(range),
relations::declares(range),
resources::symbol(path, &name, ""),
))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ input_file: fixtures/fragments/rust/assigns.rs
"relations": [
[
{
"type": "Assign",
"type": "Declare",
"range": [
0,
6,
Expand All @@ -33,7 +33,7 @@ input_file: fixtures/fragments/rust/assigns.rs
],
[
{
"type": "Assign",
"type": "Declare",
"range": [
1,
7,
Expand All @@ -50,7 +50,7 @@ input_file: fixtures/fragments/rust/assigns.rs
],
[
{
"type": "Assign",
"type": "Declare",
"range": [
3,
4,
Expand All @@ -67,7 +67,7 @@ input_file: fixtures/fragments/rust/assigns.rs
],
[
{
"type": "Assign",
"type": "Declare",
"range": [
4,
4,
Expand All @@ -84,7 +84,7 @@ input_file: fixtures/fragments/rust/assigns.rs
],
[
{
"type": "Assign",
"type": "Declare",
"range": [
5,
4,
Expand All @@ -101,7 +101,7 @@ input_file: fixtures/fragments/rust/assigns.rs
],
[
{
"type": "Assign",
"type": "Declare",
"range": [
6,
4,
Expand All @@ -118,7 +118,7 @@ input_file: fixtures/fragments/rust/assigns.rs
],
[
{
"type": "Assign",
"type": "Declare",
"range": [
7,
4,
Expand All @@ -135,7 +135,7 @@ input_file: fixtures/fragments/rust/assigns.rs
],
[
{
"type": "Assign",
"type": "Declare",
"range": [
8,
4,
Expand All @@ -152,7 +152,7 @@ input_file: fixtures/fragments/rust/assigns.rs
],
[
{
"type": "Assign",
"type": "Declare",
"range": [
9,
4,
Expand Down
17 changes: 17 additions & 0 deletions rust/parser-rust/src/snapshots/parse_rust_fragments@tags.rs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ input_file: fixtures/fragments/rust/tags.rs
"language": "Rust"
},
"relations": [
[
{
"type": "Declare",
"range": [
8,
4,
8,
10
]
},
{
"type": "Symbol",
"path": "fragments/rust/tags.rs",
"name": "ignore",
"kind": ""
}
],
[
{
"type": "Use",
Expand Down

0 comments on commit ab77d38

Please sign in to comment.