Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Unified Diff: pkg/analyzer/lib/src/generated/element_resolver.dart

Issue 1686893002: Consolidate the code that replaces a TypeParameter with its bound. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add unit tests. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/generated/element_resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index 71ce92d3dd7bb9601f09667e162fd8bcc528be7d..ad237038806293be6445572108a2d384acc63fc6 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -2425,26 +2425,15 @@ class ElementResolver extends SimpleAstVisitor<Object> {
* If the given [type] is a type parameter, resolve it to the type that should
* be used when looking up members. Otherwise, return the original type.
*/
- DartType _resolveTypeParameter(DartType type) {
- if (type is TypeParameterType) {
- DartType bound = type.element.bound;
- if (bound == null) {
- return _resolver.typeProvider.objectType;
- }
- return bound;
- }
- return type;
- }
+ DartType _resolveTypeParameter(DartType type) =>
+ type?.resolveToBound(_resolver.typeProvider.objectType);
/**
* Return `true` if we should report an error as a result of looking up a
* [member] in the given [type] and not finding any member.
*/
bool _shouldReportMissingMember(DartType type, Element member) {
- if (member != null || type == null || type.isDynamic || type.isBottom) {
- return false;
- }
- return true;
+ return member == null && type != null && !type.isDynamic && !type.isBottom;
}
/**
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/type.dart ('k') | pkg/analyzer/lib/src/generated/static_type_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698