Skip to content

Commit efcf07b

Browse files
committed
Generify CST/Cursor/Query
This rebases #930 after applying recent infra changes.
1 parent 874039b commit efcf07b

108 files changed

Lines changed: 1086 additions & 4057 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@nomicfoundation/slang": patch
3+
---
4+
5+
refactor CST building and querying utilities into a separate `metaslang_cst` crate.

.cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"inheritdoc",
1414
"instanceof",
1515
"ipfs",
16+
"metaslang",
1617
"mkdocs",
1718
"napi",
1819
"nomic",

Cargo.lock

Lines changed: 15 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ members = [
2323
"crates/infra/cli",
2424
"crates/infra/utils",
2525

26+
"crates/metaslang/cst",
27+
2628
"crates/solidity/inputs/language",
2729
"crates/solidity/outputs/cargo/slang_solidity_node_addon",
2830
"crates/solidity/outputs/cargo/slang_solidity",
@@ -60,6 +62,8 @@ codegen_testing = { path = "crates/codegen/testing" }
6062
infra_cli = { path = "crates/infra/cli" }
6163
infra_utils = { path = "crates/infra/utils" }
6264

65+
metaslang_cst = { path = "crates/metaslang/cst" }
66+
6367
slang_solidity = { path = "crates/solidity/outputs/cargo/slang_solidity" }
6468
slang_solidity_node_addon = { path = "crates/solidity/outputs/cargo/slang_solidity_node_addon" }
6569
solidity_cargo_tests = { path = "crates/solidity/outputs/cargo/tests" }

crates/codegen/language/definition/src/compiler/analysis/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
mod definitions;
2-
mod queries;
32
mod reachability;
43
mod references;
54
mod utils;
@@ -10,7 +9,6 @@ use indexmap::IndexMap;
109
use proc_macro2::Span;
1110

1211
use crate::compiler::analysis::definitions::analyze_definitions;
13-
use crate::compiler::analysis::queries::analyze_queries;
1412
use crate::compiler::analysis::reachability::analyze_reachability;
1513
use crate::compiler::analysis::references::analyze_references;
1614
use crate::compiler::version_set::VersionSet;
@@ -64,7 +62,6 @@ impl Analysis {
6462
}
6563

6664
analyze_reachability(&mut analysis);
67-
analyze_queries(&mut analysis);
6865

6966
analysis
7067
}

crates/codegen/language/definition/src/compiler/analysis/queries.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

crates/codegen/language/definition/src/model/manifest.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::collections::BTreeSet;
22
use std::path::PathBuf;
33

44
use codegen_language_internal_macros::{derive_spanned_type, ParseInputTokens, WriteOutputTokens};
5-
use indexmap::{IndexMap, IndexSet};
5+
use indexmap::IndexSet;
66
use semver::Version;
77
use serde::{Deserialize, Serialize};
88

@@ -22,8 +22,6 @@ pub struct Language {
2222
pub versions: IndexSet<Version>,
2323

2424
pub sections: Vec<Section>,
25-
26-
pub queries: IndexMap<Identifier, String>,
2725
}
2826

2927
impl Language {

crates/codegen/language/tests/src/fail/definitions/duplicate_expression_name/test.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ codegen_language_macros::compile!(Language(
2727
)
2828
]
2929
)]
30-
)],
31-
queries = ()
30+
)]
3231
));
3332

3433
fn main() {}

crates/codegen/language/tests/src/fail/definitions/duplicate_item_name/test.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ codegen_language_macros::compile!(Language(
1717
Struct(name = Bar2, fields = (field = Required(Bar1)))
1818
]
1919
)]
20-
)],
21-
queries = ()
20+
)]
2221
));
2322

2423
fn main() {}

crates/codegen/language/tests/src/fail/definitions/duplicate_variant_name/test.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ codegen_language_macros::compile!(Language(
3030
)
3131
]
3232
)]
33-
)],
34-
queries = ()
33+
)]
3534
));
3635

3736
fn main() {}

0 commit comments

Comments
 (0)