===================================================
Weird file
===================================================

d

---------------
(ERROR (ERROR (identifier)))

=====================================
more tests
======================================
typedef RpcPeerConnectionFunction = Future<vms.VmService> Function(
  Uri uri, {
  required Duration timeout,
});

---

(program 
    (type_alias
         (type_identifier) 
            (function_type (type_identifier) 
                (type_arguments (type_identifier) (type_identifier)) 
                    (parameter_type_list 
                        (normal_parameter_type 
                            (typed_identifier 
                                (type_identifier) (identifier)
                                )
                            ) 
                        (optional_parameter_types 
                            (named_parameter_types 
                                (typed_identifier (type_identifier) (identifier)))))))) 

=======================================
more tests2
=======================================

bool? _boolAttribute(
    String resourceId,
    String name,
    Map<String, Object?> attributes,
    String attributeName,
    ) {
  final Object? value = attributes[attributeName];
  if (value == null) {
    return null;
  }
  if (value != 'true' && value != 'false') {
    throw L10nException(
      'The "$attributeName" value of the "$name" placeholder in message $resourceId '
          'must be a boolean value.',
    );
  }
  return value == 'true';
}

---

(program (function_signature (type_identifier) (nullable_type) (identifier) 
  (formal_parameter_list 
    (formal_parameter 
      (type_identifier) (identifier)) (formal_parameter (type_identifier) (identifier)) 
    (formal_parameter 
      (type_identifier) (type_arguments (type_identifier) (type_identifier) (nullable_type))
      (identifier)) 
    (formal_parameter (type_identifier) (identifier)))
    ) 
      (function_body (block (local_variable_declaration 
      (initialized_variable_definition (final_builtin) (type_identifier) (nullable_type) (identifier)
        (identifier) (selector (unconditional_assignable_selector (index_selector (identifier)))))) 
        (if_statement (equality_expression (identifier) (equality_operator) 
        (null_literal)) (block (return_statement (null_literal)))) 
        (if_statement (logical_and_expression 
        (equality_expression (identifier) (equality_operator) (string_literal))
        (logical_and_operator)
        (equality_expression (identifier) (equality_operator) (string_literal))) 
        (block (expression_statement (throw_expression (identifier) 
        (selector (argument_part (arguments (argument (string_literal 
        (template_substitution (identifier_dollar_escaped)) 
        (template_substitution (identifier_dollar_escaped)) 
        (template_substitution (identifier_dollar_escaped))))))))))) 
        (return_statement (equality_expression (identifier) (equality_operator) (string_literal))))))

===========================================
more tests 2
===========================================

/// A doctor validator for both Intellij and Android Studio.
abstract class IntelliJValidator extends DoctorValidator {
  IntelliJValidator(super.title, this.installPath, {
    required FileSystem fileSystem,
    required UserMessages userMessages,
  }) : _fileSystem = fileSystem,
       _userMessages = userMessages;

  final String installPath;
  final FileSystem _fileSystem;
  final UserMessages _userMessages;

  String get version;

  String? get pluginsPath;

  static const Map<String, String> _idToTitle = <String, String>{
    _ultimateEditionId: _ultimateEditionTitle,
    _communityEditionId: _communityEditionTitle,
  };
}

---

(program 
  (documentation_comment) 
  (class_definition (abstract) (identifier) (superclass (type_identifier)) 
    (class_body (declaration (constructor_signature (identifier) 
      (formal_parameter_list 
        (formal_parameter (super_formal_parameter (super) (identifier))) 
        (formal_parameter (constructor_param (this) (identifier))) 
        (optional_formal_parameters (formal_parameter (type_identifier) (identifier))
        (formal_parameter (type_identifier) (identifier)))))
        (initializers (initializer_list_entry (field_initializer (identifier) (identifier))) 
        (initializer_list_entry (field_initializer (identifier) (identifier)))))
         (declaration (final_builtin) (type_identifier) (initialized_identifier_list 
         (initialized_identifier (identifier)))) (declaration (final_builtin) (type_identifier) 
         (initialized_identifier_list (initialized_identifier (identifier)))) 
         (declaration (final_builtin) (type_identifier) 
         (initialized_identifier_list (initialized_identifier (identifier)))) 
         (declaration (getter_signature (type_identifier) (identifier))) 
         (declaration (getter_signature (type_identifier) (nullable_type) (identifier))) 
         (declaration (const_builtin) (type_identifier) (type_arguments (type_identifier) 
         (type_identifier)) (static_final_declaration_list (static_final_declaration (identifier) 
         (set_or_map_literal (type_arguments (type_identifier) (type_identifier)) 
         (pair (identifier) (identifier)) (pair (identifier) (identifier)))))))))

