Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(896)

Unified Diff: reflectable/lib/src/reflectable_transformer_based.dart

Issue 1391013008: Adds limited support for private classes. (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Improved on treatment of uri Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: reflectable/lib/src/reflectable_transformer_based.dart
diff --git a/reflectable/lib/src/reflectable_transformer_based.dart b/reflectable/lib/src/reflectable_transformer_based.dart
index a7b3ef86eeff45fc55948c8fee52da0115c826ab..5db7da7c49e9263c3483945802de8d21aef6687c 100644
--- a/reflectable/lib/src/reflectable_transformer_based.dart
+++ b/reflectable/lib/src/reflectable_transformer_based.dart
@@ -109,7 +109,7 @@ class ReflectorData {
_typeToClassMirrorCache = new Map.fromIterables(types, classMirrors);
}
}
- return _typeToClassMirrorCache[type];
+ return _typeToClassMirrorCache[type];
}
}
@@ -499,14 +499,8 @@ class ClassMirrorImpl extends _DataCaching implements ClassMirror {
}
class LibraryMirrorImpl extends _DataCaching implements LibraryMirror {
- LibraryMirrorImpl(
- this.simpleName,
- this.uri,
- this._reflector,
- this._declarationIndices,
- this.getters,
- this.setters,
- this._metadata);
+ LibraryMirrorImpl(this.simpleName, this.uri, this._reflector,
+ this._declarationIndices, this.getters, this.setters, this._metadata);
final ReflectableImpl _reflector;
@@ -551,6 +545,11 @@ class LibraryMirrorImpl extends _DataCaching implements LibraryMirror {
_data.memberMirrors[declarationIndex];
result[declarationMirror.simpleName] = declarationMirror;
}
+ _data.classMirrors.forEach((ClassMirror classMirror) {
+ if (classMirror.owner == this) {
+ result[classMirror.simpleName] = classMirror;
+ }
+ });
_declarations =
new UnmodifiableMapView<String, DeclarationMirror>(result);
}
@@ -612,8 +611,15 @@ class LibraryMirrorImpl extends _DataCaching implements LibraryMirror {
@override
String get qualifiedName => simpleName;
- bool operator ==(other) => _unsupported();
- int get hashCode => _unsupported();
+ bool operator ==(other) {
+ return other is LibraryMirrorImpl &&
+ other.uri == uri &&
+ other._reflector == _reflector &&
+ other._declarationIndices == _declarationIndices;
+ }
+
+ int get hashCode =>
+ uri.hashCode ^ _reflector.hashCode ^ _declarationIndices.hashCode;
// TODO(sigurdm) implement: Need to implement this. Probably only when a given
// capability is enabled.
@@ -1255,8 +1261,8 @@ abstract class ReflectableImpl extends ReflectableBase
}
}
-// For mixin-applications we need to construct objects that represents their
-// type.
+// For mixin-applications and private classes we need to construct objects
+// that represents their type.
class FakeType implements Type {
const FakeType(this.description);
« no previous file with comments | « reflectable/lib/src/reflectable_mirror_based.dart ('k') | reflectable/lib/src/transformer_implementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698