07c17fbb9f
Add `DartFileEditBuilder.addConstructorInsertion`, a replacement for both `CorrectionUtils.prepareEnumNewConstructorLocation` and `CorrectionUtils.prepareNewConstructorLocation`. Combining the two APIs is made possible by adding enum support to _InsertionPreparer. For example, constructors can be inserted after an enum value-list's semicolon (if there is one), or after the last value (if there isn't). Also: * Refactor _InsertionPreparer a bit to be cleaner; in the constructor, we determine whether we can grab the `NamedCompilationUnitMember` members. * Instead of storing a `_targetMember` as a field, which is only null- checked, store a Boolean value for whether a target member was found. * Remove pre-nnbd support in `DartFileEditBuilder.writeParameter`. Change-Id: I3e98ed906cf5ac82e464c502db5986d3761c3611 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361624 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>