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

Unified Diff: sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart

Issue 24153008: Check if signatures are compatible in a redirecting factory before synthesizing a call in the infer… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart (revision 27593)
+++ sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart (working copy)
@@ -2269,10 +2269,15 @@
returnType = inferrer.addReturnTypeFor(analyzedElement, returnType, type);
}
- void synthesizeForwardingCall(Spannable node, FunctionElement element) {
+ T synthesizeForwardingCall(Spannable node, FunctionElement element) {
element = element.implementation;
FunctionElement function = analyzedElement;
FunctionSignature signature = function.computeSignature(compiler);
+ FunctionSignature calleeSignature = element.computeSignature(compiler);
+ if (!calleeSignature.isCompatibleWith(signature)) {
+ return types.nonNullEmpty();
+ }
+
List<T> unnamed = <T>[];
Map<SourceString, T> named = new Map<SourceString, T>();
signature.forEachRequiredParameter((Element element) {
@@ -2295,6 +2300,7 @@
null,
sideEffects,
inLoop);
+ return inferrer.returnTypeOfElement(element);
}
T visitReturn(Return node) {
@@ -2307,8 +2313,8 @@
// the send is just a property access. Therefore we must
// manually create the [ArgumentsTypes] of the call, and
// manually register [analyzedElement] as a caller of [element].
- synthesizeForwardingCall(node.expression, element);
- recordReturnType(inferrer.returnTypeOfElement(element));
+ T mask = synthesizeForwardingCall(node.expression, element);
+ recordReturnType(mask);
}
} else {
Node expression = node.expression;

Powered by Google App Engine
This is Rietveld 408576698