Skip to content

Commit 33f10aa

Browse files
committed
refactor: Remove redundant condition definitions in SDLReader and JSXTypeScriptStates
This commit simplifies the condition handling in SDLReader and JSXTypeScriptStates by removing unnecessary instance-level definitions of condition categories. The base class now automatically builds these categories, enhancing code clarity and maintainability.
1 parent 9fddec0 commit 33f10aa

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

lizard_languages/tnsdl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def _IMP(self, token):
8989
_logical_operators = {'AND', 'OR'}
9090
_case_keywords = set()
9191
_ternary_operators = set()
92-
_conditions = _control_flow_keywords | _logical_operators # Keep for compatibility
92+
# Note: No need to define _conditions - base class builds it automatically
9393

9494
def _is_condition(self, token, last_token):
9595
if token == ':' and last_token == ')':

lizard_languages/tsx.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,8 @@ def __init__(self, context, inside_function=False):
4848
self.started_function = None
4949
self.pending_function_name = ''
5050
self._ts_declare = False
51-
# Separated condition categories (instance-level for TSX)
52-
self._control_flow_keywords = {'if', 'elseif', 'for', 'while', 'catch'}
53-
self._logical_operators = {'&&', '||'}
54-
self._case_keywords = {'case'}
55-
self._ternary_operators = {'?'}
56-
self._conditions = (self._control_flow_keywords | self._logical_operators |
57-
self._case_keywords | self._ternary_operators)
51+
# Note: Condition categories come from TypeScriptReader class level,
52+
# no need to define instance-level duplicates
5853
self.inside_function = inside_function # Track if we're already inside a function
5954

6055
def statemachine_before_return(self):

0 commit comments

Comments
 (0)