4b7d256a06
This reverts commite9ca6a5335andd3e00fd35e. Change-Id: I346d6156be19c4fceffa202a7ce9bfa931c7c14b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99560 Reviewed-by: Sigmund Cherem <sigmund@google.com> Reviewed-by: Vijay Menon <vsm@google.com> Reviewed-by: Siva Annamalai <asiva@google.com>
50 lines
1.9 KiB
Plaintext
50 lines
1.9 KiB
Plaintext
library;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "dart:mirrors" as mir;
|
|
|
|
import "dart:mirrors";
|
|
|
|
class _FailingTest extends core::Object {
|
|
const constructor •() → self::_FailingTest
|
|
: super core::Object::•()
|
|
;
|
|
}
|
|
class MyTest extends core::Object {
|
|
synthetic constructor •() → self::MyTest
|
|
: super core::Object::•()
|
|
;
|
|
@self::failingTest
|
|
method foo() → void {}
|
|
}
|
|
abstract class _MyTest2&Object&MyTest = core::Object with self::MyTest {
|
|
const synthetic constructor •() → self::_MyTest2&Object&MyTest
|
|
: super core::Object::•()
|
|
;
|
|
}
|
|
class MyTest2 extends self::_MyTest2&Object&MyTest {
|
|
synthetic constructor •() → self::MyTest2
|
|
: super self::_MyTest2&Object&MyTest::•()
|
|
;
|
|
}
|
|
static const field self::_FailingTest failingTest = const self::_FailingTest::•();
|
|
static method main() → dynamic {
|
|
mir::ClassMirror classMirror = mir::reflectClass(self::MyTest2);
|
|
classMirror.{mir::ClassMirror::instanceMembers}.{core::Map::forEach}((core::Symbol symbol, mir::MethodMirror memberMirror) → core::Null {
|
|
if(memberMirror.{mir::DeclarationMirror::simpleName}.{core::Symbol::==}(#foo)) {
|
|
core::print(memberMirror);
|
|
core::print(self::_hasFailingTestAnnotation(memberMirror));
|
|
}
|
|
});
|
|
}
|
|
static method _hasFailingTestAnnotation(mir::MethodMirror method) → core::bool {
|
|
core::bool 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.{mir::DeclarationMirror::metadata}.{core::Iterable::any}((mir::InstanceMirror annotation) → core::bool {
|
|
core::print("annotation: ${annotation.{mir::InstanceMirror::reflectee}}");
|
|
return core::identical(annotation.{mir::InstanceMirror::reflectee}, instance);
|
|
});
|