==============================================
more tests 3
==============================================

class _RecompileRequest extends _CompilationRequest {
  _RecompileRequest(
    super.completer,
    this.mainUri,
    this.invalidatedFiles,
    this.outputPath,
    this.packageConfig,
    this.suppressErrors,
    {this.additionalSource}
  );

  Uri mainUri;
  List<Uri>? invalidatedFiles;
  String outputPath;
  PackageConfig packageConfig;
  bool suppressErrors;
  final String? additionalSource;

  @override
  Future<CompilerOutput?> _run(DefaultResidentCompiler compiler) async =>
      compiler._recompile(this);
}

---

(program 
  (class_definition (identifier) 
    (superclass (type_identifier)) 
      (class_body (declaration 
        (constructor_signature (identifier) 
        (formal_parameter_list 
          (formal_parameter (super_formal_parameter (super) (identifier))) 
          (formal_parameter (constructor_param (this) (identifier))) 
          (formal_parameter (constructor_param (this) (identifier)))
          (formal_parameter (constructor_param (this) (identifier))) 
          (formal_parameter (constructor_param (this) (identifier))) 
          (formal_parameter (constructor_param (this) (identifier)))
          (optional_formal_parameters 
            (formal_parameter (constructor_param (this) (identifier))))))) 
        (declaration (type_identifier) 
          (initialized_identifier_list (initialized_identifier (identifier)))) 
        (declaration (type_identifier) (type_arguments (type_identifier)) (nullable_type)
        (initialized_identifier_list (initialized_identifier (identifier)))) 
        (declaration (type_identifier) (initialized_identifier_list
         (initialized_identifier (identifier)))) (declaration (type_identifier) 
         (initialized_identifier_list (initialized_identifier (identifier)))) 
         (declaration (type_identifier) (initialized_identifier_list 
         (initialized_identifier (identifier)))) 
         (declaration (final_builtin) (type_identifier) (nullable_type)
          (initialized_identifier_list (initialized_identifier (identifier)))) 
          (marker_annotation (identifier)) (method_signature 
          (function_signature (type_identifier) (type_arguments (type_identifier) (nullable_type)) 
          (identifier) (formal_parameter_list (formal_parameter (type_identifier) 
          (identifier))))) (function_body (identifier) (selector 
          (unconditional_assignable_selector (identifier))) 
          (selector (argument_part (arguments (argument (this)))))))))


===============================
more tests 4
===============================

bool debugAssertIsValid() {
  assert(
    textColor != null
      && style != null
      && margin != null
      && _position != null
      && _position.isFinite
      && _opacity != null
      && _opacity >= 0.0
      && _opacity <= 1.0,
  );
  return true;
}

---
 
(program 
(function_signature (type_identifier) (identifier) (formal_parameter_list)) 
(function_body (block (assert_statement 
(assertion 
  (assertion_arguments (logical_and_expression 
    (equality_expression (identifier) (equality_operator) (null_literal)) 
    (logical_and_operator)
    (logical_and_expression 
      (equality_expression (identifier) (equality_operator) (null_literal)) 
      (logical_and_operator)
      (logical_and_expression (equality_expression (identifier) (equality_operator) (null_literal)) 
        (logical_and_operator)
        (logical_and_expression (equality_expression (identifier) (equality_operator) (null_literal)) 
          (logical_and_operator)
          (logical_and_expression (identifier) (selector (unconditional_assignable_selector (identifier))) 
            (logical_and_operator)
            (logical_and_expression (equality_expression (identifier) (equality_operator) (null_literal)) 
                (logical_and_operator)
                (logical_and_expression 
                    (relational_expression (identifier) (relational_operator) 
                      (decimal_floating_point_literal)) 
                     (logical_and_operator)
                    (relational_expression (identifier) (relational_operator) (decimal_floating_point_literal)
                    )
                  )
                  )
                  )
                )
              )
            )
          ))
        )
      ) (return_statement (true)))))


