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

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

Issue 971193003: Don't set a propagate type if the variable has already the same static type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 engine.resolver; 5 library engine.resolver;
6 6
7 import "dart:math" as math; 7 import "dart:math" as math;
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/src/generated/utilities_collection.dart'; 10 import 'package:analyzer/src/generated/utilities_collection.dart';
(...skipping 10419 matching lines...) Expand 10 before | Expand all | Expand 10 after
10430 * @param allowPrecisionLoss true if `potentialType` is allowed to be less pre cise than the 10430 * @param allowPrecisionLoss true if `potentialType` is allowed to be less pre cise than the
10431 * current best type 10431 * current best type
10432 */ 10432 */
10433 void overrideVariable(VariableElement element, DartType potentialType, 10433 void overrideVariable(VariableElement element, DartType potentialType,
10434 bool allowPrecisionLoss) { 10434 bool allowPrecisionLoss) {
10435 if (potentialType == null || potentialType.isBottom) { 10435 if (potentialType == null || potentialType.isBottom) {
10436 return; 10436 return;
10437 } 10437 }
10438 DartType currentType = _overrideManager.getBestType(element); 10438 DartType currentType = _overrideManager.getBestType(element);
10439 10439
10440 if (potentialType == currentType) {
10441 return;
10442 }
10443
10440 // If we aren't allowing precision loss then the third and fourth conditions 10444 // If we aren't allowing precision loss then the third and fourth conditions
10441 // check that we aren't losing precision. 10445 // check that we aren't losing precision.
10442 // 10446 //
10443 // Let [C] be the current type and [P] be the potential type. When we 10447 // Let [C] be the current type and [P] be the potential type. When we
10444 // aren't allowing precision loss -- which is the case for is-checks -- we 10448 // aren't allowing precision loss -- which is the case for is-checks -- we
10445 // check that [! (C << P)] or [P << C]. The second check, that [P << C], is 10449 // check that [! (C << P)] or [P << C]. The second check, that [P << C], is
10446 // analogous to part of the Dart Language Spec rule for type promotion under 10450 // analogous to part of the Dart Language Spec rule for type promotion under
10447 // is-checks (in the analogy [T] is [P] and [S] is [C]): 10451 // is-checks (in the analogy [T] is [P] and [S] is [C]):
10448 // 10452 //
10449 // An is-expression of the form [v is T] shows that [v] has type [T] iff 10453 // An is-expression of the form [v is T] shows that [v] has type [T] iff
(...skipping 4937 matching lines...) Expand 10 before | Expand all | Expand 10 after
15387 * library. 15391 * library.
15388 */ 15392 */
15389 final HashSet<String> members = new HashSet<String>(); 15393 final HashSet<String> members = new HashSet<String>();
15390 15394
15391 /** 15395 /**
15392 * Names of resolved or unresolved class members that are read in the 15396 * Names of resolved or unresolved class members that are read in the
15393 * library. 15397 * library.
15394 */ 15398 */
15395 final HashSet<String> readMembers = new HashSet<String>(); 15399 final HashSet<String> readMembers = new HashSet<String>();
15396 } 15400 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698