forked from M-Labs/nac3
nac3standalone/demo: handle imports consistently
This commit is contained in:
parent
234823c51a
commit
3f890f183c
|
@ -6,6 +6,7 @@ import importlib.machinery
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
from numpy import int32, int64, uint32, uint64
|
from numpy import int32, int64, uint32, uint64
|
||||||
|
from typing import TypeVar, Generic
|
||||||
|
|
||||||
|
|
||||||
def patch(module):
|
def patch(module):
|
||||||
|
@ -35,6 +36,8 @@ def patch(module):
|
||||||
module.int64 = int64
|
module.int64 = int64
|
||||||
module.uint32 = uint32
|
module.uint32 = uint32
|
||||||
module.uint64 = uint64
|
module.uint64 = uint64
|
||||||
|
module.TypeVar = TypeVar
|
||||||
|
module.Generic = Generic
|
||||||
module.extern = extern
|
module.extern = extern
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from typing import TypeVar, Generic
|
|
||||||
|
|
||||||
@extern
|
@extern
|
||||||
def output_int32(x: int32):
|
def output_int32(x: int32):
|
||||||
...
|
...
|
||||||
|
|
|
@ -62,9 +62,6 @@ fn main() {
|
||||||
let parser_result = parser::parse_program(&program, file_name.into()).unwrap();
|
let parser_result = parser::parse_program(&program, file_name.into()).unwrap();
|
||||||
|
|
||||||
for stmt in parser_result.into_iter() {
|
for stmt in parser_result.into_iter() {
|
||||||
if matches!(stmt.node, StmtKind::Import { .. } | StmtKind::ImportFrom { .. }) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if let StmtKind::Assign { targets, value, .. } = &stmt.node {
|
if let StmtKind::Assign { targets, value, .. } = &stmt.node {
|
||||||
fn handle_typevar_definition(
|
fn handle_typevar_definition(
|
||||||
var: &Expr,
|
var: &Expr,
|
||||||
|
|
Loading…
Reference in New Issue