===================================
more tests 5
===================================

main(){
  var textTheme = TextTheme(error: '');
}

---


(program  (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (local_variable_declaration
            (initialized_variable_definition
              (inferred_type)
              (identifier)
              (identifier)
              (selector
                (argument_part
                  (arguments
                    (named_argument
                      (label
                        (identifier))
                      (string_literal))))))))))

===================================
more tests 6
===================================

void _layout(ConstraintType constraints) {
  @pragma('vm:notify-debugger-on-exception')
  void layoutCallback() {
    Widget built;
    try {
      built = (widget as ConstrainedLayoutBuilder<ConstraintType>).builder(this, constraints);
      debugWidgetBuilderValue(widget, built);
    } catch (e, stack) {
      built = ErrorWidget.builder(
        _debugReportException(
          informationCollector: () => <DiagnosticsNode>[
            if (kDebugMode)
              DiagnosticsDebugCreator(DebugCreator(this)),
          ],
        ),
      );
    }
  }

  owner!.buildScope(this, layoutCallback);
}

---

    (program (function_signature (void_type) (identifier)
     (formal_parameter_list (formal_parameter (type_identifier) (identifier)))) 
     (function_body 
          (block 
            (local_function_declaration (annotation (identifier) 
            (arguments (argument (string_literal)))) 
            (lambda_expression 
              (function_signature (void_type) (identifier) (formal_parameter_list)) 
      (function_body (block (local_variable_declaration 
      (initialized_variable_definition (type_identifier) (identifier))) 
      (try_statement 
          (block 
            (expression_statement 
              (assignment_expression (assignable_expression (identifier)) 
              (parenthesized_expression 
                (type_cast_expression (identifier) 
                  (type_cast (as_operator) (type_identifier) (type_arguments (type_identifier))))) 
              (selector (unconditional_assignable_selector (identifier))) 
              (selector (argument_part (arguments (argument (this)) (argument (identifier))))))) 
            (expression_statement 
              (identifier) (selector 
              (argument_part (arguments (argument (identifier)) (argument (identifier))))))) 
        (catch_clause (catch_parameters (identifier) (identifier))) 
          (block 
              (expression_statement (assignment_expression (assignable_expression (identifier)) (identifier) 
                  (selector (unconditional_assignable_selector (identifier))) 
                (selector (argument_part (arguments (argument (identifier) 
                (selector (argument_part (arguments (named_argument (label (identifier)) 
              (function_expression (formal_parameter_list) (function_expression_body 
                (list_literal (type_arguments (type_identifier)) 
                    (if_element (identifier) (identifier) 
                        (selector (argument_part (arguments (argument (identifier) 
                        (selector (argument_part (arguments (argument (this))))))))))))))))))))))))))))) 
              
              
              
              (expression_statement (identifier) (selector) 
              (selector (unconditional_assignable_selector (identifier))) 
              (selector (argument_part (arguments (argument (this)) (argument (identifier))))))))) 

===================================
more tests 7
===================================

void _layout(ConstraintType constraints) {
  @pragma('vm:notify-debugger-on-exception')
  void layoutCallback() {
    Widget built;
  }
}

---

    (program (function_signature (void_type) (identifier) 
      (formal_parameter_list (formal_parameter (type_identifier) (identifier)))) 
        (function_body (block (local_function_declaration (annotation (identifier) 
          (arguments (argument (string_literal)))) 
            (lambda_expression 
              (function_signature (void_type) (identifier) (formal_parameter_list)) 
              (function_body 
                (block (local_variable_declaration 
                (initialized_variable_definition (type_identifier) (identifier))))))))))

===================================
more tests 8
===================================

void _layout(ConstraintType constraints) {
  @pragma('vm:notify-debugger-on-exception')
  void layoutCallback() {
    Widget built;
  }
  owner!.buildScope(this, layoutCallback);
}

