mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:51:18 +00:00
Support generic methods in reflection.
Closes #28240 R=sigmund@google.com Review-Url: https://codereview.chromium.org/2613433002 .
This commit is contained in:
parent
a510d4fd3e
commit
72e3e0c006
|
@ -679,11 +679,14 @@ class ReflectionInfo {
|
|||
if (JS('bool', 'typeof # == "number"', functionType)) {
|
||||
return getType(functionType);
|
||||
} else if (JS('bool', 'typeof # == "function"', functionType)) {
|
||||
var fakeInstance = JS('', 'new #()', jsConstructor);
|
||||
setRuntimeTypeInfo(
|
||||
fakeInstance, JS('JSExtendableArray', '#["<>"]', fakeInstance));
|
||||
return JS('=Object|Null', r'#.apply({$receiver:#})',
|
||||
functionType, fakeInstance);
|
||||
if (jsConstructor != null) {
|
||||
var fakeInstance = JS('', 'new #()', jsConstructor);
|
||||
setRuntimeTypeInfo(
|
||||
fakeInstance, JS('JSExtendableArray', '#["<>"]', fakeInstance));
|
||||
return JS('=Object|Null', r'#.apply({$receiver:#})',
|
||||
functionType, fakeInstance);
|
||||
}
|
||||
return functionType;
|
||||
} else {
|
||||
throw new RuntimeError('Unexpected function type');
|
||||
}
|
||||
|
|
|
@ -121,4 +121,4 @@ constant_javascript_semantics2_test: Pass, Slow # Issue 25940
|
|||
consistent_index_error_string_test: Pass, Slow # Issue 25940
|
||||
|
||||
[ $compiler == dart2js ]
|
||||
mirror_printer_test: Fail # Issue 28240, was: Pass, Slow # Issue 25940, 16473
|
||||
mirror_printer_test: Pass, Slow # Issue 25940, 16473
|
||||
|
|
|
@ -20,8 +20,7 @@ import 'dart:mirrors';
|
|||
import 'crash_library_metadata.dart'; // This would crash dart2js.
|
||||
|
||||
// Importing dart:html to make things interesting.
|
||||
// TODO(johnniwinther): Reenable this when #28240 has been fixed.
|
||||
// import 'dart:html';
|
||||
import 'dart:html'; /// 01: ok
|
||||
|
||||
class MirrorPrinter {
|
||||
final StringBuffer buffer;
|
||||
|
@ -186,5 +185,5 @@ main() {
|
|||
print(MirrorPrinter.stringify(currentMirrorSystem().libraries));
|
||||
// Clear the nodes to avoid confusing the fine test framework (by "fine" I
|
||||
// mean something else) -- ahe.
|
||||
document.body.nodes.clear();
|
||||
document.body.nodes.clear(); /// 01: continued
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue