| 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);
|
| +}
|
| +
|
|
|