| Index: sdk/lib/_internal/lib/js_mirrors.dart
|
| diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart
|
| index 4b46cb21c990321c060762188845559effa11e2e..e74a97306d3d93265bf37023c74368a5e37b6f3f 100644
|
| --- a/sdk/lib/_internal/lib/js_mirrors.dart
|
| +++ b/sdk/lib/_internal/lib/js_mirrors.dart
|
| @@ -2797,3 +2797,31 @@ class UnmodifiableMapView<K, V> implements Map<K, V> {
|
|
|
| void clear() => _throw();
|
| }
|
| +
|
| +Symbol getSymbol(String name, LibararyMirror library) {
|
| + if (_isPublicSymbol(name)) {
|
| + return new _symbol_dev.Symbol.validated(name);
|
| + }
|
| + if (library == null) {
|
| + throw new ArgumentError(
|
| + "Library required for private symbol name: $name");
|
| + }
|
| + if (!_symbol_dev.Symbol.validatePrivate(name)) {
|
| + throw new ArgumentError("Not a valid symbol name: $name");
|
| + }
|
| + throw new UnimplementedError(
|
| + "MirrorSystem.getSymbol not implemented for private names");
|
| +}
|
| +
|
| +bool _isPublicSymbol(String name) {
|
| + // A symbol is public if it doesn't start with '_' and it doesn't
|
| + // have a part (following a '.') that starts with '_'.
|
| + const int UNDERSCORE = 0x5f;
|
| + if (name.isEmpty) return true;
|
| + int index = -1;
|
| + do {
|
| + if (name.codeUnitAt(index + 1) == UNDERSCORE) return false;
|
| + index = name.indexOf('.', index + 1);
|
| + } while (index >= 0 && index + 1 < name.length);
|
| + return true;
|
| +}
|
|
|