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

Unified Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2975273002: fix #30108, mock support for callable classes (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/dev_compiler/test/not_yet_strong_tests.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/lib/src/compiler/code_generator.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
index 75535faa7df093f1237ef6cac8eba245a83acf35..10c1659f81581c83c0dec373214bfd3401552acd 100644
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
@@ -1838,8 +1838,12 @@ class CodeGenerator extends Object
//
// For the same reason, we can ignore "noSuchMethod".
// call-implemented-by-nSM will be dispatched by dcall at runtime.
vsm 2017/07/14 14:19:56 Remove or update the two lines above?
Jennifer Messerly 2017/07/14 18:40:20 they're still accurate but i'll try and clarify:
- bool isCallable = classElem.lookUpMethod('call', null) != null ||
- classElem.lookUpGetter('call', null)?.returnType is FunctionType;
+ // For classes that implement a callable interface with nSM, we'll find
+ // the "call" when we search the type for inherited "call" members.
+ var callMethod = classElem.type.lookUpInheritedGetterOrMethod('call');
+ bool isCallable = callMethod is PropertyAccessorElement
+ ? callMethod.returnType is FunctionType
+ : callMethod != null;
var body = <JS.Statement>[];
void addConstructor(ConstructorElement element, JS.Expression jsCtor) {
« no previous file with comments | « no previous file | pkg/dev_compiler/test/not_yet_strong_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698