mirror of https://github.com/m-labs/artiq.git
Move transforms.MonomorphismChecker to validators.MonomorphismValidator.
This commit is contained in:
parent
02b41ea0f7
commit
7c833f0727
|
@ -4,7 +4,7 @@ The :class:`Module` class encapsulates a single Python
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from pythonparser import source, diagnostic, parse_buffer
|
from pythonparser import source, diagnostic, parse_buffer
|
||||||
from . import prelude, types, transforms
|
from . import prelude, types, transforms, validators
|
||||||
|
|
||||||
class Module:
|
class Module:
|
||||||
def __init__(self, source_buffer, engine=None):
|
def __init__(self, source_buffer, engine=None):
|
||||||
|
@ -14,14 +14,14 @@ class Module:
|
||||||
asttyped_rewriter = transforms.ASTTypedRewriter(engine=engine)
|
asttyped_rewriter = transforms.ASTTypedRewriter(engine=engine)
|
||||||
inferencer = transforms.Inferencer(engine=engine)
|
inferencer = transforms.Inferencer(engine=engine)
|
||||||
int_monomorphizer = transforms.IntMonomorphizer(engine=engine)
|
int_monomorphizer = transforms.IntMonomorphizer(engine=engine)
|
||||||
monomorphism_checker = transforms.MonomorphismChecker(engine=engine)
|
monomorphism_validator = validators.MonomorphismValidator(engine=engine)
|
||||||
|
|
||||||
parsetree, comments = parse_buffer(source_buffer, engine=engine)
|
parsetree, comments = parse_buffer(source_buffer, engine=engine)
|
||||||
typedtree = asttyped_rewriter.visit(parsetree)
|
typedtree = asttyped_rewriter.visit(parsetree)
|
||||||
inferencer.visit(typedtree)
|
inferencer.visit(typedtree)
|
||||||
int_monomorphizer.visit(typedtree)
|
int_monomorphizer.visit(typedtree)
|
||||||
inferencer.visit(typedtree)
|
inferencer.visit(typedtree)
|
||||||
monomorphism_checker.visit(typedtree)
|
monomorphism_validator.visit(typedtree)
|
||||||
|
|
||||||
self.name = os.path.basename(source_buffer.name)
|
self.name = os.path.basename(source_buffer.name)
|
||||||
self.globals = asttyped_rewriter.globals
|
self.globals = asttyped_rewriter.globals
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from .asttyped_rewriter import ASTTypedRewriter
|
from .asttyped_rewriter import ASTTypedRewriter
|
||||||
from .inferencer import Inferencer
|
from .inferencer import Inferencer
|
||||||
from .int_monomorphizer import IntMonomorphizer
|
from .int_monomorphizer import IntMonomorphizer
|
||||||
from .monomorphism_checker import MonomorphismChecker
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
from .monomorphism import MonomorphismValidator
|
|
@ -1,12 +1,12 @@
|
||||||
"""
|
"""
|
||||||
:class:`MonomorphismChecker` verifies that all type variables have been
|
:class:`MonomorphismValidator` verifies that all type variables have been
|
||||||
elided, which is necessary for code generation.
|
elided, which is necessary for code generation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pythonparser import algorithm, diagnostic
|
from pythonparser import algorithm, diagnostic
|
||||||
from .. import asttyped, types, builtins
|
from .. import asttyped, types, builtins
|
||||||
|
|
||||||
class MonomorphismChecker(algorithm.Visitor):
|
class MonomorphismValidator(algorithm.Visitor):
|
||||||
def __init__(self, engine):
|
def __init__(self, engine):
|
||||||
self.engine = engine
|
self.engine = engine
|
||||||
|
|
Loading…
Reference in New Issue