chore(tvix/eval): bump rnix-parser to latest master

In this commit, the string interpolation parsing is identical to
nixpkgs which makes some of the upstream Nix tests for
interpolation-related weirdness pass.

Change-Id: I3a295cfdc404c32228a54846e6efd3c0dcee5842
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6233
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2022-08-22 21:04:50 +03:00 committed by tazjin
parent 5522ddfbf5
commit 3bf487b98b
3 changed files with 8 additions and 8 deletions

View file

@ -188,16 +188,16 @@ impl Compiler {
// they need to be reversed on the stack in order to
// efficiently create the real string in case of
// interpolation.
for part in node.parts().into_iter().rev() {
for part in node.normalized_parts().into_iter().rev() {
count += 1;
match part {
// Interpolated expressions are compiled as normal and
// dealt with by the VM before being assembled into
// the final string.
ast::StrPart::Interpolation(node) => self.compile(node.expr().unwrap())?,
ast::InterpolPart::Interpolation(node) => self.compile(node.expr().unwrap())?,
ast::StrPart::Literal(lit) => {
ast::InterpolPart::Literal(lit) => {
let idx = self.chunk.push_constant(Value::String(lit.into()));
self.chunk.push_op(OpCode::OpConstant(idx));
}
@ -832,8 +832,8 @@ impl Compiler {
/// Convert a non-dynamic string expression to a string if possible,
/// or raise an error.
fn expr_str_to_string(expr: ast::Str) -> EvalResult<String> {
if expr.parts().len() == 1 {
if let ast::StrPart::Literal(s) = expr.parts().pop().unwrap() {
if expr.normalized_parts().len() == 1 {
if let ast::InterpolPart::Literal(s) = expr.normalized_parts().pop().unwrap() {
return Ok(s);
}
}