forked from M-Labs/artiq
Replace builtin ast with pythonparser.ast.
This commit is contained in:
parent
f30d671359
commit
c75fd6bc88
|
@ -1,4 +1,4 @@
|
|||
import ast
|
||||
from pythonparser import ast
|
||||
|
||||
import llvmlite.ir as ll
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import inspect
|
||||
import ast
|
||||
from pythonparser import parse, ast
|
||||
|
||||
import llvmlite.ir as ll
|
||||
|
||||
|
@ -18,7 +18,7 @@ def _gcd(a, b):
|
|||
|
||||
|
||||
def init_module(module):
|
||||
func_def = ast.parse(inspect.getsource(_gcd)).body[0]
|
||||
func_def = parse(inspect.getsource(_gcd)).body[0]
|
||||
function, _ = module.compile_function(func_def,
|
||||
{"a": VInt(64), "b": VInt(64)})
|
||||
function.linkage = "internal"
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import ast
|
||||
import pythonparser.algorithm
|
||||
from pythonparser import ast
|
||||
from copy import deepcopy
|
||||
|
||||
from artiq.py2llvm.ast_body import Visitor
|
||||
from artiq.py2llvm import base_types
|
||||
|
||||
|
||||
class _TypeScanner(ast.NodeVisitor):
|
||||
class _TypeScanner(pythonparser.algorithm.Visitor):
|
||||
def __init__(self, env, ns):
|
||||
self.exprv = Visitor(env, ns)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import unittest
|
||||
import ast
|
||||
from pythonparser import parse, ast
|
||||
import inspect
|
||||
from fractions import Fraction
|
||||
from ctypes import CFUNCTYPE, c_int, c_int32, c_int64, c_double
|
||||
|
@ -43,7 +43,7 @@ def _base_types(choice):
|
|||
|
||||
def _build_function_types(f):
|
||||
return infer_function_types(
|
||||
None, ast.parse(inspect.getsource(f)),
|
||||
None, parse(inspect.getsource(f)),
|
||||
dict())
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ class CompiledFunction:
|
|||
def __init__(self, function, param_types):
|
||||
module = Module()
|
||||
|
||||
func_def = ast.parse(inspect.getsource(function)).body[0]
|
||||
func_def = parse(inspect.getsource(function)).body[0]
|
||||
function, retval = module.compile_function(func_def, param_types)
|
||||
argvals = [param_types[arg.arg] for arg in func_def.args.args]
|
||||
|
||||
|
|
Loading…
Reference in New Issue