nodes: make some obvious dead-code raise a log message (Info)
This commit is contained in:
parent
7106e400aa
commit
46c7907165
1 changed files with 8 additions and 3 deletions
|
|
@ -5,7 +5,7 @@ from abc import abstractmethod, ABC
|
|||
from typing import Any, Iterable
|
||||
|
||||
from . import ir, semantic, lexer
|
||||
from .errors import SemanticAnalysisError, OverrideMandatoryError
|
||||
from .errors import SemanticAnalysisError, OverrideMandatoryError, CompilationWarning, Levels
|
||||
from .logger import Logger
|
||||
from .source import SourceLocation
|
||||
from .typechecking import typecheck
|
||||
|
|
@ -291,8 +291,13 @@ class Block(Statement):
|
|||
def intermediate_representation(self) -> list[ir.IRItem]:
|
||||
result: list[ir.IRItem] = []
|
||||
for node in self.nodes:
|
||||
if not node.pure:
|
||||
result += node.intermediate_representation()
|
||||
if node.pure:
|
||||
CompilationWarning(node.location(),
|
||||
f"{node.__class__.__name__} ignored as it doesn't have any "
|
||||
f"visible side effect.",
|
||||
level=Levels.Info).raise_warning()
|
||||
continue
|
||||
result += node.intermediate_representation()
|
||||
return result
|
||||
|
||||
def semantic_analysis(self, context: semantic.Context | None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue