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

Side by Side Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 2630743002: Remove use of FunctionSignature et al from call_structure.dart (Closed)
Patch Set: Created 3 years, 11 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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.members; 5 library dart2js.resolution.members;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show Selectors; 8 import '../common/names.dart' show Selectors;
9 import '../common/resolution.dart' show Resolution; 9 import '../common/resolution.dart' show Resolution;
10 import '../compile_time_constants.dart'; 10 import '../compile_time_constants.dart';
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 if (semantics == null) { 1559 if (semantics == null) {
1560 semantics = computeSuperAccessSemanticsForSelector(node, selector, 1560 semantics = computeSuperAccessSemanticsForSelector(node, selector,
1561 alternateName: name.setter); 1561 alternateName: name.setter);
1562 } 1562 }
1563 if (node.isCall) { 1563 if (node.isCall) {
1564 bool isIncompatibleInvoke = false; 1564 bool isIncompatibleInvoke = false;
1565 switch (semantics.kind) { 1565 switch (semantics.kind) {
1566 case AccessKind.SUPER_METHOD: 1566 case AccessKind.SUPER_METHOD:
1567 MethodElement superMethod = semantics.element; 1567 MethodElement superMethod = semantics.element;
1568 superMethod.computeType(resolution); 1568 superMethod.computeType(resolution);
1569 if (!callStructure.signatureApplies(superMethod.functionSignature)) { 1569 if (!callStructure.signatureApplies(superMethod.type)) {
1570 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD); 1570 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD);
1571 registry.registerDynamicUse(new DynamicUse(selector, null)); 1571 registry.registerDynamicUse(new DynamicUse(selector, null));
1572 registry.registerFeature(Feature.SUPER_NO_SUCH_METHOD); 1572 registry.registerFeature(Feature.SUPER_NO_SUCH_METHOD);
1573 isIncompatibleInvoke = true; 1573 isIncompatibleInvoke = true;
1574 } else { 1574 } else {
1575 registry.registerStaticUse( 1575 registry.registerStaticUse(
1576 new StaticUse.superInvoke(semantics.element, callStructure)); 1576 new StaticUse.superInvoke(semantics.element, callStructure));
1577 } 1577 }
1578 break; 1578 break;
1579 case AccessKind.SUPER_FIELD: 1579 case AccessKind.SUPER_FIELD:
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
2487 Selector selector; 2487 Selector selector;
2488 if (node.isCall) { 2488 if (node.isCall) {
2489 CallStructure callStructure = 2489 CallStructure callStructure =
2490 resolveArguments(node.argumentsNode).callStructure; 2490 resolveArguments(node.argumentsNode).callStructure;
2491 selector = new Selector.call(name, callStructure); 2491 selector = new Selector.call(name, callStructure);
2492 bool isIncompatibleInvoke = false; 2492 bool isIncompatibleInvoke = false;
2493 switch (semantics.kind) { 2493 switch (semantics.kind) {
2494 case AccessKind.LOCAL_FUNCTION: 2494 case AccessKind.LOCAL_FUNCTION:
2495 LocalFunctionElementX function = semantics.element; 2495 LocalFunctionElementX function = semantics.element;
2496 function.computeType(resolution); 2496 function.computeType(resolution);
2497 if (!callStructure.signatureApplies(function.functionSignature)) { 2497 if (!callStructure.signatureApplies(function.type)) {
2498 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD); 2498 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD);
2499 registry.registerDynamicUse(new DynamicUse(selector, null)); 2499 registry.registerDynamicUse(new DynamicUse(selector, null));
2500 isIncompatibleInvoke = true; 2500 isIncompatibleInvoke = true;
2501 } 2501 }
2502 break; 2502 break;
2503 case AccessKind.PARAMETER: 2503 case AccessKind.PARAMETER:
2504 case AccessKind.FINAL_PARAMETER: 2504 case AccessKind.FINAL_PARAMETER:
2505 case AccessKind.LOCAL_VARIABLE: 2505 case AccessKind.LOCAL_VARIABLE:
2506 case AccessKind.FINAL_LOCAL_VARIABLE: 2506 case AccessKind.FINAL_LOCAL_VARIABLE:
2507 selector = callStructure.callSelector; 2507 selector = callStructure.callSelector;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 ArgumentsResult argumentsResult = resolveArguments(node.argumentsNode); 2655 ArgumentsResult argumentsResult = resolveArguments(node.argumentsNode);
2656 CallStructure callStructure = argumentsResult.callStructure; 2656 CallStructure callStructure = argumentsResult.callStructure;
2657 selector = new Selector.call(name, callStructure); 2657 selector = new Selector.call(name, callStructure);
2658 2658
2659 bool isIncompatibleInvoke = false; 2659 bool isIncompatibleInvoke = false;
2660 switch (semantics.kind) { 2660 switch (semantics.kind) {
2661 case AccessKind.STATIC_METHOD: 2661 case AccessKind.STATIC_METHOD:
2662 case AccessKind.TOPLEVEL_METHOD: 2662 case AccessKind.TOPLEVEL_METHOD:
2663 MethodElement method = semantics.element; 2663 MethodElement method = semantics.element;
2664 method.computeType(resolution); 2664 method.computeType(resolution);
2665 if (!callStructure.signatureApplies(method.functionSignature)) { 2665 if (!callStructure.signatureApplies(method.type)) {
2666 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD); 2666 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD);
2667 registry.registerDynamicUse(new DynamicUse(selector, null)); 2667 registry.registerDynamicUse(new DynamicUse(selector, null));
2668 isIncompatibleInvoke = true; 2668 isIncompatibleInvoke = true;
2669 } else { 2669 } else {
2670 registry.registerStaticUse( 2670 registry.registerStaticUse(
2671 new StaticUse.staticInvoke(semantics.element, callStructure)); 2671 new StaticUse.staticInvoke(semantics.element, callStructure));
2672 handleForeignCall(node, semantics.element, callStructure); 2672 handleForeignCall(node, semantics.element, callStructure);
2673 if (method == resolution.commonElements.identicalFunction && 2673 if (method == resolution.commonElements.identicalFunction &&
2674 argumentsResult.isValidAsConstant) { 2674 argumentsResult.isValidAsConstant) {
2675 result = new ConstantResult( 2675 result = new ConstantResult(
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
3834 CallStructure callStructure = selector.callStructure; 3834 CallStructure callStructure = selector.callStructure;
3835 registry.useElement(node.send, constructor); 3835 registry.useElement(node.send, constructor);
3836 3836
3837 ResolutionDartType type = result.type; 3837 ResolutionDartType type = result.type;
3838 ConstructorAccessKind kind; 3838 ConstructorAccessKind kind;
3839 bool isInvalid = false; 3839 bool isInvalid = false;
3840 switch (result.kind) { 3840 switch (result.kind) {
3841 case ConstructorResultKind.GENERATIVE: 3841 case ConstructorResultKind.GENERATIVE:
3842 // Ensure that the signature of [constructor] has been computed. 3842 // Ensure that the signature of [constructor] has been computed.
3843 constructor.computeType(resolution); 3843 constructor.computeType(resolution);
3844 if (!callStructure.signatureApplies(constructor.functionSignature)) { 3844 if (!callStructure.signatureApplies(constructor.type)) {
3845 isInvalid = true; 3845 isInvalid = true;
3846 kind = ConstructorAccessKind.INCOMPATIBLE; 3846 kind = ConstructorAccessKind.INCOMPATIBLE;
3847 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD); 3847 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD);
3848 } else { 3848 } else {
3849 kind = ConstructorAccessKind.GENERATIVE; 3849 kind = ConstructorAccessKind.GENERATIVE;
3850 } 3850 }
3851 break; 3851 break;
3852 case ConstructorResultKind.FACTORY: 3852 case ConstructorResultKind.FACTORY:
3853 // Ensure that the signature of [constructor] has been computed. 3853 // Ensure that the signature of [constructor] has been computed.
3854 constructor.computeType(resolution); 3854 constructor.computeType(resolution);
3855 if (!callStructure.signatureApplies(constructor.functionSignature)) { 3855 if (!callStructure.signatureApplies(constructor.type)) {
3856 // The effective target might still be valid(!) so the is not an 3856 // The effective target might still be valid(!) so the is not an
3857 // invalid case in itself. For instance 3857 // invalid case in itself. For instance
3858 // 3858 //
3859 // class A { 3859 // class A {
3860 // factory A() = A.a; 3860 // factory A() = A.a;
3861 // A.a(a); 3861 // A.a(a);
3862 // } 3862 // }
3863 // m() => new A(0); // This creates a warning but works at runtime. 3863 // m() => new A(0); // This creates a warning but works at runtime.
3864 // 3864 //
3865 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD); 3865 registry.registerFeature(Feature.THROW_NO_SUCH_METHOD);
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
4763 } 4763 }
4764 return const NoneResult(); 4764 return const NoneResult();
4765 } 4765 }
4766 } 4766 }
4767 4767
4768 /// Looks up [name] in [scope] and unwraps the result. 4768 /// Looks up [name] in [scope] and unwraps the result.
4769 Element lookupInScope( 4769 Element lookupInScope(
4770 DiagnosticReporter reporter, Node node, Scope scope, String name) { 4770 DiagnosticReporter reporter, Node node, Scope scope, String name) {
4771 return Elements.unwrap(scope.lookup(name), reporter, node); 4771 return Elements.unwrap(scope.lookup(name), reporter, node);
4772 } 4772 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698