Compare commits

..

1 Commits

Author SHA1 Message Date
David Mak d37287a33d Cargo: Update dependencies 2023-09-04 10:43:57 +08:00
8 changed files with 20 additions and 22 deletions

View File

@ -9,7 +9,7 @@ name = "nac3artiq"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[dependencies] [dependencies]
pyo3 = { version = "0.19.2", features = ["extension-module"] } pyo3 = { version = "0.19", features = ["extension-module"] }
parking_lot = "0.12" parking_lot = "0.12"
tempfile = "3" tempfile = "3"
nac3parser = { path = "../nac3parser" } nac3parser = { path = "../nac3parser" }
@ -17,7 +17,7 @@ nac3core = { path = "../nac3core" }
nac3ld = { path = "../nac3ld" } nac3ld = { path = "../nac3ld" }
[dependencies.inkwell] [dependencies.inkwell]
version = "0.2.0" version = "0.2"
default-features = false default-features = false
features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]

View File

@ -143,7 +143,7 @@ impl Nac3 {
if *id == "Exception".into() { if *id == "Exception".into() {
Ok(true) Ok(true)
} else { } else {
let base_obj = module.getattr(py, &*id.to_string())?; let base_obj = module.getattr(py, id.to_string().as_str())?;
let base_id = id_fn.call1((base_obj,))?.extract()?; let base_id = id_fn.call1((base_obj,))?.extract()?;
Ok(registered_class_ids.contains(&base_id)) Ok(registered_class_ids.contains(&base_id))
} }
@ -325,7 +325,7 @@ impl Nac3 {
let helper = helper.clone(); let helper = helper.clone();
let class_obj; let class_obj;
if let StmtKind::ClassDef { name, .. } = &stmt.node { if let StmtKind::ClassDef { name, .. } = &stmt.node {
let class = py_module.getattr(&*name.to_string()).unwrap(); let class = py_module.getattr(name.to_string().as_str()).unwrap();
if issubclass.call1((class, exn_class)).unwrap().extract().unwrap() && if issubclass.call1((class, exn_class)).unwrap().extract().unwrap() &&
class.getattr("artiq_builtin").is_err() { class.getattr("artiq_builtin").is_err() {
class_obj = Some(class); class_obj = Some(class);
@ -385,13 +385,13 @@ impl Nac3 {
match &stmt.node { match &stmt.node {
StmtKind::FunctionDef { decorator_list, .. } => { StmtKind::FunctionDef { decorator_list, .. } => {
if decorator_list.iter().any(|decorator| matches!(decorator.node, ExprKind::Name { id, .. } if id == "rpc".into())) { if decorator_list.iter().any(|decorator| matches!(decorator.node, ExprKind::Name { id, .. } if id == "rpc".into())) {
store_fun.call1(py, (def_id.0.into_py(py), module.getattr(py, &*name.to_string()).unwrap())).unwrap(); store_fun.call1(py, (def_id.0.into_py(py), module.getattr(py, name.to_string().as_str()).unwrap())).unwrap();
rpc_ids.push((None, def_id)); rpc_ids.push((None, def_id));
} }
} }
StmtKind::ClassDef { name, body, .. } => { StmtKind::ClassDef { name, body, .. } => {
let class_name = name.to_string(); let class_name = name.to_string();
let class_obj = module.getattr(py, &*class_name).unwrap(); let class_obj = module.getattr(py, class_name.as_str()).unwrap();
for stmt in body.iter() { for stmt in body.iter() {
if let StmtKind::FunctionDef { name, decorator_list, .. } = &stmt.node { if let StmtKind::FunctionDef { name, decorator_list, .. } = &stmt.node {
if decorator_list.iter().any(|decorator| matches!(decorator.node, ExprKind::Name { id, .. } if id == "rpc".into())) { if decorator_list.iter().any(|decorator| matches!(decorator.node, ExprKind::Name { id, .. } if id == "rpc".into())) {
@ -517,7 +517,7 @@ impl Nac3 {
py, py,
( (
id.0.into_py(py), id.0.into_py(py),
class_def.getattr(py, &*name.to_string()).unwrap(), class_def.getattr(py, name.to_string().as_str()).unwrap(),
), ),
) )
.unwrap(); .unwrap();

View File

@ -166,7 +166,7 @@ impl StaticValue for PythonValue {
let ty_id: u64 = helper.id_fn.call1(py, (ty,))?.extract(py)?; let ty_id: u64 = helper.id_fn.call1(py, (ty,))?.extract(py)?;
// for optimizing unwrap KernelInvariant // for optimizing unwrap KernelInvariant
if ty_id == self.resolver.primitive_ids.option && name == "_nac3_option".into() { if ty_id == self.resolver.primitive_ids.option && name == "_nac3_option".into() {
let obj = self.value.getattr(py, &*name.to_string())?; let obj = self.value.getattr(py, name.to_string().as_str())?;
let id = self.resolver.helper.id_fn.call1(py, (&obj,))?.extract(py)?; let id = self.resolver.helper.id_fn.call1(py, (&obj,))?.extract(py)?;
if self.id == self.resolver.primitive_ids.none { if self.id == self.resolver.primitive_ids.none {
return Ok(None) return Ok(None)
@ -188,7 +188,7 @@ impl StaticValue for PythonValue {
let result = if mutable { let result = if mutable {
None None
} else { } else {
let obj = self.value.getattr(py, &*name.to_string())?; let obj = self.value.getattr(py, name.to_string().as_str())?;
let id = self.resolver.helper.id_fn.call1(py, (&obj,))?.extract(py)?; let id = self.resolver.helper.id_fn.call1(py, (&obj,))?.extract(py)?;
Some((id, obj)) Some((id, obj))
}; };
@ -695,7 +695,7 @@ impl InnerResolver {
if let TypeEnum::TFunc(..) = &*unifier.get_ty(field.1.0) { if let TypeEnum::TFunc(..) = &*unifier.get_ty(field.1.0) {
continue; continue;
} else { } else {
let field_data = match obj.getattr(&*name) { let field_data = match obj.getattr(name.as_str()) {
Ok(d) => d, Ok(d) => d,
Err(e) => return Ok(Err(format!("{}", e))), Err(e) => return Ok(Err(format!("{}", e))),
}; };
@ -994,7 +994,7 @@ impl InnerResolver {
let values: Result<Option<Vec<_>>, _> = fields let values: Result<Option<Vec<_>>, _> = fields
.iter() .iter()
.map(|(name, ty, _)| { .map(|(name, ty, _)| {
self.get_obj_value(py, obj.getattr(&*name.to_string())?, ctx, generator, *ty) self.get_obj_value(py, obj.getattr(name.to_string().as_str())?, ctx, generator, *ty)
.map_err(|e| super::CompileError::new_err(format!("Error getting field {}: {}", name, e))) .map_err(|e| super::CompileError::new_err(format!("Error getting field {}: {}", name, e)))
}) })
.collect(); .collect();

View File

@ -5,7 +5,7 @@ authors = ["M-Labs"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
itertools = "0.11.0" itertools = "0.11"
crossbeam = "0.8" crossbeam = "0.8"
parking_lot = "0.12" parking_lot = "0.12"
rayon = "1.5" rayon = "1.5"
@ -13,13 +13,13 @@ nac3parser = { path = "../nac3parser" }
lazy_static = "1.4" lazy_static = "1.4"
[dependencies.inkwell] [dependencies.inkwell]
version = "0.2.0" version = "0.2"
default-features = false default-features = false
features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]
[dev-dependencies] [dev-dependencies]
test-case = "1.2.0" test-case = "1.2.0"
indoc = "2.0.3" indoc = "2.0"
insta = "=1.11.0" insta = "=1.11.0"
[build-dependencies] [build-dependencies]

View File

@ -11,7 +11,6 @@ use indoc::indoc;
use nac3parser::{ast::fold::Fold, parser::parse_program}; use nac3parser::{ast::fold::Fold, parser::parse_program};
use parking_lot::Mutex; use parking_lot::Mutex;
use std::{collections::HashMap, sync::Arc}; use std::{collections::HashMap, sync::Arc};
use std::thread::current;
use test_case::test_case; use test_case::test_case;
use super::*; use super::*;
@ -563,7 +562,6 @@ fn test_analyze(source: Vec<&str>, res: Vec<&str>) {
let def = &*def.read(); let def = &*def.read();
res_vec.push(format!("{}\n", def.to_string(composer.unifier.borrow_mut()))); res_vec.push(format!("{}\n", def.to_string(composer.unifier.borrow_mut())));
} }
println!("{}", current().name().unwrap());
insta::assert_debug_snapshot!(res_vec); insta::assert_debug_snapshot!(res_vec);
} }
} }

View File

@ -8,17 +8,17 @@ license = "MIT"
edition = "2018" edition = "2018"
[build-dependencies] [build-dependencies]
lalrpop = "0.20.0" lalrpop = "0.20"
[dependencies] [dependencies]
nac3ast = { path = "../nac3ast" } nac3ast = { path = "../nac3ast" }
lalrpop-util = "0.20.0" lalrpop-util = "0.20"
log = "0.4" log = "0.4"
unic-emoji-char = "0.9" unic-emoji-char = "0.9"
unic-ucd-ident = "0.9" unic-ucd-ident = "0.9"
unicode_names2 = "1.0.0" unicode_names2 = "1.0"
phf = { version = "0.11", features = ["macros"] } phf = { version = "0.11", features = ["macros"] }
ahash = "0.8.3" ahash = "0.8"
[dev-dependencies] [dev-dependencies]
insta = "=1.11.0" insta = "=1.11.0"

View File

@ -10,6 +10,6 @@ nac3parser = { path = "../nac3parser" }
nac3core = { path = "../nac3core" } nac3core = { path = "../nac3core" }
[dependencies.inkwell] [dependencies.inkwell]
version = "0.2.0" version = "0.2"
default-features = false default-features = false
features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]

View File

@ -5,4 +5,4 @@ authors = ["M-Labs"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
libloading = "0.8.0" libloading = "0.8"