Resolve import cycles.

This commit is contained in:
Jakob Stoklund Olesen
2016-11-08 09:04:40 -08:00
parent 01494b1a47
commit 1e1830aaa6
2 changed files with 7 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ This module defines classes that can be used to create abstract syntax trees
for patern matching an rewriting of cretonne instructions. for patern matching an rewriting of cretonne instructions.
""" """
from __future__ import absolute_import from __future__ import absolute_import
from . import Instruction, BoundInstruction import cretonne
try: try:
from typing import Union, Tuple # noqa from typing import Union, Tuple # noqa
@@ -174,12 +174,12 @@ class Apply(Expr):
""" """
def __init__(self, inst, args): def __init__(self, inst, args):
# type: (Union[Instruction, BoundInstruction], Tuple[Expr, ...]) -> None # noqa # type: (Union[cretonne.Instruction, cretonne.BoundInstruction], Tuple[Expr, ...]) -> None # noqa
if isinstance(inst, BoundInstruction): if isinstance(inst, cretonne.BoundInstruction):
self.inst = inst.inst self.inst = inst.inst
self.typevars = inst.typevars self.typevars = inst.typevars
else: else:
assert isinstance(inst, Instruction) assert isinstance(inst, cretonne.Instruction)
self.inst = inst self.inst = inst
self.typevars = () self.typevars = ()
self.args = args self.args = args

View File

@@ -6,7 +6,7 @@ polymorphic by using type variables.
""" """
from __future__ import absolute_import from __future__ import absolute_import
import math import math
from . import OperandKind, value # noqa import cretonne
try: try:
from typing import Tuple, Union # noqa from typing import Tuple, Union # noqa
@@ -315,11 +315,11 @@ class TypeVar(object):
return TypeVar(None, None, base=self, derived_func='DoubleWidth') return TypeVar(None, None, base=self, derived_func='DoubleWidth')
def operand_kind(self): def operand_kind(self):
# type: () -> OperandKind # type: () -> cretonne.OperandKind
# When a `TypeVar` object is used to describe the type of an `Operand` # When a `TypeVar` object is used to describe the type of an `Operand`
# in an instruction definition, the kind of that operand is an SSA # in an instruction definition, the kind of that operand is an SSA
# value. # value.
return value # type: ignore return cretonne.value # type: ignore
def free_typevar(self): def free_typevar(self):
# type: () -> TypeVar # type: () -> TypeVar