feat(tvix/eval): track source spans for or operator
				
					
				
			This one is tricky, specifically the span used for the final jump. I decided that it makes sense to use the attrpath node, as the final jump is the one that jumps *over* the default value, so the effect of this is more closely related to the selector than the default. It might be more correct to pass through the `or` token itself and point to this for the jumps, but it depends a bit on what shape of errors we could end up producing from this. Change-Id: I29fbc97ba6b9e14e1a0e5f3a7759ddc299dd9c0c Reviewed-on: https://cl.tvl.fyi/c/depot/+/6390 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
		
							parent
							
								
									2b1468dde3
								
							
						
					
					
						commit
						805c1870ee
					
				
					 1 changed files with 4 additions and 7 deletions
				
			
		|  | @ -584,15 +584,12 @@ impl Compiler<'_> { | |||
|         let mut jumps = vec![]; | ||||
| 
 | ||||
|         for fragment in path.attrs() { | ||||
|             self.compile_attr(slot, fragment); | ||||
|             self.push_op_old(OpCode::OpAttrsTrySelect); | ||||
|             jumps.push( | ||||
|                 self.chunk() | ||||
|                     .push_op_old(OpCode::OpJumpIfNotFound(JumpOffset(0))), | ||||
|             ); | ||||
|             self.compile_attr(slot, fragment.clone()); | ||||
|             self.push_op(OpCode::OpAttrsTrySelect, &fragment); | ||||
|             jumps.push(self.push_op(OpCode::OpJumpIfNotFound(JumpOffset(0)), &fragment)); | ||||
|         } | ||||
| 
 | ||||
|         let final_jump = self.push_op_old(OpCode::OpJump(JumpOffset(0))); | ||||
|         let final_jump = self.push_op(OpCode::OpJump(JumpOffset(0)), &path); | ||||
| 
 | ||||
|         for jump in jumps { | ||||
|             self.patch_jump(jump); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue