Skip to content

Commit

Permalink
[rtlir] Add visit_Constant to behavioral visitor
Browse files Browse the repository at this point in the history
  • Loading branch information
ptpan committed Dec 7, 2023
1 parent c8e2ab5 commit aa19bfb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pymtl3/passes/rtlir/behavioral/BehavioralRTLIRGenL1Pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,14 @@ def visit_Num( s, node ):
ret.ast = node
return ret

def visit_Constant( s, node ):
val = node.value
if isinstance( val, int ):
ret = bir.Number( val )
ret.ast = node
return ret
raise PyMTLSyntaxError( s.blk, node, 'invalid constant: not an integer!' )

def visit_If( s, node ): raise NotImplementedError()

def visit_For( s, node ): raise NotImplementedError()
Expand Down Expand Up @@ -646,3 +654,6 @@ def visit_Name( s, node ):

def visit_Num( s, node ):
return node.n

def visit_Constant( s, node ):
return node.value

0 comments on commit aa19bfb

Please sign in to comment.