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 merge requests found
Pipeline #64444 failed with stages
in 6 minutes and 10 seconds
...@@ -10,9 +10,17 @@ from ...types import ( ...@@ -10,9 +10,17 @@ from ...types import (
PsIntegerType, PsIntegerType,
PsArrayType, PsArrayType,
PsSubscriptableType, PsSubscriptableType,
PsBoolType,
deconstify, deconstify,
) )
from ..ast.structural import PsAstNode, PsBlock, PsLoop, PsExpression, PsAssignment from ..ast.structural import (
PsAstNode,
PsBlock,
PsLoop,
PsConditional,
PsExpression,
PsAssignment,
)
from ..ast.expressions import ( from ..ast.expressions import (
PsSymbolExpr, PsSymbolExpr,
PsConstantExpr, PsConstantExpr,
...@@ -162,6 +170,15 @@ class Typifier: ...@@ -162,6 +170,15 @@ class Typifier:
assert tc.target_type is not None assert tc.target_type is not None
self.visit_expr(rhs, tc) 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): case PsLoop(ctr, start, stop, step, body):
if ctr.symbol.dtype is None: if ctr.symbol.dtype is None:
ctr.symbol.apply_dtype(self._ctx.index_dtype) ctr.symbol.apply_dtype(self._ctx.index_dtype)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment