TypeVar and virtual support in Symbol Resolver #99

Merged
sb10q merged 12 commits from symbol_resolver_typevar into master 2021-12-01 22:44:53 +08:00
1 changed files with 11 additions and 5 deletions
Showing only changes of commit 9406a645c7 - Show all commits

View File

@ -274,11 +274,17 @@ impl Nac3 {
let typing_mod = PyModule::import(py, "typing").unwrap(); let typing_mod = PyModule::import(py, "typing").unwrap();
let types_mod = PyModule::import(py, "types").unwrap(); let types_mod = PyModule::import(py, "types").unwrap();
let primitive_ids = PrimitivePythonId { let primitive_ids = PrimitivePythonId {
virtual_id: py.eval( virtual_id: id_fn
"id(virtual)", .call1((builtins_mod
Some(builtins_mod.getattr("globals").unwrap().call0().unwrap().extract().unwrap()), .getattr("globals")
None .unwrap()
).unwrap().extract().unwrap(), .call0()
.unwrap()
.get_item("virtual")
.unwrap(),
)).unwrap()
.extract()
.unwrap(),
generic_alias: ( generic_alias: (
id_fn id_fn
.call1((typing_mod.getattr("_GenericAlias").unwrap(),)) .call1((typing_mod.getattr("_GenericAlias").unwrap(),))