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

Function test_local_falls_through_to_global

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

Source from the content-addressed store, hash-verified

666
667 #[test]
668 fn test_local_falls_through_to_global() -> Result<()> {
669 let upcalls = HashMap::default();
670 let mut global = GlobalSymtable::new(upcalls);
671 global.put_global(SymbolKey::from("g"), SymbolPrototype::Scalar(ExprType::Integer))?;
672
673 let local = global.enter_scope();
674 let (reg, proto) = local.get_local_or_global(&VarRef::new("g", None))?;
675 assert_eq!(Register::global(0).unwrap(), reg);
676 assert_eq!(SymbolPrototype::Scalar(ExprType::Integer), proto);
677
678 Ok(())
679 }
680
681 #[test]
682 fn test_local_get_undefined() {

Callers

nothing calls this directly

Calls 3

put_globalMethod · 0.80
enter_scopeMethod · 0.80
get_local_or_globalMethod · 0.80

Tested by

no test coverage detected