| OLD | NEW |
| 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 summary_resynthesizer; | 5 library summary_resynthesizer; |
| 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/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 * created which refers to a function type implicitly defined by one of the | 1369 * created which refers to a function type implicitly defined by one of the |
| 1370 * element's parameters. [implicitFunctionTypeIndices] is interpreted as in | 1370 * element's parameters. [implicitFunctionTypeIndices] is interpreted as in |
| 1371 * [EntityRef.implicitFunctionTypeIndices]. | 1371 * [EntityRef.implicitFunctionTypeIndices]. |
| 1372 */ | 1372 */ |
| 1373 DartType _buildType( | 1373 DartType _buildType( |
| 1374 DartType getTypeArgument(int i), List<int> implicitFunctionTypeIndices) { | 1374 DartType getTypeArgument(int i), List<int> implicitFunctionTypeIndices) { |
| 1375 ElementHandle element = this.element; // To allow type promotion | 1375 ElementHandle element = this.element; // To allow type promotion |
| 1376 if (element is ClassElementHandle) { | 1376 if (element is ClassElementHandle) { |
| 1377 return new InterfaceTypeImpl.elementWithNameAndArgs(element, name, | 1377 return new InterfaceTypeImpl.elementWithNameAndArgs(element, name, |
| 1378 _buildTypeArguments(numTypeParameters, getTypeArgument)); | 1378 _buildTypeArguments(numTypeParameters, getTypeArgument)); |
| 1379 } else if (element is FunctionTypeAliasElementHandle) { | |
| 1380 return new FunctionTypeImpl.elementWithNameAndArgs( | |
| 1381 element, | |
| 1382 name, | |
| 1383 _buildTypeArguments(numTypeParameters, getTypeArgument), | |
| 1384 numTypeParameters != 0); | |
| 1385 } else if (element is FunctionTypedElement) { | 1379 } else if (element is FunctionTypedElement) { |
| 1386 int numTypeArguments; | 1380 int numTypeArguments; |
| 1387 FunctionTypedElementComputer computer; | 1381 FunctionTypedElementComputer computer; |
| 1388 if (implicitFunctionTypeIndices.isNotEmpty) { | 1382 if (implicitFunctionTypeIndices.isNotEmpty) { |
| 1389 numTypeArguments = numTypeParameters; | 1383 numTypeArguments = numTypeParameters; |
| 1390 computer = () { | 1384 computer = () { |
| 1391 FunctionTypedElement element = this.element; | 1385 FunctionTypedElement element = this.element; |
| 1392 for (int index in implicitFunctionTypeIndices) { | 1386 for (int index in implicitFunctionTypeIndices) { |
| 1393 element = element.parameters[index].type.element; | 1387 element = element.parameters[index].type.element; |
| 1394 } | 1388 } |
| 1395 return element; | 1389 return element; |
| 1396 }; | 1390 }; |
| 1391 } else if (element is FunctionTypeAliasElementHandle) { |
| 1392 return new FunctionTypeImpl.elementWithNameAndArgs( |
| 1393 element, |
| 1394 name, |
| 1395 _buildTypeArguments(numTypeParameters, getTypeArgument), |
| 1396 numTypeParameters != 0); |
| 1397 } else { | 1397 } else { |
| 1398 // For a type that refers to a generic executable, the type arguments ar
e | 1398 // For a type that refers to a generic executable, the type arguments ar
e |
| 1399 // not supposed to include the arguments to the executable itself. | 1399 // not supposed to include the arguments to the executable itself. |
| 1400 numTypeArguments = enclosing == null ? 0 : enclosing.numTypeParameters; | 1400 numTypeArguments = enclosing == null ? 0 : enclosing.numTypeParameters; |
| 1401 computer = () => this.element as FunctionTypedElement; | 1401 computer = () => this.element as FunctionTypedElement; |
| 1402 } | 1402 } |
| 1403 // TODO(paulberry): Is it a bug that we have to pass `false` for | 1403 // TODO(paulberry): Is it a bug that we have to pass `false` for |
| 1404 // isInstantiated? | 1404 // isInstantiated? |
| 1405 return new DeferredFunctionTypeImpl(computer, null, | 1405 return new DeferredFunctionTypeImpl(computer, null, |
| 1406 _buildTypeArguments(numTypeArguments, getTypeArgument), false); | 1406 _buildTypeArguments(numTypeArguments, getTypeArgument), false); |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2656 static String _getElementIdentifier(String name, ReferenceKind kind) { | 2656 static String _getElementIdentifier(String name, ReferenceKind kind) { |
| 2657 if (kind == ReferenceKind.topLevelPropertyAccessor || | 2657 if (kind == ReferenceKind.topLevelPropertyAccessor || |
| 2658 kind == ReferenceKind.propertyAccessor) { | 2658 kind == ReferenceKind.propertyAccessor) { |
| 2659 if (!name.endsWith('=')) { | 2659 if (!name.endsWith('=')) { |
| 2660 return name + '?'; | 2660 return name + '?'; |
| 2661 } | 2661 } |
| 2662 } | 2662 } |
| 2663 return name; | 2663 return name; |
| 2664 } | 2664 } |
| 2665 } | 2665 } |
| OLD | NEW |