OLD | NEW |
(Empty) | |
| 1 #library("reflective_change"); |
| 2 #import("introspection.dart"); |
| 3 |
| 4 |
| 5 /** |
| 6 Install the libraries described by libs into isolate's reflectee in one |
| 7 atomic step. |
| 8 |
| 9 An exception is thrown if the target isolate is not suspended. |
| 10 An exception may be thrown if any of the code described in libs would cause |
| 11 a compile-time error. If an exception is thrown, none of the code is installed. |
| 12 |
| 13 This is an asynchronous method. |
| 14 |
| 15 */ |
| 16 void install(List<LibraryMirrorBuilder> libs, IsolateMirror isolate) { |
| 17 |
| 18 } |
| 19 |
| 20 /** |
| 21 A builder for libraries. |
| 22 |
| 23 One can describe a library either via source or by supplying its imports and |
| 24 declarations explicitly. |
| 25 There is no distinction between different kinds of declarations, as the mirror b
uilders provided |
| 26 are self-describing. |
| 27 */ |
| 28 interface LibraryDeclarationBuilder { |
| 29 |
| 30 /** |
| 31 Create a builder for a library whose code is identical to that of the reflectee
of |
| 32 the argument mirror m. |
| 33 */ |
| 34 LibraryDeclartionBuilder.fromMirror(LibraryDeclarationMirror m); |
| 35 |
| 36 /** Create a builder for a library named sname. |
| 37 |
| 38 */ |
| 39 LibraryDeclarationBuilder.named(String sname); |
| 40 |
| 41 String simpleName(); |
| 42 Map declarations(); |
| 43 |
| 44 Map<Object, String> imports(); |
| 45 String source(); |
| 46 } |
| 47 |
| 48 /** Allows for building types */ |
| 49 interface TypeMirrorBuilder { |
| 50 String simpleName; |
| 51 |
| 52 /** if this is empty, this is a non-parameterized type */ |
| 53 final Map<Object, TypeMirrorBuilder> typeArguments; |
| 54 TypeMirrorBuilder(String this.simpleName, [List<TypeMirrorBuilder> tas]): |
| 55 typeArguments = tas === null ? new Map<Object, TypeMirrorBuilder>() :makeTy
peArgs(tas); |
| 56 static Map<Object, TypeMirrorBuilder> makeTypeArgs(List<TypeMirrorBuilder> tas
){ |
| 57 // fill in |
| 58 } |
| 59 } |
| 60 |
| 61 |
| 62 /** Describes a type under construction, prior to installation. |
| 63 There is no ClassDeclarationBuilder - to keep the API manageable, we use this cl
ass for constructing both |
| 64 classes and interfaces. |
| 65 */ |
| 66 interface InterfaceDeclarationBuilder { |
| 67 String simpleName; |
| 68 |
| 69 |
| 70 /** Create a builder that describes the same code as the argument mirror m. */ |
| 71 InterfaceDeclarationBuilder.fromMirror(InterfaceDeclarationMirror m); |
| 72 |
| 73 /** Create a builder for a class or interface named sname. |
| 74 |
| 75 */ |
| 76 InterfaceDeclarationBuilder.named(String sname); /*: |
| 77 simpleName = sname, members = new Map(), |
| 78 superinterfaces = new Map<Object, TypeMirrorBuilder>(), |
| 79 typeParameters = new Map<Object, TypeMirrorBuilder>(); |
| 80 */ |
| 81 |
| 82 /** Allows for adding all kinds of members; |
| 83 The mirror builders provided are self-describing */ |
| 84 final List<Object, MethodMirrorBuilder> members; |
| 85 |
| 86 final Map<Object, TypeMirrorBuilder> superinterfaces; |
| 87 |
| 88 /** If this is an interface, always return an InterfaceMirror for Object.*/ |
| 89 TypeMirror superclass; |
| 90 |
| 91 final Map<Object, TypeMirrorBuilder> typeParameters; |
| 92 |
| 93 /** Return true iff this represents an actual class */ |
| 94 bool isClass; |
| 95 } |
| 96 |
| 97 |
| 98 /** |
| 99 Do we need this? It seems to just wrap the source code for a function. |
| 100 */ |
| 101 class MethodMirrorBuilder { |
| 102 MethodMirrorBuilder(String src); |
| 103 } |
| 104 |
OLD | NEW |