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

Function test_local_put_global_through_local

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

Source from the content-addressed store, hash-verified

690
691 #[test]
692 fn test_local_put_global_through_local() -> Result<()> {
693 let upcalls = HashMap::default();
694 let mut global = GlobalSymtable::new(upcalls);
695 let mut local = global.enter_scope();
696
697 let reg =
698 local.put_global(SymbolKey::from("g"), SymbolPrototype::Scalar(ExprType::Integer))?;
699 assert_eq!(Register::global(0).unwrap(), reg);
700
701 // Should be visible from the local scope via fallthrough.
702 let (reg, proto) = local.get_local_or_global(&VarRef::new("g", None))?;
703 assert_eq!(Register::global(0).unwrap(), reg);
704 assert_eq!(SymbolPrototype::Scalar(ExprType::Integer), proto);
705
706 Ok(())
707 }
708
709 #[test]
710 fn test_fixup_local_type() -> Result<()> {

Callers

nothing calls this directly

Calls 3

enter_scopeMethod · 0.80
put_globalMethod · 0.80
get_local_or_globalMethod · 0.80

Tested by

no test coverage detected