Skip to content

Commit

Permalink
Temporarily revert for benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Apr 18, 2024
1 parent 835052c commit d459e4a
Showing 1 changed file with 37 additions and 27 deletions.
64 changes: 37 additions & 27 deletions crates/ruff_python_semantic/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,33 +821,43 @@ impl<'a> SemanticModel<'a> {
}
}
BindingKind::ClassDefinition(_) | BindingKind::FunctionDefinition(_) => {
// If we have a fully-qualified path for the module, use it.
if let Some(path) = self.module.qualified_name() {
Some(
path.iter()
.map(String::as_str)
.chain(
UnqualifiedName::from_expr(value)?
.segments()
.iter()
.copied(),
)
.collect(),
)
} else {
// Otherwise, if we're in (e.g.) a script, use the module name.
let name = self.module.name()?;
Some(
std::iter::once(name)
.chain(
UnqualifiedName::from_expr(value)?
.segments()
.iter()
.copied(),
)
.collect(),
)
}
let value_name = UnqualifiedName::from_expr(value)?;
let resolved: QualifiedName = self
.module
.qualified_name()?
.iter()
.map(String::as_str)
.chain(value_name.segments().iter().copied())
.collect();
Some(resolved)

// // If we have a fully-qualified path for the module, use it.
// if let Some(path) = self.module.qualified_name() {
// Some(
// path.iter()
// .map(String::as_str)
// .chain(
// UnqualifiedName::from_expr(value)?
// .segments()
// .iter()
// .copied(),
// )
// .collect(),
// )
// } else {
// // Otherwise, if we're in (e.g.) a script, use the module name.
// let name = self.module.name()?;
// Some(
// std::iter::once(name)
// .chain(
// UnqualifiedName::from_expr(value)?
// .segments()
// .iter()
// .copied(),
// )
// .collect(),
// )
// }
}
_ => None,
}
Expand Down

0 comments on commit d459e4a

Please sign in to comment.