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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 19299003: Moved some MethodMirror properties from embedded API to native calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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: runtime/lib/mirrors_impl.dart
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index 838af66094bca44edbd6b662882145e3475d349e..d95878edee13a8f6af8ce2cc0eeac10ea1386a20 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -867,19 +867,17 @@ class _LocalMethodMirrorImpl extends _LocalMirrorImpl
_LocalMethodMirrorImpl(this._reflectee,
this._owner,
this.parameters,
- this._returnType,
- this.isStatic,
- this.isAbstract,
- this.isGetter,
- this.isSetter,
- this.isConstructor,
- this.isConstConstructor,
- this.isGenerativeConstructor,
- this.isRedirectingConstructor,
- this.isFactoryConstructor);
+ this._returnType);
final _MirrorReference _reflectee;
+ // Keep in sync with MethodMirrorProperty in mirrors.cc.
+ static const int _propertyIsStatic = 0;
+ static const int _propertyIsAbstract = 1;
+ static const int _propertyIsGetter = 2;
+ static const int _propertyIsSetter = 3;
+ static const int _propertyIsConstructor = 4;
+
Symbol _simpleName = null;
Symbol get simpleName {
if (_simpleName == null) {
@@ -926,8 +924,21 @@ class _LocalMethodMirrorImpl extends _LocalMirrorImpl
final List<ParameterMirror> parameters;
- final bool isStatic;
- final bool isAbstract;
+ bool _isStatic = null;
+ bool get isStatic {
+ if (_isStatic == null) {
+ _isStatic = _MethodMirror_get_property(_reflectee, _propertyIsStatic);
+ }
+ return _isStatic;
+ }
+
+ bool _isAbstract;
+ bool get isAbstract {
+ if (_isAbstract == null) {
+ _isAbstract = _MethodMirror_get_property(_reflectee, _propertyIsAbstract);
+ }
+ return _isAbstract;
+ }
bool get isRegularMethod => !isGetter && !isSetter && !isConstructor;
@@ -936,9 +947,30 @@ class _LocalMethodMirrorImpl extends _LocalMirrorImpl
'MethodMirror.isOperator is not implemented');
}
- final bool isGetter;
- final bool isSetter;
- final bool isConstructor;
+ bool _isGetter = null;
+ bool get isGetter {
+ if (_isGetter == null) {
+ _isGetter = _MethodMirror_get_property(_reflectee, _propertyIsGetter);
+ }
+ return _isGetter;
+ }
+
+ bool _isSetter = null;
+ bool get isSetter {
+ if (_isSetter == null) {
+ _isSetter = _MethodMirror_get_property(_reflectee, _propertyIsSetter);
+ }
+ return _isSetter;
+ }
+
+ bool _isConstructor = null;
+ bool get isConstructor {
+ if (_isConstructor == null) {
+ _isConstructor = _MethodMirror_get_property(_reflectee,
+ _propertyIsConstructor);
+ }
+ return _isConstructor;
+ }
Symbol _constructorName = null;
Symbol get constructorName {
@@ -961,10 +993,11 @@ class _LocalMethodMirrorImpl extends _LocalMirrorImpl
return _constructorName;
}
- final bool isConstConstructor;
- final bool isGenerativeConstructor;
- final bool isRedirectingConstructor;
- final bool isFactoryConstructor;
+ // TODO(mlippautz): Implement constructor kinds.
+ final bool isConstConstructor = false;
+ final bool isGenerativeConstructor = false;
+ final bool isRedirectingConstructor = false;
+ final bool isFactoryConstructor = false;
List<InstanceMirror> get metadata {
owner; // ensure owner is computed
@@ -977,6 +1010,9 @@ class _LocalMethodMirrorImpl extends _LocalMirrorImpl
static String _MethodMirror_name(reflectee)
native "MethodMirror_name";
+
+ static bool _MethodMirror_get_property(reflectee, property)
+ native "MethodMirror_get_property";
}
class _LocalVariableMirrorImpl extends _LocalMirrorImpl

Powered by Google App Engine
This is Rietveld 408576698