---

 (program (function_signature (void_type) (identifier) 
  (formal_parameter_list (formal_parameter (type_identifier) (identifier)))) 
    (function_body (block (local_function_declaration (annotation (identifier) 
      (arguments (argument (string_literal)))) 
      (lambda_expression (function_signature (void_type) (identifier) (formal_parameter_list)) 
        (function_body 
          (block 
            (local_variable_declaration 
              (initialized_variable_definition (type_identifier) (identifier))))))) 
              (expression_statement (identifier) (selector) (selector 
          (unconditional_assignable_selector (identifier))) 
          (selector (argument_part (arguments (argument (this)) (argument (identifier)))))))))

====================================
cascade selector
====================================

main() {
  layer
  ?..link = link
  ..showWhenUnlinked = showWhenUnlinked
  ..linkedOffset = effectiveLinkedOffset
  ..unlinkedOffset = offset;
}

---
 (program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (expression_statement
            (identifier)
            (cascade_section
              (cascade_selector
                (identifier))
              (identifier))
            (cascade_section
              (cascade_selector
                (identifier))
              (identifier))
            (cascade_section
              (cascade_selector
                (identifier))
              (identifier))
            (cascade_section
              (cascade_selector
                (identifier))
              (identifier))))))

====================================
cascade selector 2
====================================

main() {
  layer
  ..link = link
  ..showWhenUnlinked = showWhenUnlinked
  ..linkedOffset = effectiveLinkedOffset
  ..unlinkedOffset = offset;
}


---

(program
      (function_signature
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (expression_statement
            (identifier)
            (cascade_section
              (cascade_selector
                (identifier))
              (identifier))
            (cascade_section
              (cascade_selector
                (identifier))
              (identifier))
            (cascade_section
              (cascade_selector
                (identifier))
              (identifier))
            (cascade_section
              (cascade_selector
                (identifier))
              (identifier))))))

====================================
comment selector 1
====================================

    //    C   C*   *=node removed next pass
    //
    await tester.pumpWidget(Directionality(
      textDirection: TextDirection.ltr,
      child: Stack(),
    ));

---

(program
      (comment)
      (comment)
      (function_signature
        (type_identifier)
        (ERROR
          (identifier))
        (identifier)
        (formal_parameter_list
          (formal_parameter
            (identifier)
            (formal_parameter_list
              (ERROR
                (formal_parameter
                  (identifier)))
              (formal_parameter
                (type_identifier)
                (type_identifier)
                (ERROR
                  (identifier))
                (identifier)
                (formal_parameter_list)))))))

====================================
comment overselected 2
====================================

// }
//
class Placeholder {
  Placeholder(this.resourceId, this.name, Map<String, Object?> attributes)
    : assert(resourceId != null),
      assert(name != null),
      example = _stringAttribute(resourceId, name, attributes, 'example'),
      type = _stringAttribute(resourceId, name, attributes, 'type') ?? 'Object';

  final String resourceId;
}

---

(program (comment) (comment) (class_definition (identifier) 
    (class_body (declaration (constructor_signature (identifier) (formal_parameter_list 
    (formal_parameter (constructor_param (this) (identifier))) (formal_parameter (constructor_param (this) (identifier))) 
    (formal_parameter (type_identifier) (type_arguments (type_identifier) (type_identifier) (nullable_type) ) (identifier)))) (initializers 
    (initializer_list_entry (assertion (assertion_arguments (equality_expression (identifier) (equality_operator) (null_literal))))) 
    (initializer_list_entry (assertion (assertion_arguments (equality_expression (identifier) (equality_operator) (null_literal))))) 
    (initializer_list_entry (field_initializer (identifier) (identifier) (selector (argument_part (arguments (argument (identifier)) 
    (argument (identifier)) (argument (identifier)) (argument (string_literal))))))) 
    (initializer_list_entry (field_initializer (identifier) 
    (if_null_expression (identifier) (selector 
    (argument_part 
      (arguments 
        (argument (identifier)) 
        (argument (identifier)) 
        (argument (identifier)) 
        (argument (string_literal))))) 
        (string_literal)))))) 
    (declaration (final_builtin) (type_identifier) 
    (initialized_identifier_list (initialized_identifier (identifier))))))) 


================================================
static late final 1
================================================

class TestRoot extends StatefulWidget {
  const TestRoot({ super.key });

  static late final TestRootState state;

  @override
  State<TestRoot> createState() => TestRootState();
}

