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

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

Issue 14049010: Take noSuchMethod into account when computing the potential targets of a call. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 21607)
+++ sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart (working copy)
@@ -622,7 +622,12 @@
}
TypeMask typeOfElementWithSelector(Element element, Selector selector) {
- if (selector.isGetter()) {
+ if (element.name == Compiler.NO_SUCH_METHOD
+ && selector.name != element.name) {
+ // An invocation can resolve to a [noSuchMethod], in which case
+ // we get the return type of [noSuchMethod].
+ return returnTypeOfElement(element);
+ } else if (selector.isGetter()) {
if (element.isFunction()) {
// [functionType] is null if the inferrer did not run.
return functionType == null ? dynamicType : functionType;
@@ -745,6 +750,10 @@
void updateArgumentsType(FunctionElement element) {
assert(hasAnalyzedAll);
if (methodsThatCanBeClosurized.contains(element)) return;
+ // A [noSuchMethod] method can be the target of any call, with
+ // any number of arguments. For simplicity, we just do not
+ // infer any parameter types for [noSuchMethod].
+ if (element.name == Compiler.NO_SUCH_METHOD) return;
FunctionSignature signature = element.computeSignature(compiler);
if (typeOfArguments[element].isEmpty) {

Powered by Google App Engine
This is Rietveld 408576698