refactor(tvix/eval): remove OpResolveWithOrUpvalue
The case branch in vm.rs for OpResolveWithOrUpvalue is unreachable/deadcode. I believe this opcode is unnecessary, since it should always be statically detectable (at parse-time) whether a reference is to an upvalue (i.e. enclosing binding); otherwise, and only then, is with-resolution applicable. Perhaps I've misunderstood how with-resolution works. If so, please explain it to me and -1/-2 this CL. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I4a90b9eb6cb3396df92a6a943d42ecc301871ba0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7009 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
		
							parent
							
								
									cbbe283b6f
								
							
						
					
					
						commit
						91ad5b825b
					
				
					 2 changed files with 0 additions and 20 deletions
				
			
		| 
						 | 
				
			
			@ -100,7 +100,6 @@ pub enum OpCode {
 | 
			
		|||
    OpPushWith(StackIdx),
 | 
			
		||||
    OpPopWith,
 | 
			
		||||
    OpResolveWith,
 | 
			
		||||
    OpResolveWithOrUpvalue(UpvalueIdx),
 | 
			
		||||
 | 
			
		||||
    // Lists
 | 
			
		||||
    OpList(Count),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -597,25 +597,6 @@ impl<'o> VM<'o> {
 | 
			
		|||
                self.push(value)
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            OpCode::OpResolveWithOrUpvalue(idx) => {
 | 
			
		||||
                let ident = fallible!(self, self.pop().to_str());
 | 
			
		||||
                match self.resolve_with(ident.as_str()) {
 | 
			
		||||
                    // Variable found in local `with`-stack.
 | 
			
		||||
                    Ok(value) => self.push(value),
 | 
			
		||||
 | 
			
		||||
                    // Variable not found => check upvalues.
 | 
			
		||||
                    Err(Error {
 | 
			
		||||
                        kind: ErrorKind::UnknownDynamicVariable(_),
 | 
			
		||||
                        ..
 | 
			
		||||
                    }) => {
 | 
			
		||||
                        let value = self.frame().upvalue(idx).clone();
 | 
			
		||||
                        self.push(value);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    Err(err) => return Err(err),
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            OpCode::OpAssertFail => {
 | 
			
		||||
                return Err(self.error(ErrorKind::AssertionFailed));
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue