forked from Rust-related/RustPython
Revert a few .as_str() calls by adding it to ast
This commit is contained in:
15
Cargo.lock
generated
15
Cargo.lock
generated
@@ -1804,7 +1804,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "ruff_source_location"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=aa101e4f2693624eddabe35eaf3067bba65331df#aa101e4f2693624eddabe35eaf3067bba65331df"
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=5b2af304a2baa53598e594097824165d4ac7a119#5b2af304a2baa53598e594097824165d4ac7a119"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"once_cell",
|
||||
@@ -1814,10 +1814,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "ruff_text_size"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=aa101e4f2693624eddabe35eaf3067bba65331df#aa101e4f2693624eddabe35eaf3067bba65331df"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=5b2af304a2baa53598e594097824165d4ac7a119#5b2af304a2baa53598e594097824165d4ac7a119"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
@@ -1875,7 +1872,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rustpython-ast"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=aa101e4f2693624eddabe35eaf3067bba65331df#aa101e4f2693624eddabe35eaf3067bba65331df"
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=5b2af304a2baa53598e594097824165d4ac7a119#5b2af304a2baa53598e594097824165d4ac7a119"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"rustpython-literal",
|
||||
@@ -1999,7 +1996,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rustpython-literal"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=aa101e4f2693624eddabe35eaf3067bba65331df#aa101e4f2693624eddabe35eaf3067bba65331df"
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=5b2af304a2baa53598e594097824165d4ac7a119#5b2af304a2baa53598e594097824165d4ac7a119"
|
||||
dependencies = [
|
||||
"hexf-parse",
|
||||
"lexical-parse-float",
|
||||
@@ -2010,7 +2007,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rustpython-parser"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=aa101e4f2693624eddabe35eaf3067bba65331df#aa101e4f2693624eddabe35eaf3067bba65331df"
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=5b2af304a2baa53598e594097824165d4ac7a119#5b2af304a2baa53598e594097824165d4ac7a119"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"itertools",
|
||||
@@ -2032,7 +2029,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rustpython-parser-core"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=aa101e4f2693624eddabe35eaf3067bba65331df#aa101e4f2693624eddabe35eaf3067bba65331df"
|
||||
source = "git+https://github.com/youknowone/RustPython-parser.git?rev=5b2af304a2baa53598e594097824165d4ac7a119#5b2af304a2baa53598e594097824165d4ac7a119"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"lz4_flex",
|
||||
|
||||
@@ -29,10 +29,10 @@ rustpython-pylib = { path = "pylib" }
|
||||
rustpython-stdlib = { path = "stdlib" }
|
||||
rustpython-doc = { git = "https://github.com/RustPython/__doc__", branch = "main" }
|
||||
|
||||
rustpython-literal = { git = "https://github.com/youknowone/RustPython-parser.git", rev = "aa101e4f2693624eddabe35eaf3067bba65331df" }
|
||||
rustpython-parser-core = { git = "https://github.com/youknowone/RustPython-parser.git", rev = "aa101e4f2693624eddabe35eaf3067bba65331df" }
|
||||
rustpython-parser = { git = "https://github.com/youknowone/RustPython-parser.git", rev = "aa101e4f2693624eddabe35eaf3067bba65331df" }
|
||||
rustpython-ast = { git = "https://github.com/youknowone/RustPython-parser.git", rev = "aa101e4f2693624eddabe35eaf3067bba65331df" }
|
||||
rustpython-literal = { git = "https://github.com/youknowone/RustPython-parser.git", rev = "5b2af304a2baa53598e594097824165d4ac7a119" }
|
||||
rustpython-parser-core = { git = "https://github.com/youknowone/RustPython-parser.git", rev = "5b2af304a2baa53598e594097824165d4ac7a119" }
|
||||
rustpython-parser = { git = "https://github.com/youknowone/RustPython-parser.git", rev = "5b2af304a2baa53598e594097824165d4ac7a119" }
|
||||
rustpython-ast = { git = "https://github.com/youknowone/RustPython-parser.git", rev = "5b2af304a2baa53598e594097824165d4ac7a119" }
|
||||
# rustpython-literal = { path = "../RustPython-parser/literal" }
|
||||
# rustpython-parser-core = { path = "../RustPython-parser/core" }
|
||||
# rustpython-parser = { path = "../RustPython-parser/parser" }
|
||||
|
||||
@@ -582,16 +582,16 @@ impl Compiler {
|
||||
value: num_traits::Zero::zero(),
|
||||
});
|
||||
self.emit_constant(ConstantData::None);
|
||||
let idx = self.name(name.name.as_str());
|
||||
let idx = self.name(&name.name);
|
||||
emit!(self, Instruction::ImportName { idx });
|
||||
if let Some(alias) = &name.asname {
|
||||
for part in name.name.as_str().split('.').skip(1) {
|
||||
for part in name.name.split('.').skip(1) {
|
||||
let idx = self.name(part);
|
||||
emit!(self, Instruction::LoadAttr { idx });
|
||||
}
|
||||
self.store_name(alias.as_str())?
|
||||
} else {
|
||||
self.store_name(name.name.as_str().split('.').next().unwrap())?
|
||||
self.store_name(name.name.split('.').next().unwrap())?
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -600,7 +600,7 @@ impl Compiler {
|
||||
module,
|
||||
names,
|
||||
}) => {
|
||||
let import_star = names.iter().any(|n| n.node.name.as_str() == "*");
|
||||
let import_star = names.iter().any(|n| &n.node.name == "*");
|
||||
|
||||
let from_list = if import_star {
|
||||
if self.ctx.in_func() {
|
||||
|
||||
@@ -646,7 +646,7 @@ impl SymbolTableBuilder {
|
||||
if let ImportFrom(StmtImportFrom { module, names, .. }) = &statement.node {
|
||||
if module.as_ref().map(|id| id.as_str()) == Some("__future__") {
|
||||
for feature in names {
|
||||
if feature.node.name.as_str() == "annotations" {
|
||||
if &feature.node.name == "annotations" {
|
||||
self.future_annotations = true;
|
||||
}
|
||||
}
|
||||
@@ -752,7 +752,7 @@ impl SymbolTableBuilder {
|
||||
} else {
|
||||
// `import module`
|
||||
self.register_name(
|
||||
name.node.name.as_str().split('.').next().unwrap(),
|
||||
name.node.name.split('.').next().unwrap(),
|
||||
SymbolUsage::Imported,
|
||||
location,
|
||||
)?;
|
||||
|
||||
Reference in New Issue
Block a user