| 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:logging/logging.dart' as logger; | 10 import 'package:logging/logging.dart' as logger; |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 // type variables with the fresh type variables | 423 // type variables with the fresh type variables |
| 424 element.returnType = type.returnType.substitute2(tTypes, ftvs); | 424 element.returnType = type.returnType.substitute2(tTypes, ftvs); |
| 425 // Set the type parameter elements | 425 // Set the type parameter elements |
| 426 element.typeParameters = tElements; | 426 element.typeParameters = tElements; |
| 427 // Set the parent element to the current compilation unit | 427 // Set the parent element to the current compilation unit |
| 428 element.enclosingElement = _currentUnit; | 428 element.enclosingElement = _currentUnit; |
| 429 | 429 |
| 430 // This is the type corresponding to the typedef. Note that | 430 // This is the type corresponding to the typedef. Note that |
| 431 // almost all methods on this type delegate to the element, so it | 431 // almost all methods on this type delegate to the element, so it |
| 432 // cannot be safely be used for anything until the element is fully resolved | 432 // cannot be safely be used for anything until the element is fully resolved |
| 433 FunctionTypeImpl substType = new FunctionTypeImpl.con2(element); | 433 FunctionTypeImpl substType = new FunctionTypeImpl.forTypedef(element); |
| 434 element.type = substType; | 434 element.type = substType; |
| 435 // Link the type and the element into the identifier for the typedef | 435 // Link the type and the element into the identifier for the typedef |
| 436 t.staticType = substType; | 436 t.staticType = substType; |
| 437 t.staticElement = element; | 437 t.staticElement = element; |
| 438 | 438 |
| 439 // Make the formal parameters for the typedef, using the original type | 439 // Make the formal parameters for the typedef, using the original type |
| 440 // with the fresh type variables substituted in. | 440 // with the fresh type variables substituted in. |
| 441 List<FormalParameter> fps = | 441 List<FormalParameter> fps = |
| 442 _formalParameterListForFunctionType(type.substitute2(tTypes, ftvs)); | 442 _formalParameterListForFunctionType(type.substitute2(tTypes, ftvs)); |
| 443 // Get the static elements out of the parameters, and use them to | 443 // Get the static elements out of the parameters, and use them to |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 var t = _mkNewTypeName(dType, id, args); | 498 var t = _mkNewTypeName(dType, id, args); |
| 499 return t; | 499 return t; |
| 500 } | 500 } |
| 501 | 501 |
| 502 TypeName _mkNewTypeName(DartType type, Identifier id, List<TypeName> args) { | 502 TypeName _mkNewTypeName(DartType type, Identifier id, List<TypeName> args) { |
| 503 var t = AstBuilder.typeName(id, args); | 503 var t = AstBuilder.typeName(id, args); |
| 504 t.type = type; | 504 t.type = type; |
| 505 return t; | 505 return t; |
| 506 } | 506 } |
| 507 } | 507 } |
| OLD | NEW |