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

Side by Side Diff: pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart

Issue 1933763002: Use null-aware operators to clean up the code (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Additional clean-up Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:collection'; 5 import 'dart:collection';
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 * @param classElt the class element to query 454 * @param classElt the class element to query
455 * @param visitedInterfaces a set of visited classes passed back into this met hod when it calls 455 * @param visitedInterfaces a set of visited classes passed back into this met hod when it calls
456 * itself recursively 456 * itself recursively
457 * @return `null` if there was a problem (such as a loop in the class hierarch y) or if there 457 * @return `null` if there was a problem (such as a loop in the class hierarch y) or if there
458 * are no classes above this one in the class hierarchy. Otherwise, a list of interface 458 * are no classes above this one in the class hierarchy. Otherwise, a list of interface
459 * lookup maps. 459 * lookup maps.
460 */ 460 */
461 List<Map<String, ExecutableElement>> _gatherInterfaceLookupMaps( 461 List<Map<String, ExecutableElement>> _gatherInterfaceLookupMaps(
462 ClassElement classElt, HashSet<ClassElement> visitedInterfaces) { 462 ClassElement classElt, HashSet<ClassElement> visitedInterfaces) {
463 InterfaceType supertype = classElt.supertype; 463 InterfaceType supertype = classElt.supertype;
464 ClassElement superclassElement = 464 ClassElement superclassElement = supertype?.element;
465 supertype != null ? supertype.element : null;
466 List<InterfaceType> mixins = classElt.mixins; 465 List<InterfaceType> mixins = classElt.mixins;
467 List<InterfaceType> interfaces = classElt.interfaces; 466 List<InterfaceType> interfaces = classElt.interfaces;
468 // Recursively collect the list of mappings from all of the interface types 467 // Recursively collect the list of mappings from all of the interface types
469 List<Map<String, ExecutableElement>> lookupMaps = 468 List<Map<String, ExecutableElement>> lookupMaps =
470 new List<Map<String, ExecutableElement>>(); 469 new List<Map<String, ExecutableElement>>();
471 // 470 //
472 // Superclass element 471 // Superclass element
473 // 472 //
474 if (superclassElement != null) { 473 if (superclassElement != null) {
475 if (!visitedInterfaces.contains(superclassElement)) { 474 if (!visitedInterfaces.contains(superclassElement)) {
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 } 1229 }
1231 1230
1232 /** 1231 /**
1233 * Initializes [keys] and [values]. 1232 * Initializes [keys] and [values].
1234 */ 1233 */
1235 void _initArrays(int initialCapacity) { 1234 void _initArrays(int initialCapacity) {
1236 _keys = new List<String>(initialCapacity); 1235 _keys = new List<String>(initialCapacity);
1237 _values = new List<ExecutableElement>(initialCapacity); 1236 _values = new List<ExecutableElement>(initialCapacity);
1238 } 1237 }
1239 } 1238 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/type.dart ('k') | pkg/analyzer/lib/src/dart/resolver/scope.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698