-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ClassMirror.superinterfaces throws UnimplementedError on dart2js #11863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Set owner to @peter-ahe-google. |
Issue #12055 has been merged into this issue. cc @justinfagnani. |
Removed Priority-Unassigned label. |
@justin, just to make sure we're on the same page, high priority is for the "superclass" issue, not the "superinterfaces" ? |
It should be for both. If you're looking up a member in a class you need to visit the superclass and superinterfaces. |
Short term, what would be the purpose of searching the interfaces? The members of a class are determined by itself and its superclasses, not its interfaces. |
I use superinterfaces to look up members that aren't in the implementation, because they could be implemented via noSuchMethod. This of course won't work for classes that "implement" methods via nSM that aren't declared, but it's the best I can do for now. |
Marked this as blocking #6490. |
Added Started label. |
Added Accepted label. |
https://codereview.chromium.org/23226002 Added Started label. |
Fixed in r26185. Added Fixed label. |
splitting this out of https://code.google.com/p/dart/issues/detail?id=9434
// test program:
library test;
import 'dart:mirrors';
class FooMixin {
foo() => print('foo');
}
class Qux {
qux() => print('qux');
}
class Bar extends Qux implements FooMixin {
bar() => print('bar');
foo() => print('foo');
}
main() {
var b = new Bar()..foo()..bar()..qux();
var mirror = reflect(b);
for (var type = mirror.type;
// Note: checking qualifiedName here to workaround bugs with the superclass of Object
type.qualifiedName != const Symbol('dart.core.Object');
type = type.superclass) {
print('> ${type.qualifiedName}');
for (var i in type.superinterfaces) {
print(' + ${i.qualifiedName}');
}
}
}
// output:
$ dart2js ~/scratch/test.dart && ./third_party/d8/linux/d8 out.js
Dart file ~/scratch/test.dart compiled to JavaScript: out.js
foo
bar
qux
> Symbol("test.Bar")
out.js:4723: UnimplementedError
throw $.wrapException(ex);
^
Error
at wrapException (out.js:4713:11)
at throwExpression (out.js:4723:11)
at JsClassMirror.get$superinterfaces (out.js:9144:14)
at Closure$main.main as call$0
at _IsolateContext.eval$1 (out.js:1983:21)
at startRootIsolate (out.js:3153:15)
at out.js:27682:7
$ dart ~/scratch/test.dart
foo
bar
qux
> Symbol("test.Bar")
+ Symbol("test.FooMixin")
> Symbol("test.Qux")
The text was updated successfully, but these errors were encountered: