Skip to content

Commit

Permalink
enhances tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
christophkloeffel committed Oct 23, 2023
1 parent 1789951 commit 9c3ee76
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions trlc/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ def to_string(self): # pragma: no cover
self.__class__.__name__

def ensure_type(self, mh, typ):
# lobster-trace: LRM.Conditional_Expression_Types
assert isinstance(typ, (type, Type))
if self.typ is None:
mh.error(self.location,
Expand Down Expand Up @@ -1815,6 +1814,7 @@ class Action(Node):
"""
def __init__(self, mh, t_kind, n_condition, n_expression):
# lobster-trace: LRM.Conditional_Expression
assert isinstance(mh, Message_Handler)
assert isinstance(t_kind, Token)
assert t_kind.kind == "KEYWORD"
Expand Down Expand Up @@ -1867,14 +1867,16 @@ class Conditional_Expression(Expression):
"""
def __init__(self, location, if_action):
# lobster-exclude: Constructor only declares variables
# lobster-trace: LRM.Conditional_Expression
assert isinstance(if_action, Action)
assert if_action.kind == "if"
super().__init__(location, if_action.n_expr.typ)
self.actions = [if_action]
self.else_expr = None

def add_elsif(self, mh, n_action):
# lobster-trace: LRM.Conditional_Expression
# lobster-trace; LRM.Conditional_Expression_Types
assert isinstance(mh, Message_Handler)
assert isinstance(n_action, Action)
assert n_action.kind == "elsif"
Expand All @@ -1883,7 +1885,8 @@ def add_elsif(self, mh, n_action):
self.actions.append(n_action)

def set_else_part(self, mh, n_expr):
# lobster-trace: LRM.Conditional_Expression_Else
# lobster-trace: LRM.Conditional_Expression
# lobster-trace; LRM.Conditional_Expression_Types
assert isinstance(mh, Message_Handler)
assert isinstance(n_expr, Expression)

Expand All @@ -1906,6 +1909,7 @@ def to_string(self):
return rv

def evaluate(self, mh, context):
# lobster-trace: LRM.Conditional_Expression_Else
# lobster-trace: LRM.Conditional_Expression_Evaluation
assert isinstance(mh, Message_Handler)
assert context is None or isinstance(context, dict)
Expand Down

0 comments on commit 9c3ee76

Please sign in to comment.