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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart

Issue 11412148: Fix handling of sends with wrong arity (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address Karl's comments Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/compiler/dart2js/cpa_inference_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of types; 5 part of types;
6 6
7 class CancelTypeInferenceException { 7 class CancelTypeInferenceException {
8 final Node node; 8 final Node node;
9 final String reason; 9 final String reason;
10 10
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 * concrete types [argumentsTypes]. If [function] is static then 594 * concrete types [argumentsTypes]. If [function] is static then
595 * [receiverType] must be null, else [function] must be a member of the class 595 * [receiverType] must be null, else [function] must be a member of the class
596 * of [receiverType]. 596 * of [receiverType].
597 */ 597 */
598 ConcreteType getSendReturnType(FunctionElement function, 598 ConcreteType getSendReturnType(FunctionElement function,
599 BaseType receiverType, 599 BaseType receiverType,
600 ArgumentsTypes argumentsTypes) { 600 ArgumentsTypes argumentsTypes) {
601 ConcreteType result = new ConcreteType.empty(); 601 ConcreteType result = new ConcreteType.empty();
602 Map<Element, ConcreteType> argumentMap = 602 Map<Element, ConcreteType> argumentMap =
603 associateArguments(function, argumentsTypes); 603 associateArguments(function, argumentsTypes);
604 argumentMap.forEach((Element parameter, ConcreteType type) {
605 augmentParameterType(parameter, type);
606 });
607 // if the association failed, this send will never occur or will fail 604 // if the association failed, this send will never occur or will fail
608 if (argumentMap == null) { 605 if (argumentMap == null) {
609 return new ConcreteType.empty(); 606 return new ConcreteType.empty();
610 } 607 }
608 argumentMap.forEach(augmentParameterType);
611 ConcreteTypeCartesianProduct product = 609 ConcreteTypeCartesianProduct product =
612 new ConcreteTypeCartesianProduct(receiverType, argumentMap); 610 new ConcreteTypeCartesianProduct(receiverType, argumentMap);
613 for (ConcreteTypesEnvironment environment in product) { 611 for (ConcreteTypesEnvironment environment in product) {
614 result = result.union( 612 result = result.union(
615 getMonomorphicSendReturnType(function, environment)); 613 getMonomorphicSendReturnType(function, environment));
616 } 614 }
617 return result; 615 return result;
618 } 616 }
619 617
620 /** 618 /**
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 } 1451 }
1454 1452
1455 void internalError(String reason, {Node node}) { 1453 void internalError(String reason, {Node node}) {
1456 inferrer.fail(node, reason); 1454 inferrer.fail(node, reason);
1457 } 1455 }
1458 1456
1459 ConcreteType visitTypeReferenceSend(Send) { 1457 ConcreteType visitTypeReferenceSend(Send) {
1460 return new ConcreteType.singleton(inferrer.baseTypes.typeBaseType); 1458 return new ConcreteType.singleton(inferrer.baseTypes.typeBaseType);
1461 } 1459 }
1462 } 1460 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/cpa_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698