Skip to content

Modernize switch statements to switch expressions #42

@craigsmitham

Description

@craigsmitham

Summary

Convert traditional switch statements to switch expressions (C# 8+) where each case returns or assigns a value, particularly in Printer.cs and similar AST-processing code.

Motivation

  • Switch expressions are more concise and enforce exhaustiveness
  • The Printer.cs switch on AST node types is a strong candidate — each case produces a value rather than performing complex side effects
  • Aligns with modern idiomatic C# patterns already used elsewhere in the codebase

Tasks

  • Audit switch statements in Printer.cs and other AST/visitor code
  • Convert eligible switch statements to switch expressions
  • Ensure exhaustiveness checks catch missing cases at compile time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions