feat: update rnix, support pipe operator

This commit is contained in:
2025-05-13 11:07:56 +08:00
parent 0274d95f48
commit dcfe192aff
4 changed files with 22 additions and 6 deletions

8
Cargo.lock generated
View File

@@ -193,9 +193,9 @@ dependencies = [
[[package]]
name = "itertools"
version = "0.12.1"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
dependencies = [
"either",
]
@@ -360,9 +360,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "rnix"
version = "0.11.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb35cedbeb70e0ccabef2a31bcff0aebd114f19566086300b8f42c725fc2cb5f"
checksum = "6f15e00b0ab43abd70d50b6f8cd021290028f9b7fdd7cdfa6c35997173bc1ba9"
dependencies = [
"rowan",
]

View File

@@ -15,9 +15,9 @@ debug = 1
inherits = "release"
[dependencies]
rnix = "0.11"
rnix = "0.12"
thiserror = "2.0"
itertools = "0.12"
itertools = "0.14"
rpds = "1.1"
derive_more = { version = "2.0", features = [ "full" ] }
ecow = "0.2"

View File

@@ -248,6 +248,17 @@ impl Compile for ir::BinOp {
comp.push(OpCode::Call { arity: 2 });
comp.push(OpCode::UnOp { op: UnOp::Not });
}
PipeL => {
self.lhs.compile(comp);
self.rhs.compile(comp);
comp.push(OpCode::Call { arity: 1 });
}
PipeR => {
self.rhs.compile(comp);
self.lhs.compile(comp);
comp.push(OpCode::Call { arity: 1 });
}
}
}
}

View File

@@ -274,6 +274,9 @@ pub enum BinOpKind {
Con,
Upd,
PipeL,
PipeR,
}
impl From<ast::BinOpKind> for BinOpKind {
@@ -296,6 +299,8 @@ impl From<ast::BinOpKind> for BinOpKind {
astkind::MoreOrEq => Geq,
astkind::NotEqual => Neq,
astkind::Or => Or,
astkind::PipeLeft => PipeL,
astkind::PipeRight => PipeR,
}
}
}