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

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart

Issue 2852723002: dart:mirrors workaround for generic methods (Closed)
Patch Set: Created 3 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: pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart b/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
index 9b2d9052f689a60ff329ddcf66ea46022e7b77ed..40ba3c8aa366bd4fa59d872922f54b9c0ee852b4 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
@@ -81,6 +81,10 @@ dynamic _getMixins(type) {
return JS('', '#.getMixins(#, [])', _dart, type);
}
+dynamic _getFunctionType(type) {
+ return JS('', '#.getFunctionTypeMirror(#)', _dart, type);
+}
+
typedef T _Lazy<T>();
dynamic _getESSymbol(Symbol symbol) =>
@@ -627,11 +631,7 @@ class JsMethodMirror extends JsMirror implements MethodMirror {
// TODO(vsm): Handle generic function types properly. Or deprecate mirrors
// before we need to!
- if (JS('bool', 'typeof(#) == "function"', ftype)) {
- // Instantiate the generic version.
- // TODO(vsm): Can't use arguments.length on arrow function.
- ftype = JS('', '#.apply(null, #)', ftype, [dynamic, dynamic, dynamic]);
- }
+ ftype = _getFunctionType(ftype);
// TODO(vsm): Add named args.
List args = ftype.args;
« no previous file with comments | « pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart ('k') | tests/lib_strong/mirrors/generic_method_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698