reportErrorForName method

void reportErrorForName(
  1. ErrorCode code,
  2. ConstructorDeclaration constructor,
  3. {List<Object>? arguments}
)

Report a diagnostic with the given code and arguments. The location of the diagnostic will be the name of the constructor.

Implementation

void reportErrorForName(ErrorCode code, ConstructorDeclaration constructor,
    {List<Object>? arguments}) {
  // TODO(brianwilkerson) Consider extending this method to take any
  //  declaration and compute the correct range for the name of that
  //  declaration. This might make it easier to be consistent.
  if (constructor.name != null) {
    var offset = constructor.returnType.offset;
    reportErrorForOffset(
        code, offset, constructor.name!.end - offset, arguments);
  } else {
    reportErrorForNode(code, constructor.returnType, arguments);
  }
}