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

typification of PsConditional

parent e6f464aa
No related branches found
No related tags found
No related merge requests found
Pipeline #64444 failed
......@@ -10,9 +10,17 @@ from ...types import (
PsIntegerType,
PsArrayType,
PsSubscriptableType,
PsBoolType,
deconstify,
)
from ..ast.structural import PsAstNode, PsBlock, PsLoop, PsExpression, PsAssignment
from ..ast.structural import (
PsAstNode,
PsBlock,
PsLoop,
PsConditional,
PsExpression,
PsAssignment,
)
from ..ast.expressions import (
PsSymbolExpr,
PsConstantExpr,
......@@ -162,6 +170,15 @@ class Typifier:
assert tc.target_type is not None
self.visit_expr(rhs, tc)
case PsConditional(cond, branch_true, branch_false):
cond_tc = TypeContext(PsBoolType(const=True))
self.visit_expr(cond, cond_tc)
self.visit(branch_true)
if branch_false is not None:
self.visit(branch_false)
case PsLoop(ctr, start, stop, step, body):
if ctr.symbol.dtype is None:
ctr.symbol.apply_dtype(self._ctx.index_dtype)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment