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

Side by Side Diff: pkg/analyzer/lib/src/task/strong_mode.dart

Issue 2542133004: Use for-each in strong_mode.dart (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library analyzer.src.task.strong_mode; 5 library analyzer.src.task.strong_mode;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 */ 81 */
82 InstanceMemberInferrer(this.typeProvider, this.inheritanceManager, 82 InstanceMemberInferrer(this.typeProvider, this.inheritanceManager,
83 {TypeSystem typeSystem}) 83 {TypeSystem typeSystem})
84 : typeSystem = (typeSystem != null) ? typeSystem : new TypeSystemImpl(); 84 : typeSystem = (typeSystem != null) ? typeSystem : new TypeSystemImpl();
85 85
86 /** 86 /**
87 * Infer type information for all of the instance members in the given 87 * Infer type information for all of the instance members in the given
88 * compilation [unit]. 88 * compilation [unit].
89 */ 89 */
90 void inferCompilationUnit(CompilationUnitElement unit) { 90 void inferCompilationUnit(CompilationUnitElement unit) {
91 unit.types.forEach((ClassElement classElement) { 91 for (ClassElement classElement in unit.types) {
92 try { 92 try {
93 _inferClass(classElement); 93 _inferClass(classElement);
94 } on _CycleException { 94 } on _CycleException {
95 // This is a short circuit return to prevent types that inherit from 95 // This is a short circuit return to prevent types that inherit from
96 // types containing a circular reference from being inferred. 96 // types containing a circular reference from being inferred.
97 } 97 }
98 }); 98 }
99 } 99 }
100 100
101 /** 101 /**
102 * Return `true` if the list of [elements] contains only methods. 102 * Return `true` if the list of [elements] contains only methods.
103 */ 103 */
104 bool _allSameElementKind( 104 bool _allSameElementKind(
105 ExecutableElement element, List<ExecutableElement> elements) { 105 ExecutableElement element, List<ExecutableElement> elements) {
106 return elements.every((e) => e.kind == element.kind); 106 return elements.every((e) => e.kind == element.kind);
107 } 107 }
108 108
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 results.add(element); 495 results.add(element);
496 } 496 }
497 } 497 }
498 } 498 }
499 } 499 }
500 500
501 /** 501 /**
502 * A class of exception that is not used anywhere else. 502 * A class of exception that is not used anywhere else.
503 */ 503 */
504 class _CycleException implements Exception {} 504 class _CycleException implements Exception {}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698