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

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

Issue 1606043003: remove unused method in ElementResolver (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | 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) 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/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 if (callMethod != null) { 1348 if (callMethod != null) {
1349 return _resolveArgumentsToFunction(false, argumentList, callMethod); 1349 return _resolveArgumentsToFunction(false, argumentList, callMethod);
1350 } 1350 }
1351 } else if (type is FunctionType) { 1351 } else if (type is FunctionType) {
1352 return _resolveArgumentsToParameters( 1352 return _resolveArgumentsToParameters(
1353 false, argumentList, type.parameters); 1353 false, argumentList, type.parameters);
1354 } 1354 }
1355 return null; 1355 return null;
1356 } 1356 }
1357 1357
1358 DartType _computeMethodInvokeType(MethodInvocation node, Element element) {
1359 if (element == null) {
1360 return null;
1361 }
1362
1363 DartType invokeType;
1364 if (element is PropertyAccessorElement) {
1365 invokeType = element.returnType;
1366 } else if (element is ExecutableElement) {
1367 invokeType = element.type;
1368 } else if (element is VariableElement) {
1369 invokeType = _promoteManager.getStaticType(element);
1370 }
1371
1372 //
1373 // Check for a generic method & apply type arguments if any were passed.
1374 //
1375 // TODO(jmesserly): support generic "call" methods on InterfaceType.
1376 if (invokeType is FunctionType) {
1377 FunctionType type = invokeType;
1378 List<TypeParameterElement> parameters = type.typeFormals;
1379
1380 NodeList<TypeName> arguments = node.typeArguments?.arguments;
1381 if (arguments != null && arguments.length != parameters.length) {
1382 // Wrong number of type arguments. Ignore them
1383 arguments = null;
1384 _resolver.reportErrorForNode(
1385 StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS,
1386 node.methodName,
1387 [type, parameters.length, arguments?.length ?? 0]);
1388 }
1389 if (parameters.isNotEmpty) {
1390 if (arguments == null) {
1391 invokeType = _resolver.typeSystem.instantiateToBounds(type);
1392 } else {
1393 invokeType = type.instantiate(arguments.map((n) => n.type).toList());
1394 }
1395 }
1396 }
1397
1398 return invokeType;
1399 }
1400
1401 /** 1358 /**
1402 * If the given [element] is a setter, return the getter associated with it. 1359 * If the given [element] is a setter, return the getter associated with it.
1403 * Otherwise, return the element unchanged. 1360 * Otherwise, return the element unchanged.
1404 */ 1361 */
1405 Element _convertSetterToGetter(Element element) { 1362 Element _convertSetterToGetter(Element element) {
1406 // TODO(brianwilkerson) Determine whether and why the element could ever be 1363 // TODO(brianwilkerson) Determine whether and why the element could ever be
1407 // a setter. 1364 // a setter.
1408 if (element is PropertyAccessorElement) { 1365 if (element is PropertyAccessorElement) {
1409 return element.variable.getter; 1366 return element.variable.getter;
1410 } 1367 }
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2667 2624
2668 @override 2625 @override
2669 Element get staticElement => null; 2626 Element get staticElement => null;
2670 2627
2671 @override 2628 @override
2672 accept(AstVisitor visitor) => null; 2629 accept(AstVisitor visitor) => null;
2673 2630
2674 @override 2631 @override
2675 void visitChildren(AstVisitor visitor) {} 2632 void visitChildren(AstVisitor visitor) {}
2676 } 2633 }
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