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

Unified Diff: sdk/lib/mirrors/mirrors.dart

Issue 25741005: Implement ObjectMirror.[] (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix mistake in merge conflict Created 7 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: sdk/lib/mirrors/mirrors.dart
diff --git a/sdk/lib/mirrors/mirrors.dart b/sdk/lib/mirrors/mirrors.dart
index 0b9ebe52901ad6e493209ce56976a73721e9e9c7..2eef749cd6fcc279d039d618640e8043fcd74ffd 100644
--- a/sdk/lib/mirrors/mirrors.dart
+++ b/sdk/lib/mirrors/mirrors.dart
@@ -547,6 +547,30 @@ abstract class InstanceMirror implements ObjectMirror {
* invocation.namedArguments);
*/
delegate(Invocation invocation);
+
+ /**
+ * Returns a closure for invoking the regular method named [name].
+ *
+ * If [:type.instanceLookup(name):] returns a regular method, the result of
+ * this method is a closure equivalent to:
+ *
+ * (r1, .., rn, {p1: d1, ..., pk: dk}) {
ahe 2013/10/29 10:25:24 Change ".." (two periods) to "..." (three periods)
+ * return this.invoke(name, [r1, .., rn], {#p1: p1, .., #pk: pk});
+ * }
+ *
+ * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk
+ * with defaults d1, ..., dk. Otherwise, the result of this method is a
+ * closure equivalent to:
+ *
+ * (r1, .., rn, [p1 = d1, …, pk = dk]) {
ahe 2013/10/29 10:25:24 Change "…" (a single unicode character) to "..." (
+ * return this.invoke(name, [r1, .., rn, p1, .., pk]);
+ * }
+ *
+ * if m has required parameters r1, ..., rn, and optional positional
+ * parameters p1, ..., pk with defaults d1, ..., dk.
ahe 2013/10/29 10:25:24 What happens if [name] isn't a regular method?
+ */
+ Function operator [](Symbol name);
+
ahe 2013/10/29 10:25:24 Extra line.
}
/**
@@ -692,6 +716,27 @@ abstract class LibraryMirror implements DeclarationMirror, ObjectMirror {
* the same library in the same isolate.
*/
bool operator == (other);
+
+ /**
+ * If [:declarations[name]:] is a regular method, the result of this method
+ * is a closure equivalent to:
+ *
+ * (r1, .., rn, {p1: d1, ..., pk: dk}) {
ahe 2013/10/29 10:25:24 Change ".." (two periods) to "..." (three periods)
+ * return this.invoke(name, [r1, .., rn], {#p1: p1, .., #pk: pk});
+ * }
+ *
+ * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk
+ * with defaults d1, ..., dk. Otherwise, the result of this method is a
+ * closure equivalent to:
+ *
+ * (r1, .., rn, [p1 = d1, …, pk = dk]) {
ahe 2013/10/29 10:25:24 Change to three periods.
+ * return this.invoke(name, [r1, .., rn, p1, .., pk]);
+ * }
+ *
+ * if m has required parameters r1, ..., rn, and optional positional
+ * parameters p1, ..., pk with defaults d1, ..., dk.
ahe 2013/10/29 10:25:24 What happens if [name] isn't a regular method.
+ */
+ Function operator [](Symbol name);
}
/**
@@ -905,6 +950,27 @@ abstract class ClassMirror implements TypeMirror, ObjectMirror {
* and [other] have equal type arguments.
*/
bool operator == (other);
+
+ /**
+ * If [:declarations[name]:] is a regular method, the result of this method
+ * is a closure equivalent to:
+ *
+ * (r1, .., rn, {p1: d1, ..., pk: dk}) {
ahe 2013/10/29 10:25:24 Same period issues as above: Change ".." to "...",
+ * return this.invoke(name, [r1, .., rn], {#p1: p1, .., #pk: pk});
+ * }
+ *
+ * if m has required parameters r1, ..., rn, and named parameters p1, ..., pk
+ * with defaults d1, ..., dk. Otherwise, the result of this method is a
+ * closure equivalent to:
+ *
+ * (r1, .., rn, [p1 = d1, …, pk = dk]) {
+ * return this.invoke(name, [r1, .., rn, p1, .., pk]);
+ * }
+ *
+ * if m has required parameters r1, ..., rn, and optional positional
+ * parameters p1, ..., pk with defaults d1, ..., dk.
ahe 2013/10/29 10:25:24 What happens if [name] is not a regular method.
+ */
+ Function operator [](Symbol name);
}
/**

Powered by Google App Engine
This is Rietveld 408576698