Skip to content

Commit

Permalink
Remove friendlyNameForElement from utils
Browse files Browse the repository at this point in the history
Not used
  • Loading branch information
kevmoo committed Apr 13, 2018
1 parent ff418a4 commit 5a85bb7
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions pkgs/source_gen/lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,6 @@ import 'package:analyzer/dart/element/type.dart';
import 'package:build/build.dart';
import 'package:path/path.dart' as p;

String friendlyNameForElement(Element element) {
var friendlyName = element.displayName;

if (friendlyName == null) {
throw new ArgumentError(
'Cannot get friendly name for $element - ${element.runtimeType}.');
}

var names = <String>[friendlyName];
if (element is ClassElement) {
names.insert(0, 'class');
if (element.isAbstract) {
names.insert(0, 'abstract');
}
}
if (element is VariableElement) {
names.insert(0, element.type.toString());

if (element.isConst) {
names.insert(0, 'const');
}

if (element.isFinal) {
names.insert(0, 'final');
}
}
if (element is LibraryElement) {
names.insert(0, 'library');
}

return names.join(' ');
}

/// Returns a non-null name for the provided [type].
///
/// In newer versions of the Dart analyzer, a `typedef` does not keep the
Expand Down

0 comments on commit 5a85bb7

Please sign in to comment.