MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_with_reserved_temp_register_index

Function test_with_reserved_temp_register_index

core/src/compiler/syms.rs:918–934  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

916
917 #[test]
918 fn test_with_reserved_temp_register_index() -> Result<()> {
919 let upcalls = HashMap::default();
920 let mut global = GlobalSymtable::new(upcalls);
921 let mut local = global.enter_scope();
922 local.put_local(SymbolKey::from("a"), SymbolPrototype::Scalar(ExprType::Integer))?;
923 local.put_local(SymbolKey::from("b"), SymbolPrototype::Scalar(ExprType::Integer))?;
924
925 local.with_reserved_temp(
926 |e| e,
927 |reg, _| {
928 assert_eq!(Register::local(2).unwrap(), reg);
929 Ok(())
930 },
931 )?;
932
933 Ok(())
934 }
935
936 #[test]
937 fn test_with_reserved_temp_shifts_temp_scope_base() -> Result<()> {

Callers

nothing calls this directly

Calls 3

enter_scopeMethod · 0.80
put_localMethod · 0.80
with_reserved_tempMethod · 0.80

Tested by

no test coverage detected