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

Side by Side Diff: pkg/smoke/lib/smoke.dart

Issue 180273004: Fixes in smoke, which in turn should fix todomvc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 | « pkg/smoke/lib/mirrors.dart ('k') | pkg/smoke/lib/src/common.dart » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /// Collects services that can be used to access objects dynamically, inspect 5 /// Collects services that can be used to access objects dynamically, inspect
6 /// type information, and convert between symbols and strings. 6 /// type information, and convert between symbols and strings.
7 library smoke; 7 library smoke;
8 8
9 import 'src/implementation.dart' as implementation; 9 import 'src/implementation.dart' as implementation;
10 10
(...skipping 24 matching lines...) Expand all
35 /// Invoke [method] in [receiver] with [args]. The [receiver] can be either an 35 /// Invoke [method] in [receiver] with [args]. The [receiver] can be either an
36 /// object (to invoke instance methods) or a type (to invoke static methods). 36 /// object (to invoke instance methods) or a type (to invoke static methods).
37 /// This function optionally [adjust]s the list of arguments to match the number 37 /// This function optionally [adjust]s the list of arguments to match the number
38 /// of formal parameters by either adding nulls for missing arguments, or by 38 /// of formal parameters by either adding nulls for missing arguments, or by
39 /// truncating the list. 39 /// truncating the list.
40 invoke(receiver, Symbol method, List args, 40 invoke(receiver, Symbol method, List args,
41 {Map namedArgs, bool adjust: false}) => 41 {Map namedArgs, bool adjust: false}) =>
42 implementation.objectAccessor.invoke( 42 implementation.objectAccessor.invoke(
43 receiver, method, args, namedArgs: namedArgs, adjust: adjust); 43 receiver, method, args, namedArgs: namedArgs, adjust: adjust);
44 44
45 /// Tells whether [type] is transitively a subclass of [supertype].
46 bool isSubclassOf(Type type, Type supertype) =>
47 implementation.typeInspector.isSubclassOf(type, supertype);
48
49 // TODO(sigmund): consider adding also:
50 // * isImplementationOf(type, subtype) to tells whether [type] declares that it
51 // implements the [supertype] interface.
52 // * isSubtypeOf(type, subtype): Tells whether [type]'s interface is a sybtype
53 // of [supertype]. That is, whether it is a subclass or if [type] implements
54 // [supertype].
55
45 /// Tells whether [type] has a field or getter for [field]. 56 /// Tells whether [type] has a field or getter for [field].
46 bool hasGetter(Type type, Symbol field) => 57 bool hasGetter(Type type, Symbol field) =>
47 implementation.typeInspector.hasGetter(type, field); 58 implementation.typeInspector.hasGetter(type, field);
48 59
49 /// Tells whether [type] has a field or setter for [field]. 60 /// Tells whether [type] has a field or setter for [field].
50 bool hasSetter(Type type, Symbol field) => 61 bool hasSetter(Type type, Symbol field) =>
51 implementation.typeInspector.hasSetter(type, field); 62 implementation.typeInspector.hasSetter(type, field);
52 63
53 /// Tells whether [type] or a superclass (other than [Object]) defines 64 /// Tells whether [type] or a superclass (other than [Object]) defines
54 /// `noSuchMethod`. 65 /// `noSuchMethod`.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 final bool includeFields; 99 final bool includeFields;
89 100
90 /// Whether to include getters and setters (default is true). Note that to 101 /// Whether to include getters and setters (default is true). Note that to
91 /// include fields you also need to enable [includeFields]. 102 /// include fields you also need to enable [includeFields].
92 final bool includeProperties; 103 final bool includeProperties;
93 104
94 /// Whether to include symbols from the given type and its superclasses 105 /// Whether to include symbols from the given type and its superclasses
95 /// (except [Object]). 106 /// (except [Object]).
96 final bool includeInherited; 107 final bool includeInherited;
97 108
109 /// If [includeInherited], walk up the type hierarchy up to this type
110 /// (defaults to [Object]).
111 final Type includeUpTo;
112
98 /// Whether to include final fields and getter-only properties. 113 /// Whether to include final fields and getter-only properties.
99 final bool excludeFinal; 114 final bool excludeFinal;
100 115
101 /// Whether to include methods (default is false). 116 /// Whether to include methods (default is false).
102 final bool includeMethods; 117 final bool includeMethods;
103 118
104 /// If [withAnnotation] is not null, then it should be a list of types, so 119 /// If [withAnnotation] is not null, then it should be a list of types, so
105 /// only symbols that are annotated with instances of those types are 120 /// only symbols that are annotated with instances of those types are
106 /// included. 121 /// included.
107 final List withAnnotations; 122 final List withAnnotations;
108 123
109 const QueryOptions({ 124 const QueryOptions({
110 this.includeFields: true, 125 this.includeFields: true,
111 this.includeProperties: true, 126 this.includeProperties: true,
112 this.includeInherited: true, 127 this.includeInherited: true,
128 this.includeUpTo: Object,
113 this.excludeFinal: false, 129 this.excludeFinal: false,
114 this.includeMethods: false, 130 this.includeMethods: false,
115 this.withAnnotations: null}); 131 this.withAnnotations: null});
116 } 132 }
117 133
118 /// Information associated with a symbol declaration (like a property or 134 /// Information associated with a symbol declaration (like a property or
119 /// method). 135 /// method).
120 class Declaration { 136 class Declaration {
121 /// Name of the property or method 137 /// Name of the property or method
122 final Symbol name; 138 final Symbol name;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 /// Invoke [method] in [object] with [args]. It optionally [adjust]s the list 206 /// Invoke [method] in [object] with [args]. It optionally [adjust]s the list
191 /// of arguments to match the number of formal parameters by either adding 207 /// of arguments to match the number of formal parameters by either adding
192 /// nulls for missing arguments, or by truncating the list. 208 /// nulls for missing arguments, or by truncating the list.
193 invoke(Object object, Symbol method, List args, 209 invoke(Object object, Symbol method, List args,
194 {Map namedArgs, bool adjust: false}); 210 {Map namedArgs, bool adjust: false});
195 } 211 }
196 212
197 213
198 /// A service that provides partial inspection into Dart types. 214 /// A service that provides partial inspection into Dart types.
199 abstract class TypeInspectorService { 215 abstract class TypeInspectorService {
216 /// Tells whether [type] is transitively a subclass of [supertype].
217 bool isSubclassOf(Type type, Type supertype);
218
200 /// Tells whether [type] has a field or getter for [name]. 219 /// Tells whether [type] has a field or getter for [name].
201 bool hasGetter(Type type, Symbol name); 220 bool hasGetter(Type type, Symbol name);
202 221
203 /// Tells whether [type] has a field or setter for [name]. 222 /// Tells whether [type] has a field or setter for [name].
204 bool hasSetter(Type type, Symbol name); 223 bool hasSetter(Type type, Symbol name);
205 224
206 /// Tells whether [type] has a specific instance [method]. 225 /// Tells whether [type] has a specific instance [method].
207 bool hasInstanceMethod(Type type, Symbol method); 226 bool hasInstanceMethod(Type type, Symbol method);
208 227
209 /// Tells whether [type] has a specific static [method]. 228 /// Tells whether [type] has a specific static [method].
210 bool hasStaticMethod(Type type, Symbol method); 229 bool hasStaticMethod(Type type, Symbol method);
211 230
212 /// Get the declaration associated with field [name] in [type]. 231 /// Get the declaration associated with field [name] in [type].
213 Declaration getDeclaration(Type type, Symbol name); 232 Declaration getDeclaration(Type type, Symbol name);
214 233
215 /// Retrieve all symbols of [type] that match [options]. 234 /// Retrieve all symbols of [type] that match [options].
216 List<Declaration> query(Type type, QueryOptions options); 235 List<Declaration> query(Type type, QueryOptions options);
217 } 236 }
218 237
219 238
220 /// A service that converts between [Symbol]s and [String]s. 239 /// A service that converts between [Symbol]s and [String]s.
221 abstract class SymbolConverterService { 240 abstract class SymbolConverterService {
222 /// Returns the name associated with a [symbol]. 241 /// Returns the name associated with a [symbol].
223 String symbolToName(Symbol symbol); 242 String symbolToName(Symbol symbol);
224 243
225 /// Returns the symbol associated with a [name]. 244 /// Returns the symbol associated with a [name].
226 Symbol nameToSymbol(String name); 245 Symbol nameToSymbol(String name);
227 } 246 }
OLDNEW
« no previous file with comments | « pkg/smoke/lib/mirrors.dart ('k') | pkg/smoke/lib/src/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698