about summary refs log tree commit diff
path: root/tvix/eval/src/opcode.rs
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-09-15T14·38+0200
committersterni <sternenseemann@systemli.org>2022-09-15T15·52+0000
commit4eb33e82ff418de0ad811a0d3afffac84831fac4 (patch)
tree8007303407c8ea8fd35d251e75001ced0a0ac2c2 /tvix/eval/src/opcode.rs
parentbcd7e520f076fb7a6b26805663fac2d70c677bc8 (diff)
fix(tvix/eval): coerce string interpolation parts to string r/4860
With this puzzle piece of string compilation in place, `compile_str`
becomes less redundant, as every part now needs to be compiled the same.
The thunking logic becomes a bit trickier, since we need to thunk even
in the case of `count == 1` if the single part is interpolating.
Splitting the inner (shared) code in a separate function turned out to
be easier for making rustc content.

Change-Id: I6a554ca599926ae5907d7acffce349c9616f568f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6582
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/opcode.rs')
-rw-r--r--tvix/eval/src/opcode.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/tvix/eval/src/opcode.rs b/tvix/eval/src/opcode.rs
index aee45d7a4452..706aceac8357 100644
--- a/tvix/eval/src/opcode.rs
+++ b/tvix/eval/src/opcode.rs
@@ -105,6 +105,9 @@ pub enum OpCode {
 
     // Strings
     OpInterpolate(Count),
+    /// Force the Value on the stack and coerce it to a string, always using
+    /// `CoercionKind::Weak`.
+    OpCoerceToString,
 
     // Type assertion operators
     OpAssertBool,