Skip to content
Snippets Groups Projects
Commit 80f82607 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

minor fixes and doc additions

parent 24a83b5c
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,10 @@ NodeT = TypeVar("NodeT", bound=PsAstNode) ...@@ -23,6 +23,10 @@ NodeT = TypeVar("NodeT", bound=PsAstNode)
class UndeterminedType(PsNumericType): class UndeterminedType(PsNumericType):
"""Placeholder for types that could not yet be determined by the typifier.
Instances of this class should never leave the typifier; it is an error if they do.
"""
def create_constant(self, value: Any) -> Any: def create_constant(self, value: Any) -> Any:
return None return None
...@@ -82,6 +86,7 @@ class TypeContext: ...@@ -82,6 +86,7 @@ class TypeContext:
self._target_type = deconstify(target_type) self._target_type = deconstify(target_type)
for dc in self._deferred_constants: for dc in self._deferred_constants:
dc.resolve(self._target_type) dc.resolve(self._target_type)
self._deferred_constants = []
@property @property
def target_type(self) -> PsNumericType | None: def target_type(self) -> PsNumericType | None:
...@@ -204,12 +209,16 @@ class Typifier(Mapper): ...@@ -204,12 +209,16 @@ class Typifier(Mapper):
def map_product(self, expr: pb.Product, tc: TypeContext) -> pb.Product: def map_product(self, expr: pb.Product, tc: TypeContext) -> pb.Product:
return pb.Product(tuple(self.rec(c, tc) for c in expr.children)) return pb.Product(tuple(self.rec(c, tc) for c in expr.children))
# Functions
def map_call(self, expr: pb.Call, tc: TypeContext) -> pb.Call: def map_call(self, expr: pb.Call, tc: TypeContext) -> pb.Call:
""" """
TODO: Figure out how to describe function signatures TODO: Figure out how to describe function signatures
""" """
raise NotImplementedError() raise NotImplementedError()
# Internals
def _apply_target_type( def _apply_target_type(
self, expr: ExprOrConstant, expr_type: PsAbstractType, tc: TypeContext self, expr: ExprOrConstant, expr_type: PsAbstractType, tc: TypeContext
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment