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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 22914017: Implement MethodMirror.isOperator (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors_impl.dart
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index 88a89cc5a2f220466eb79773bbcc1d36b80ca401..72d96499c7f5193e7963982b16b1765b6aa84bcd 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -924,7 +924,22 @@ class _LocalMethodMirrorImpl extends _LocalDeclarationMirrorImpl
this.isGenerativeConstructor,
this.isRedirectingConstructor,
this.isFactoryConstructor)
- : super(reflectee, _s(simpleName));
+ : this.isOperator = _operators.contains(simpleName),
+ super(reflectee, _s(simpleName));
+
+ static const _operators = const ["%", "&", "*", "+", "-", "/", "<", "<<",
+ "<=", "==", ">", ">=", ">>", "[]", "[]=", "^", "|", "~", "unary-", "~/"];
+
+ final bool isStatic;
+ final bool isAbstract;
+ final bool isGetter;
+ final bool isSetter;
+ final bool isConstructor;
+ final bool isConstConstructor;
+ final bool isGenerativeConstructor;
+ final bool isRedirectingConstructor;
+ final bool isFactoryConstructor;
+ final bool isOperator;
DeclarationMirror _owner;
DeclarationMirror get owner {
@@ -969,20 +984,8 @@ class _LocalMethodMirrorImpl extends _LocalDeclarationMirrorImpl
return _parameters;
}
- final bool isStatic;
- final bool isAbstract;
-
bool get isRegularMethod => !isGetter && !isSetter && !isConstructor;
- TypeMirror get isOperator {
- throw new UnimplementedError(
- 'MethodMirror.isOperator is not implemented');
- }
-
- final bool isGetter;
- final bool isSetter;
- final bool isConstructor;
-
Symbol _constructorName = null;
Symbol get constructorName {
if (_constructorName == null) {
@@ -1004,11 +1007,6 @@ class _LocalMethodMirrorImpl extends _LocalDeclarationMirrorImpl
return _constructorName;
}
- final bool isConstConstructor;
- final bool isGenerativeConstructor;
- final bool isRedirectingConstructor;
- final bool isFactoryConstructor;
-
String toString() => "MethodMirror on '${_n(simpleName)}'";
static dynamic _MethodMirror_owner(reflectee)
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698