---

    (program 
      (class_definition (identifier) (superclass (type_identifier)) 
        (class_body 
          (declaration 
              (constant_constructor_signature (const_builtin) (identifier) 
              (formal_parameter_list (optional_formal_parameters 
          (formal_parameter (super_formal_parameter (super) (identifier))))))) 
          (declaration (final_builtin) (type_identifier) 
            (initialized_identifier_list (initialized_identifier (identifier)))) 
            (marker_annotation (identifier)) 
          (method_signature 
            (function_signature (type_identifier) 
            (type_arguments (type_identifier)) (identifier) (formal_parameter_list))) 
            (function_body (identifier) (selector (argument_part (arguments))))))) 

================================================
static late final 2
================================================

class TestRoot extends StatefulWidget {
  static late final TestRootState state;
}

---
    (program (class_definition (identifier) (superclass (type_identifier)) 
        (class_body (declaration (final_builtin) (type_identifier) 
        (initialized_identifier_list (initialized_identifier (identifier)))))))


===================
Error
===================
Offset getOffsetForCaret() {
    switch (caretMetrics) {
      case _EmptyLineCaretMetrics(:final double lineVerticalOffset):
        final double paintOffsetAlignment = _computePaintOffsetFraction(textAlign, textDirection!);
        // The full width is not (width - caretPrototype.width)
        final double dx = paintOffsetAlignment == 0 ? 0 : paintOffsetAlignment * width;
        return Offset(dx, lineVerticalOffset);
      case _LineCaretMetrics(writingDirection: TextDirection.ltr, :final Offset offset):
        rawOffset = offset;
      case _LineCaretMetrics(writingDirection: TextDirection.rtl, :final Offset offset):
        rawOffset = Offset(offset.dx - caretPrototype.width, offset.dy);
    }
}

---

(program
      (function_signature
        (type_identifier)
        (identifier)
        (formal_parameter_list))
      (function_body
        (block
          (switch_statement
            (parenthesized_expression
              (identifier))
            (switch_block
              (switch_statement_case
              (case_builtin)
                (object_pattern
                  (type_identifier)
                  (variable_pattern
                    (final_builtin)
                    (type_identifier)
                    (identifier)))
                (local_variable_declaration
                  (initialized_variable_definition
                    (final_builtin)
                    (type_identifier)
                    (identifier)
                    (identifier)
                    (selector
                      (argument_part
                        (arguments
                          (argument
                            (identifier))
                          (argument
                            (identifier)
                            (selector)))))))
                (comment)
                (local_variable_declaration
                  (initialized_variable_definition
                    (final_builtin)
                    (type_identifier)
                    (identifier)
                    (conditional_expression
                      (equality_expression
                        (identifier)
                        (equality_operator)
                        (decimal_integer_literal))
                      (decimal_integer_literal)
                      (multiplicative_expression
                        (identifier)
                        (multiplicative_operator)
                        (identifier)))))
                        (return_statement
                  (identifier)
                  (selector
                    (argument_part
                      (arguments
                        (argument
                          (identifier))
                        (argument
                          (identifier)))))))
              (switch_statement_case
              (case_builtin)
                (object_pattern
                  (type_identifier)
                  (identifier)
                  (constant_pattern
                    (qualified
                      (type_identifier)
                      (identifier)))
                  (variable_pattern
                    (final_builtin)
                    (type_identifier)
                    (identifier)))
                (expression_statement
                  (assignment_expression
                    (assignable_expression
                      (identifier))
                    (identifier))))
              (switch_statement_case
              (case_builtin)
                (object_pattern
                  (type_identifier)
                  (identifier)
                  (constant_pattern
                    (qualified
                      (type_identifier)
                      (identifier)))
                  (variable_pattern
                    (final_builtin)
                    (type_identifier)
                    (identifier)))
                (expression_statement
                  (assignment_expression
                    (assignable_expression
                      (identifier))
                    (identifier)
                    (selector
                      (argument_part
                        (arguments
                          (argument
                            (additive_expression
                              (identifier)
                              (selector
                                (unconditional_assignable_selector
                                  (identifier)))
                              (additive_operator)
                              (identifier)
                              (selector
                                (unconditional_assignable_selector
                                  (identifier)))))
                          (argument
                            (identifier)
                            (selector
                              (unconditional_assignable_selector
                                (identifier)))))))))))))))
                