Fix incorrect stack popping order in set_dynamic opcode
This commit is contained in:
		
							parent
							
								
									9435348877
								
							
						
					
					
						commit
						4ee0bcab67
					
				| @ -378,6 +378,10 @@ fn execute(self: *Self, env: *kym.RuntimeEnv) kym.RuntimeError!?*kym.RuntimeRef | ||||
| 			}, | ||||
| 
 | ||||
| 			.set_dynamic => { | ||||
| 				const value_ref = try env.pop_local(); | ||||
| 
 | ||||
| 				defer env.discard(value_ref); | ||||
| 
 | ||||
| 				const index_ref = try env.pop_local() orelse { | ||||
| 					return env.raise(error.TypeMismatch, "nil is not a valid index"); | ||||
| 				}; | ||||
| @ -390,10 +394,6 @@ fn execute(self: *Self, env: *kym.RuntimeEnv) kym.RuntimeError!?*kym.RuntimeRef | ||||
| 
 | ||||
| 				defer env.discard(indexable_ref); | ||||
| 
 | ||||
| 				const value_ref = try env.pop_local(); | ||||
| 
 | ||||
| 				defer env.discard(value_ref); | ||||
| 
 | ||||
| 				try env.set_dynamic(try kym.unbox_dynamic(env, indexable_ref), index_ref, value_ref); | ||||
| 			}, | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user