forked from M-Labs/nac3
1
0
Fork 0

nac3standalone/demo: handle imports consistently

This commit is contained in:
Sebastien Bourdeauducq 2022-03-19 09:14:27 +08:00
parent 234823c51a
commit 3f890f183c
3 changed files with 3 additions and 5 deletions

View File

@ -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

View File

@ -1,5 +1,3 @@
from typing import TypeVar, Generic
@extern @extern
def output_int32(x: int32): def output_int32(x: int32):
... ...

View File

@ -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,