modelType property

ElementType modelType

Implementation

ElementType get modelType {
  var element = this.element;
  if (_modelType == null) {
    // TODO(jcollins-g): Need an interface for a "member with a type" (or changed object model).
    if (_originalMember != null &&
        (_originalMember is ExecutableMember ||
            _originalMember is ParameterMember)) {
      if (_originalMember is ExecutableMember) {
        _modelType = ElementType.from(
            (_originalMember as ExecutableMember).type,
            library,
            packageGraph);
      } else {
        // ParameterMember
        _modelType = ElementType.from(
            (_originalMember as ParameterMember).type, library, packageGraph);
      }
    } else if (element is ClassElement) {
      _modelType = ElementType.from(element.thisType, library, packageGraph);
    } else if (element is FunctionTypeAliasElement) {
      _modelType =
          ElementType.from(element.function.type, library, packageGraph);
    } else if (element is FunctionTypedElement) {
      _modelType = ElementType.from(element.type, library, packageGraph);
    } else if (element is ParameterElement) {
      _modelType = ElementType.from(element.type, library, packageGraph);
    } else if (element is PropertyInducingElement) {
      _modelType = ElementType.from(element.type, library, packageGraph);
    } else {
      throw UnimplementedError('(${element.runtimeType}) $element');
    }
  }
  return _modelType;
}