================================================================================
Codeunit with conditional var section using CLEAN directive
================================================================================

codeunit 6466 "Serv. Page Management"
{
#if not CLEAN25
    var
        PageManagement: Codeunit "Page Management";
        TestVar: Boolean;
#endif

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Page Management", 'OnConditionalCardPageIDNotFound', '', false, false)]
    local procedure OnConditionalCardPageIDNotFound(RecordRef: RecordRef; var CardPageID: Integer);
    begin
    end;
}

--------------------------------------------------------------------------------

(source_file
  (codeunit_declaration
    (codeunit_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (preproc_conditional
      (preproc_if
        condition: (preproc_not_expression
          (identifier)))
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (object_reference_type
              object_type: (codeunit_keyword)
              reference: (quoted_identifier))))
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (basic_type))))
      (preproc_endif))
    (attribute_item
      attribute: (attribute_content
        name: (identifier)
        arguments: (attribute_arguments
          (attribute_argument_list
            (qualified_enum_value
              enum_type: (identifier)
              value: (identifier))
            (database_reference
              keyword: (object_type_keyword)
              table_name: (quoted_identifier))
            (string_literal)
            (string_literal)
            (boolean)
            (boolean)))))
    (procedure
      modifier: (procedure_modifier
        (local_keyword))
      (procedure_keyword)
      name: (identifier)
      (parameter_list
        (parameter
          name: (identifier)
          type: (type_specification
            (basic_type)))
        (parameter
          modifier: (var_keyword)
          name: (identifier)
          type: (type_specification
            (basic_type))))
      (code_block))))

================================================================================
Page with conditional var section with else clause
================================================================================

page 123 "Test Page"
{
#if DEBUG
    var
        DebugManager: Codeunit "Debug Management";
#else
    var
        ProductionManager: Codeunit "Production Management";
#endif

    layout
    {
        area(content)
        {
            field("Test"; TestField)
            {
            }
        }
    }
}

--------------------------------------------------------------------------------

(source_file
  (page_declaration
    (page_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (preproc_conditional
      (preproc_if
        condition: (identifier))
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (object_reference_type
              object_type: (codeunit_keyword)
              reference: (quoted_identifier)))))
      (preproc_else)
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (object_reference_type
              object_type: (codeunit_keyword)
              reference: (quoted_identifier)))))
      (preproc_endif))
    (layout_section
      (layout_keyword)
      (area_section
        (area_keyword)
        (page_field
          name: (quoted_identifier)
          source: (identifier))))))

================================================================================
Table with conditional var section
================================================================================

table 50001 "Test Table"
{
    DataClassification = ToBeClassified;

#if not CLEAN24
    var
        OldFeatureManager: Codeunit "Old Feature Manager";
#endif

    fields
    {
        field(1; "Primary Key"; Code[20])
        {
        }
    }
}

--------------------------------------------------------------------------------

(source_file
  (table_declaration
    (table_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (property
      name: (property_name)
      value: (identifier))
    (preproc_conditional
      (preproc_if
        condition: (preproc_not_expression
          (identifier)))
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (object_reference_type
              object_type: (codeunit_keyword)
              reference: (quoted_identifier)))))
      (preproc_endif))
    (fields_section
      (fields_keyword)
      (field_declaration
        id: (integer)
        name: (quoted_identifier)
        type: (type_specification
          (code_type
            length: (integer)))))))

================================================================================
Report with conditional var section
================================================================================

report 50001 "Test Report"
{
    ApplicationArea = All;
    UsageCategory = Tasks;

#if not CLEAN23
    var
        ReportHelper: Codeunit "Report Helper";
#endif

    dataset
    {
        dataitem(Customer; Customer)
        {
            column(No; "No.")
            {
            }
        }
    }
}

--------------------------------------------------------------------------------

(source_file
  (report_declaration
    (report_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (property
      name: (property_name)
      value: (identifier))
    (property
      name: (property_name)
      value: (identifier))
    (preproc_conditional
      (preproc_if
        condition: (preproc_not_expression
          (identifier)))
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (object_reference_type
              object_type: (codeunit_keyword)
              reference: (quoted_identifier)))))
      (preproc_endif))
    (dataset_section
      (dataset_keyword)
      (report_dataitem
        (dataitem_keyword)
        name: (identifier)
        table_name: (identifier)
        (report_column
          (column_keyword)
          name: (identifier)
          source: (quoted_identifier))))))

================================================================================
XMLPort with conditional var section
================================================================================

xmlport 50001 "Test XMLPort"
{
    Direction = Import;

#if TESTMODE
    var
        TestHelper: Codeunit "Test Helper";
#endif

    schema
    {
        textelement(Root)
        {
        }
    }
}

--------------------------------------------------------------------------------

(source_file
  (xmlport_declaration
    (xmlport_keyword)
    object_id: (integer)
    object_name: (quoted_identifier)
    (property
      name: (property_name)
      value: (identifier))
    (preproc_conditional
      (preproc_if
        condition: (identifier))
      (var_section
        (var_keyword)
        (variable_declaration
          name: (identifier)
          type: (type_specification
            (object_reference_type
              object_type: (codeunit_keyword)
              reference: (quoted_identifier)))))
      (preproc_endif))
    (schema_section
      (schema_keyword)
      (xmlport_element
        name: (identifier)))))
