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

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, 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/include/dart_api.h » ('j') | runtime/lib/mirrors_impl.dart » ('J')
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 * If the [InstanceMirror] reflects an instance it is meaningful to have a 150 * If the [InstanceMirror] reflects an instance it is meaningful to have a
151 * local reference to, we provide access to the actual instance here. 151 * local reference to, we provide access to the actual instance here.
152 * 152 *
153 * If you access [reflectee] when [hasReflectee] is false, an 153 * If you access [reflectee] when [hasReflectee] is false, an
154 * exception is thrown. 154 * exception is thrown.
155 */ 155 */
156 final reflectee; 156 final reflectee;
157 } 157 }
158 158
159 /** 159 /**
160 * A [ClosureMirror] reflects a closure. Closures are special, because we do not
161 * wish to reflect the internals of a particular closure implementation. And
162 * yet, we need access to details of the closure internals - for example, its
163 * enclosing context and its source code.
164 */
165 interface ClosureMirror extends InstanceMirror {
166
167 /**
168 * Return the source code for the closure, if available.
169 */
170 String source();
171
172 /**
173 * Call the closure. The arguments given in the descriptor need to be
174 * ObjectMirrors or values. Asynchronous.
175 */
176 Future<ObjectMirror> apply(List<Object> positionalArguments,
177 [Map<String,Object> namedArguments]);
178
179 /**
180 * Look up the value of name in the scope of the closure. The result is a
181 * mirror on that value. Asynchronous.
182 */
183 Future<ObjectMirror> findInContext(String name);
184
185 /**
186 * Return a mirror on the function of this closure.
187 */
188 MethodMirror function();
189 }
190
191 /**
160 * A [TypeMirror] reflects a Dart language class, interface, typedef 192 * A [TypeMirror] reflects a Dart language class, interface, typedef
161 * or type variable. 193 * or type variable.
162 */ 194 */
163 interface TypeMirror extends Mirror { 195 interface TypeMirror extends Mirror {
164 /** 196 /**
165 * The library in which this interface is declared. 197 * The library in which this interface is declared.
166 */ 198 */
167 final LibraryMirror library; 199 final LibraryMirror library;
168 } 200 }
169 201
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 531
500 /** 532 /**
501 * A [MirrorException] is used to indicate errors within the mirrors 533 * A [MirrorException] is used to indicate errors within the mirrors
502 * framework. 534 * framework.
503 */ 535 */
504 class MirrorException implements Exception { 536 class MirrorException implements Exception {
505 const MirrorException(String this._message); 537 const MirrorException(String this._message);
506 String toString() => "MirrorException: '$_message'"; 538 String toString() => "MirrorException: '$_message'";
507 final String _message; 539 final String _message;
508 } 540 }
OLDNEW
« no previous file with comments | « no previous file | runtime/include/dart_api.h » ('j') | runtime/lib/mirrors_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698