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

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

Issue 2223343002: fix #26896, mark all @proxy ops as dynamic (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: make null safe Created 4 years, 4 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/test/src/context/mock_sdk.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) 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 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be 5 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be
6 // refactored to fit into analyzer. 6 // refactored to fit into analyzer.
7 library analyzer.src.task.strong.checker; 7 library analyzer.src.task.strong.checker;
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 1022
1023 /// Returns `true` if the target expression is dynamic. 1023 /// Returns `true` if the target expression is dynamic.
1024 bool _isDynamicTarget(Expression node) { 1024 bool _isDynamicTarget(Expression node) {
1025 if (node == null) return false; 1025 if (node == null) return false;
1026 1026
1027 if (_isLibraryPrefix(node)) return false; 1027 if (_isLibraryPrefix(node)) return false;
1028 1028
1029 // Null type happens when we have unknown identifiers, like a dart: import 1029 // Null type happens when we have unknown identifiers, like a dart: import
1030 // that doesn't resolve. 1030 // that doesn't resolve.
1031 var type = node.staticType; 1031 var type = node.staticType;
1032 return type == null || type.isDynamic; 1032 var element = type?.element;
1033 return type == null ||
1034 type.isDynamic ||
1035 (element is ClassElement && element.isOrInheritsProxy);
vsm 2016/08/09 15:20:51 Is this too conservative if there is an actual met
Jennifer Messerly 2016/08/09 15:31:11 This path actually only handles operators. Method/
1033 } 1036 }
1034 1037
1035 bool _isLibraryPrefix(Expression node) => 1038 bool _isLibraryPrefix(Expression node) =>
1036 node is SimpleIdentifier && node.staticElement is PrefixElement; 1039 node is SimpleIdentifier && node.staticElement is PrefixElement;
1037 1040
1038 bool _isObjectGetter(Expression target, SimpleIdentifier id) { 1041 bool _isObjectGetter(Expression target, SimpleIdentifier id) {
1039 PropertyAccessorElement element = 1042 PropertyAccessorElement element =
1040 typeProvider.objectType.element.getGetter(id.name); 1043 typeProvider.objectType.element.getGetter(id.name);
1041 return (element != null && !element.isStatic); 1044 return (element != null && !element.isStatic);
1042 } 1045 }
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 var visited = new Set<InterfaceType>(); 1517 var visited = new Set<InterfaceType>();
1515 do { 1518 do {
1516 visited.add(current); 1519 visited.add(current);
1517 current.mixins.reversed.forEach( 1520 current.mixins.reversed.forEach(
1518 (m) => _checkIndividualOverridesFromClass(node, m, seen, true)); 1521 (m) => _checkIndividualOverridesFromClass(node, m, seen, true));
1519 _checkIndividualOverridesFromClass(node, current.superclass, seen, true); 1522 _checkIndividualOverridesFromClass(node, current.superclass, seen, true);
1520 current = current.superclass; 1523 current = current.superclass;
1521 } while (!current.isObject && !visited.contains(current)); 1524 } while (!current.isObject && !visited.contains(current));
1522 } 1525 }
1523 } 1526 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698