| 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 dev_compiler.src.codegen.reify_coercions; | 5 library dev_compiler.src.codegen.reify_coercions; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart' as analyzer; | 7 import 'package:analyzer/analyzer.dart' as analyzer; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; | 10 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 addedTypes[id] = desc; | 741 addedTypes[id] = desc; |
| 742 return id; | 742 return id; |
| 743 } | 743 } |
| 744 | 744 |
| 745 FunctionTypeAlias _newResolvedTypedef( | 745 FunctionTypeAlias _newResolvedTypedef( |
| 746 FunctionType type, List<TypeParameterType> ftvs) { | 746 FunctionType type, List<TypeParameterType> ftvs) { |
| 747 | 747 |
| 748 // The name of the typedef (unresolved at this point) | 748 // The name of the typedef (unresolved at this point) |
| 749 // TODO(leafp): better naming. | 749 // TODO(leafp): better naming. |
| 750 SimpleIdentifier t = freshTypeDefVariable("CastType"); | 750 SimpleIdentifier t = freshTypeDefVariable("CastType"); |
| 751 |
| 751 // The element for the new typedef | 752 // The element for the new typedef |
| 752 var element = new FunctionTypeAliasElementImpl(t.name, 0); | 753 var element = new FunctionTypeAliasElementImpl(t.name, 0); |
| 753 | 754 |
| 754 // Fresh type parameter identifiers for the free type variables | 755 // Fresh type parameter identifiers for the free type variables |
| 755 List<Identifier> tNames = | 756 List<Identifier> tNames = |
| 756 ftvs.map((x) => typeParameterFromString(x.name)).toList(); | 757 ftvs.map((x) => typeParameterFromString(x.name)).toList(); |
| 757 // The type parameters themselves | 758 // The type parameters themselves |
| 758 List<TypeParameter> tps = tNames.map(AstBuilder.typeParameter).toList(); | 759 List<TypeParameter> tps = tNames.map(AstBuilder.typeParameter).toList(); |
| 759 // Allocate the elements for the type parameters, fill in their | 760 // Allocate the elements for the type parameters, fill in their |
| 760 // type (which makes no sense) and link up the various elements | 761 // type (which makes no sense) and link up the various elements |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 assert(_runtime != null); | 862 assert(_runtime != null); |
| 862 if (t.typeArguments != null && t.typeArguments.length > 0) { | 863 if (t.typeArguments != null && t.typeArguments.length > 0) { |
| 863 var w = AstBuilder.identifierFromString("_"); | 864 var w = AstBuilder.identifierFromString("_"); |
| 864 var fp = AstBuilder.simpleFormal(w, t); | 865 var fp = AstBuilder.simpleFormal(w, t); |
| 865 var f = AstBuilder.blockFunction(<FormalParameter>[fp], <Statement>[]); | 866 var f = AstBuilder.blockFunction(<FormalParameter>[fp], <Statement>[]); |
| 866 return _runtime.type(f); | 867 return _runtime.type(f); |
| 867 } | 868 } |
| 868 return t.name; | 869 return t.name; |
| 869 } | 870 } |
| 870 } | 871 } |
| OLD | NEW |