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

Side by Side Diff: pkg/compiler/lib/src/resolution/resolution_strategy.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.resolution_strategy; 5 library dart2js.resolution_strategy;
6 6
7 import 'package:front_end/src/fasta/scanner.dart' show Token; 7 import 'package:front_end/src/fasta/scanner.dart' show Token;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common_elements.dart'; 10 import '../common_elements.dart';
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 bool isDeferredLoadLibraryGetter(covariant MemberElement member) { 641 bool isDeferredLoadLibraryGetter(covariant MemberElement member) {
642 return member.isDeferredLoaderGetter; 642 return member.isDeferredLoaderGetter;
643 } 643 }
644 644
645 @override 645 @override
646 ResolutionFunctionType getFunctionType(covariant MethodElement method) { 646 ResolutionFunctionType getFunctionType(covariant MethodElement method) {
647 if (method is ConstructorBodyElement) { 647 if (method is ConstructorBodyElement) {
648 return method.constructor.type; 648 return method.constructor.type;
649 } 649 }
650 method.computeType(_resolution); 650 method.computeType(_resolution);
651 return method.type; 651 ResolutionFunctionType type = method.type;
652 if (method.isConstructor) {
653 ConstructorElement constructor = method;
654 if (constructor.definingConstructor != null) {
655 // The type of a defining constructor doesn't use the right type
656 // variables. Substitute the type variable of the defining class by the
657 // type variables of the enclosing class.
658 ClassElement definingClass =
659 constructor.definingConstructor.enclosingClass;
660 type = type.substByContext(
661 method.enclosingClass.thisType.asInstanceOf(definingClass));
662 }
663 }
664 return type;
652 } 665 }
653 666
654 @override 667 @override
655 ResolutionFunctionType getLocalFunctionType( 668 ResolutionFunctionType getLocalFunctionType(
656 covariant LocalFunctionElement function) { 669 covariant LocalFunctionElement function) {
657 return function.type; 670 return function.type;
658 } 671 }
659 672
660 @override 673 @override
661 ResolutionDartType getUnaliasedType(covariant ResolutionDartType type) { 674 ResolutionDartType getUnaliasedType(covariant ResolutionDartType type) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 @override 900 @override
888 WorkItem createWorkItem(MemberElement element) { 901 WorkItem createWorkItem(MemberElement element) {
889 assert(element.isDeclaration, failedAt(element)); 902 assert(element.isDeclaration, failedAt(element));
890 if (element.isMalformed) return null; 903 if (element.isMalformed) return null;
891 904
892 assert(element is AnalyzableElement, 905 assert(element is AnalyzableElement,
893 failedAt(element, 'Element $element is not analyzable.')); 906 failedAt(element, 'Element $element is not analyzable.'));
894 return _resolution.createWorkItem(element); 907 return _resolution.createWorkItem(element);
895 } 908 }
896 } 909 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map_impl.dart ('k') | tests/compiler/dart2js/equivalence/check_functions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698