5ecd78222e
Fixes #33099 Bug: http://dartbug.com/33099 Change-Id: I291e75fa49fb6bf62557cfeab0c874c5de9b618d Reviewed-on: https://dart-review.googlesource.com/57264 Commit-Queue: Dmitry Stefantsov <dmitryas@google.com> Reviewed-by: Kevin Millikin <kmillikin@google.com>
45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
library;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "dart:mirrors" as mir;
|
|
|
|
class _FailingTest extends core::Object {
|
|
const constructor •() → void
|
|
: super core::Object::•()
|
|
;
|
|
}
|
|
class MyTest extends core::Object {
|
|
synthetic constructor •() → void
|
|
: super core::Object::•()
|
|
;
|
|
@self::failingTest
|
|
method foo() → void {}
|
|
}
|
|
abstract class _MyTest2&Object&MyTest = core::Object with self::MyTest {
|
|
}
|
|
class MyTest2 extends self::_MyTest2&Object&MyTest {
|
|
synthetic constructor •() → void
|
|
: super core::Object::•()
|
|
;
|
|
}
|
|
static const field self::_FailingTest failingTest = const self::_FailingTest::•();
|
|
static method main() → dynamic {
|
|
mir::ClassMirror classMirror = mir::reflectClass(self::MyTest2);
|
|
classMirror.instanceMembers.forEach((core::Symbol symbol, mir::MethodMirror memberMirror) → dynamic {
|
|
if(memberMirror.simpleName.==(#foo)) {
|
|
core::print(memberMirror);
|
|
core::print(self::_hasFailingTestAnnotation(memberMirror));
|
|
}
|
|
});
|
|
}
|
|
static method _hasFailingTestAnnotation(mir::MethodMirror method) → core::bool {
|
|
dynamic r = self::_hasAnnotationInstance(method, self::failingTest);
|
|
core::print("[_hasFailingTestAnnotation] ${method} ${r}");
|
|
return r;
|
|
}
|
|
static method _hasAnnotationInstance(mir::DeclarationMirror declaration, dynamic instance) → core::bool
|
|
return declaration.metadata.any((mir::InstanceMirror annotation) → dynamic {
|
|
core::print("annotation: ${annotation.reflectee}");
|
|
return core::identical(annotation.reflectee, instance);
|
|
});
|