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

Side by Side Diff: pkg/compiler/lib/src/kernel/element_map_impl.dart

Issue 2983483002: Check function type equivalence (Closed)
Patch Set: Created 3 years, 5 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
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/elements/types.dart ('k') | pkg/compiler/lib/src/resolution/resolution_strategy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698