Files
sdk/tests/lib/mirrors/static_members_test.dart
T
Johnni Winther 645f3acca7 [cfe] Update greatest closure of ? to Object?
Closes #41386

Change-Id: I1a5a4cdc35cef37c7a8ba6a6aecb99457789bcdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144940
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-05-04 08:14:43 +00:00

41 lines
1.3 KiB
Dart

// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library test.static_members;
import 'dart:mirrors';
import 'package:expect/expect.dart';
import 'stringify.dart';
import 'declarations_model.dart' as declarations_model;
selectKeys<K, V>(Map<K, V> map, bool Function(V) predicate) {
return map.keys.where((K key) => predicate(map[key] as V));
}
main() {
ClassMirror cm = reflectClass(declarations_model.Class);
LibraryMirror lm = cm.owner as LibraryMirror;
Expect.setEquals([
#staticVariable,
const Symbol('staticVariable='),
#staticGetter,
const Symbol('staticSetter='),
#staticMethod,
MirrorSystem.getSymbol('_staticVariable', lm),
MirrorSystem.getSymbol('_staticVariable=', lm),
MirrorSystem.getSymbol('_staticGetter', lm),
MirrorSystem.getSymbol('_staticSetter=', lm),
MirrorSystem.getSymbol('_staticMethod', lm),
], selectKeys(cm.staticMembers, (dm) => true));
Expect.setEquals([
#staticVariable,
const Symbol('staticVariable='),
MirrorSystem.getSymbol('_staticVariable', lm),
MirrorSystem.getSymbol('_staticVariable=', lm)
], selectKeys(cm.staticMembers, (dynamic dm) => dm.isSynthetic));
}