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

Unified Diff: mirrors/reflective_change.dart

Issue 9007019: Revised Mirrors proposal/take 3. (Closed) Base URL: http://dart.googlecode.com/svn/experimental/
Patch Set: Created 9 years 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
« mirrors/introspection.dart ('K') | « mirrors/introspection.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mirrors/reflective_change.dart
===================================================================
--- mirrors/reflective_change.dart (revision 0)
+++ mirrors/reflective_change.dart (revision 0)
@@ -0,0 +1,104 @@
+#library("reflective_change");
+#import("introspection.dart");
+
+
+/**
+Install the libraries described by libs into isolate's reflectee in one
+atomic step.
+
+An exception is thrown if the target isolate is not suspended.
+An exception may be thrown if any of the code described in libs would cause
+a compile-time error. If an exception is thrown, none of the code is installed.
+
+This is an asynchronous method.
+
+*/
+void install(List<LibraryMirrorBuilder> libs, IsolateMirror isolate) {
+
+}
+
+/**
+A builder for libraries.
+
+One can describe a library either via source or by supplying its imports and
+declarations explicitly.
+There is no distinction between different kinds of declarations, as the mirror builders provided
+are self-describing.
+*/
+interface LibraryDeclarationBuilder {
+
+/**
+Create a builder for a library whose code is identical to that of the reflectee of
+the argument mirror m.
+*/
+ LibraryDeclartionBuilder.fromMirror(LibraryDeclarationMirror m);
+
+/** Create a builder for a library named sname.
+
+*/
+ LibraryDeclarationBuilder.named(String sname);
+
+ String simpleName();
+ Map declarations();
+
+ Map<Object, String> imports();
+ String source();
+}
+
+/** Allows for building types */
+interface TypeMirrorBuilder {
+ String simpleName;
+
+/** if this is empty, this is a non-parameterized type */
+ final Map<Object, TypeMirrorBuilder> typeArguments;
+ TypeMirrorBuilder(String this.simpleName, [List<TypeMirrorBuilder> tas]):
+ typeArguments = tas === null ? new Map<Object, TypeMirrorBuilder>() :makeTypeArgs(tas);
+ static Map<Object, TypeMirrorBuilder> makeTypeArgs(List<TypeMirrorBuilder> tas){
+ // fill in
+ }
+}
+
+
+/** Describes a type under construction, prior to installation.
+There is no ClassDeclarationBuilder - to keep the API manageable, we use this class for constructing both
+classes and interfaces.
+*/
+interface InterfaceDeclarationBuilder {
+ String simpleName;
+
+
+/** Create a builder that describes the same code as the argument mirror m. */
+ InterfaceDeclarationBuilder.fromMirror(InterfaceDeclarationMirror m);
+
+/** Create a builder for a class or interface named sname.
+
+*/
+ InterfaceDeclarationBuilder.named(String sname); /*:
+ simpleName = sname, members = new Map(),
+ superinterfaces = new Map<Object, TypeMirrorBuilder>(),
+ typeParameters = new Map<Object, TypeMirrorBuilder>();
+*/
+
+/** Allows for adding all kinds of members;
+ The mirror builders provided are self-describing */
+ final List<Object, MethodMirrorBuilder> members;
+
+ final Map<Object, TypeMirrorBuilder> superinterfaces;
+
+ /** If this is an interface, always return an InterfaceMirror for Object.*/
+ TypeMirror superclass;
+
+ final Map<Object, TypeMirrorBuilder> typeParameters;
+
+ /** Return true iff this represents an actual class */
+ bool isClass;
+}
+
+
+/**
+Do we need this? It seems to just wrap the source code for a function.
+*/
+class MethodMirrorBuilder {
+ MethodMirrorBuilder(String src);
+}
+
« mirrors/introspection.dart ('K') | « mirrors/introspection.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698