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

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

Issue 2380863003: fix #27135 and fix #27449 strong mode does not use propagated types (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | 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) 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 analyzer.src.generated.element_resolver; 5 library analyzer.src.generated.element_resolver;
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/syntactic_entity.dart'; 10 import 'package:analyzer/dart/ast/syntactic_entity.dart';
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 /** 1840 /**
1841 * Determines if the [propagatedType] of the invoke is better (more specific) 1841 * Determines if the [propagatedType] of the invoke is better (more specific)
1842 * than the [staticType]. If so it will be returned, otherwise returns null. 1842 * than the [staticType]. If so it will be returned, otherwise returns null.
1843 */ 1843 */
1844 // TODO(jmesserly): can we refactor Resolver.recordPropagatedTypeIfBetter to 1844 // TODO(jmesserly): can we refactor Resolver.recordPropagatedTypeIfBetter to
1845 // get some code sharing? Right now, this method is to support 1845 // get some code sharing? Right now, this method is to support
1846 // `staticInvokeType` and `propagatedInvokeType`, and the one in Resolver is 1846 // `staticInvokeType` and `propagatedInvokeType`, and the one in Resolver is
1847 // for `staticType` and `propagatedType` on Expression. 1847 // for `staticType` and `propagatedType` on Expression.
1848 DartType _propagatedInvokeTypeIfBetter( 1848 DartType _propagatedInvokeTypeIfBetter(
1849 DartType propagatedType, DartType staticType) { 1849 DartType propagatedType, DartType staticType) {
1850 if (propagatedType != null && 1850 if (_resolver.strongMode || propagatedType == null) {
1851 (staticType == null || propagatedType.isMoreSpecificThan(staticType))) {
1852 return propagatedType;
1853 } else {
1854 return null; 1851 return null;
1855 } 1852 }
1853 if (staticType == null || propagatedType.isMoreSpecificThan(staticType)) {
1854 return propagatedType;
1855 }
1856 return null;
1856 } 1857 }
1857 1858
1858 /** 1859 /**
1859 * Record that the given [node] is undefined, causing an error to be reported 1860 * Record that the given [node] is undefined, causing an error to be reported
1860 * if appropriate. The [declaringElement] is the element inside which no 1861 * if appropriate. The [declaringElement] is the element inside which no
1861 * declaration was found. If this element is a proxy, no error will be 1862 * declaration was found. If this element is a proxy, no error will be
1862 * reported. If null, then an error will always be reported. The [errorCode] 1863 * reported. If null, then an error will always be reported. The [errorCode]
1863 * is the error code to report. The [arguments] are the arguments to the error 1864 * is the error code to report. The [arguments] are the arguments to the error
1864 * message. 1865 * message.
1865 */ 1866 */
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 2639
2639 @override 2640 @override
2640 Element get staticElement => null; 2641 Element get staticElement => null;
2641 2642
2642 @override 2643 @override
2643 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null; 2644 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null;
2644 2645
2645 @override 2646 @override
2646 void visitChildren(AstVisitor visitor) {} 2647 void visitChildren(AstVisitor visitor) {}
2647 } 2648 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698