Skip to content
Snippets Groups Projects

Add support for PsConditional to UndefinedSymbolsCollector and PsStatement to CanonicalClone

2 files
+ 12
0
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -6,6 +6,7 @@ from .structural import (
@@ -6,6 +6,7 @@ from .structural import (
PsAstNode,
PsAstNode,
PsBlock,
PsBlock,
PsComment,
PsComment,
 
PsConditional,
PsDeclaration,
PsDeclaration,
PsExpression,
PsExpression,
PsLoop,
PsLoop,
@@ -56,6 +57,12 @@ class UndefinedSymbolsCollector:
@@ -56,6 +57,12 @@ class UndefinedSymbolsCollector:
undefined_vars.discard(ctr.symbol)
undefined_vars.discard(ctr.symbol)
return undefined_vars
return undefined_vars
 
case PsConditional(cond, branch_true, branch_false):
 
undefined_vars = self(cond) | self(branch_true)
 
if branch_false is not None:
 
undefined_vars |= self(branch_false)
 
return undefined_vars
 
case PsComment():
case PsComment():
return set()
return set()
@@ -86,6 +93,7 @@ class UndefinedSymbolsCollector:
@@ -86,6 +93,7 @@ class UndefinedSymbolsCollector:
PsAssignment()
PsAssignment()
| PsBlock()
| PsBlock()
| PsComment()
| PsComment()
 
| PsConditional()
| PsExpression()
| PsExpression()
| PsLoop()
| PsLoop()
| PsStatement()
| PsStatement()
Loading