| @staticmethod | @staticmethod | ||||
| def _get_segment_for_constant(var_type: SegmentType, original_value: Any) -> Segment: | def _get_segment_for_constant(var_type: SegmentType, original_value: Any) -> Segment: | ||||
| """Get the appropriate segment type for a constant value.""" | """Get the appropriate segment type for a constant value.""" | ||||
| if not var_type.is_array_type() or var_type == SegmentType.BOOLEAN: | |||||
| # TODO: Refactor for maintainability: | |||||
| # 1. Ensure type handling logic stays synchronized with _VALID_VAR_TYPE (entities.py) | |||||
| # 2. Consider moving this method to LoopVariableData class for better encapsulation | |||||
| if not var_type.is_array_type() or var_type == SegmentType.ARRAY_BOOLEAN: | |||||
| value = original_value | value = original_value | ||||
| elif var_type in [ | elif var_type in [ | ||||
| SegmentType.ARRAY_NUMBER, | SegmentType.ARRAY_NUMBER, |