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

Side by Side Diff: lib/mirrors/mirrors.dart

Issue 10800065: Added ClosureMirror to dart:mirrors. Added Dart_ClosureFunction to the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/include/dart_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // #library("mirrors"); 5 // #library("mirrors");
6 6
7 // The dart:mirrors library provides reflective access for Dart program. 7 // The dart:mirrors library provides reflective access for Dart program.
8 // 8 //
9 // For the purposes of the mirrors library, we adopt a naming 9 // For the purposes of the mirrors library, we adopt a naming
10 // convention with respect to getters and setters. Specifically, for 10 // convention with respect to getters and setters. Specifically, for
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 * If the [InstanceMirror] reflects an instance it is meaningful to have a 163 * If the [InstanceMirror] reflects an instance it is meaningful to have a
164 * local reference to, we provide access to the actual instance here. 164 * local reference to, we provide access to the actual instance here.
165 * 165 *
166 * If you access [reflectee] when [hasReflectee] is false, an 166 * If you access [reflectee] when [hasReflectee] is false, an
167 * exception is thrown. 167 * exception is thrown.
168 */ 168 */
169 final reflectee; 169 final reflectee;
170 } 170 }
171 171
172 /** 172 /**
173 * A [ClosureMirror] reflects a closure. Closures are special, because we do not
174 * wish to reflect the internals of a particular closure implementation. And
175 * yet, we need access to details of the closure internals - for example, its
176 * enclosing context and its source code.
177 */
178 interface ClosureMirror extends InstanceMirror {
179
180 /**
181 * Return the source code for the closure, if available.
182 */
183 String source();
184
185 /**
186 * Call the closure. The arguments given in the descriptor need to be
187 * ObjectMirrors or values. Asynchronous.
188 */
189 Future<ObjectMirror> apply(List<Object> positionalArguments,
190 [Map<String,Object> namedArguments]);
191
192 /**
193 * Look up the value of name in the scope of the closure. The result is a
194 * mirror on that value. Asynchronous.
195 */
196 Future<ObjectMirror> findInContext(String name);
197
198 /**
199 * Return a mirror on the function of this closure.
200 */
201 MethodMirror function();
202 }
203
204 /**
173 * A [TypeMirror] reflects a Dart language class, interface, typedef 205 * A [TypeMirror] reflects a Dart language class, interface, typedef
174 * or type variable. 206 * or type variable.
175 */ 207 */
176 interface TypeMirror extends Mirror { 208 interface TypeMirror extends Mirror {
177 /** 209 /**
178 * The library in which this interface is declared. 210 * The library in which this interface is declared.
179 */ 211 */
180 final LibraryMirror library; 212 final LibraryMirror library;
181 } 213 }
182 214
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 544
513 /** 545 /**
514 * A [MirrorException] is used to indicate errors within the mirrors 546 * A [MirrorException] is used to indicate errors within the mirrors
515 * framework. 547 * framework.
516 */ 548 */
517 class MirrorException implements Exception { 549 class MirrorException implements Exception {
518 const MirrorException(String this._message); 550 const MirrorException(String this._message);
519 String toString() => "MirrorException: '$_message'"; 551 String toString() => "MirrorException: '$_message'";
520 final String _message; 552 final String _message;
521 } 553 }
OLDNEW
« no previous file with comments | « no previous file | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698