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

Unified Diff: dart/sdk/lib/_internal/lib/js_mirrors.dart

Issue 18216002: Implement JsMethodMirror.constructorName. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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: dart/sdk/lib/_internal/lib/js_mirrors.dart
diff --git a/dart/sdk/lib/_internal/lib/js_mirrors.dart b/dart/sdk/lib/_internal/lib/js_mirrors.dart
index 3ddd2dc3261df11331986760505fb6cc72186596..1d1c8252fed426f891210c316e3cb13bec3450d8 100644
--- a/dart/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/dart/sdk/lib/_internal/lib/js_mirrors.dart
@@ -834,11 +834,20 @@ class JsMethodMirror extends JsDeclarationMirror implements MethodMirror {
return _metadata.map(reflect).toList();
}
+ Symbol get constructorName {
+ // TODO(ahe): I believe it is more appropriate to throw an exception or
+ // return null.
+ if (!isConstructor) return const Symbol('');
+ String name = n(simpleName);
+ int index = name.indexOf('.');
+ if (index == -1) return const Symbol('');
+ return s(name.substring(index + 1));
+ }
+
// TODO(ahe): Implement these.
bool get isAbstract => throw new UnimplementedError();
bool get isRegularMethod => throw new UnimplementedError();
bool get isOperator => throw new UnimplementedError();
- Symbol get constructorName => throw new UnimplementedError();
bool get isConstConstructor => throw new UnimplementedError();
bool get isGenerativeConstructor => throw new UnimplementedError();
bool get isRedirectingConstructor => throw new UnimplementedError();
« no previous file with comments | « no previous file | dart/tests/lib/mirrors/constructors_test.dart » ('j') | dart/tests/lib/mirrors/constructors_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698