| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 dart2js.kernel.element_map; | 5 library dart2js.kernel.element_map; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' as ir; | 7 import 'package:kernel/ast.dart' as ir; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 }); | 412 }); |
| 413 return list; | 413 return list; |
| 414 } | 414 } |
| 415 | 415 |
| 416 @override | 416 @override |
| 417 InterfaceType getInterfaceType(ir.InterfaceType type) => | 417 InterfaceType getInterfaceType(ir.InterfaceType type) => |
| 418 _typeConverter.convert(type); | 418 _typeConverter.convert(type); |
| 419 | 419 |
| 420 @override | 420 @override |
| 421 FunctionType getFunctionType(ir.FunctionNode node) { | 421 FunctionType getFunctionType(ir.FunctionNode node) { |
| 422 DartType returnType = getDartType(node.returnType); | 422 DartType returnType; |
| 423 if (node.parent is ir.Constructor) { |
| 424 // The return type on generative constructors is `void`, but we need |
| 425 // `dynamic` type to match the element model. |
| 426 returnType = const DynamicType(); |
| 427 } else { |
| 428 returnType = getDartType(node.returnType); |
| 429 } |
| 423 List<DartType> parameterTypes = /*<DartType>*/ []; | 430 List<DartType> parameterTypes = /*<DartType>*/ []; |
| 424 List<DartType> optionalParameterTypes = /*<DartType>*/ []; | 431 List<DartType> optionalParameterTypes = /*<DartType>*/ []; |
| 425 for (ir.VariableDeclaration variable in node.positionalParameters) { | 432 for (ir.VariableDeclaration variable in node.positionalParameters) { |
| 426 if (parameterTypes.length == node.requiredParameterCount) { | 433 if (parameterTypes.length == node.requiredParameterCount) { |
| 427 optionalParameterTypes.add(getDartType(variable.type)); | 434 optionalParameterTypes.add(getDartType(variable.type)); |
| 428 } else { | 435 } else { |
| 429 parameterTypes.add(getDartType(variable.type)); | 436 parameterTypes.add(getDartType(variable.type)); |
| 430 } | 437 } |
| 431 } | 438 } |
| 432 List<String> namedParameters = <String>[]; | 439 List<String> namedParameters = <String>[]; |
| (...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 if (data.constructorBody != null) { | 1981 if (data.constructorBody != null) { |
| 1975 f(data.constructorBody); | 1982 f(data.constructorBody); |
| 1976 } | 1983 } |
| 1977 }); | 1984 }); |
| 1978 } | 1985 } |
| 1979 | 1986 |
| 1980 String getDeferredUri(ir.LibraryDependency node) { | 1987 String getDeferredUri(ir.LibraryDependency node) { |
| 1981 throw new UnimplementedError('JsKernelToElementMap.getDeferredUri'); | 1988 throw new UnimplementedError('JsKernelToElementMap.getDeferredUri'); |
| 1982 } | 1989 } |
| 1983 } | 1990 } |
| OLD | NEW |