Skip to content
Snippets Groups Projects
Commit a3072d5f authored by Daniel Bauer's avatar Daniel Bauer :speech_balloon: Committed by Frederik Hennig
Browse files

Add comment support to UndefinedSymbolsCollector

parent 44615a77
1 merge request!367Improve comment support
......@@ -2,13 +2,14 @@ from typing import cast
from functools import reduce
from .structural import (
PsAstNode,
PsExpression,
PsStatement,
PsAssignment,
PsAstNode,
PsBlock,
PsComment,
PsDeclaration,
PsExpression,
PsLoop,
PsBlock,
PsStatement,
)
from .expressions import PsSymbolExpr, PsConstantExpr
......@@ -55,6 +56,9 @@ class UndefinedSymbolsCollector:
undefined_vars.discard(ctr.symbol)
return undefined_vars
case PsComment():
return set()
case unknown:
raise PsInternalCompilerError(
f"Don't know how to collect undefined variables from {unknown}"
......@@ -78,7 +82,14 @@ class UndefinedSymbolsCollector:
case PsDeclaration(lhs, _):
return {lhs.symbol}
case PsStatement() | PsAssignment() | PsExpression() | PsLoop() | PsBlock():
case (
PsAssignment()
| PsBlock()
| PsComment()
| PsExpression()
| PsLoop()
| PsStatement()
):
return set()
case unknown:
......
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