mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-18 17:40:37 +00:00
Rename semantic_model
and model
usages to semantic
(#5097)
## Summary As discussed in Discord, and similar to oxc, we're going to refer to this as `.semantic()` everywhere. While I was auditing usages of `model: &SemanticModel`, I also changed as many function signatures as I could find to consistently take the model as the _last_ argument, rather than the first.
This commit is contained in:
parent
65dbfd2556
commit
bae183b823
209 changed files with 1058 additions and 1167 deletions
|
@ -142,11 +142,11 @@ impl<'a> Binding<'a> {
|
|||
}
|
||||
|
||||
/// Returns the appropriate visual range for highlighting this binding.
|
||||
pub fn trimmed_range(&self, semantic_model: &SemanticModel, locator: &Locator) -> TextRange {
|
||||
pub fn trimmed_range(&self, semantic: &SemanticModel, locator: &Locator) -> TextRange {
|
||||
match self.kind {
|
||||
BindingKind::ClassDefinition | BindingKind::FunctionDefinition => {
|
||||
self.source.map_or(self.range, |source| {
|
||||
helpers::identifier_range(semantic_model.stmts[source], locator)
|
||||
helpers::identifier_range(semantic.stmts[source], locator)
|
||||
})
|
||||
}
|
||||
_ => self.range,
|
||||
|
@ -154,9 +154,9 @@ impl<'a> Binding<'a> {
|
|||
}
|
||||
|
||||
/// Returns the range of the binding's parent.
|
||||
pub fn parent_range(&self, semantic_model: &SemanticModel) -> Option<TextRange> {
|
||||
pub fn parent_range(&self, semantic: &SemanticModel) -> Option<TextRange> {
|
||||
self.source
|
||||
.map(|node_id| semantic_model.stmts[node_id])
|
||||
.map(|node_id| semantic.stmts[node_id])
|
||||
.and_then(|parent| {
|
||||
if parent.is_import_from_stmt() {
|
||||
Some(parent.range())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue