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

Unified Diff: pkg/smoke/lib/smoke.dart

Issue 204143002: Changes in smoke in preparation of polymer's codegen: (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/smoke/lib/mirrors.dart ('k') | pkg/smoke/lib/src/common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/smoke/lib/smoke.dart
diff --git a/pkg/smoke/lib/smoke.dart b/pkg/smoke/lib/smoke.dart
index 9d47a3a9706e21a7ecda56a64add7897fd6f3346..28176b1c8269a82565cda4a047e41508c33ff81a 100644
--- a/pkg/smoke/lib/smoke.dart
+++ b/pkg/smoke/lib/smoke.dart
@@ -9,6 +9,7 @@ library smoke;
import 'src/implementation.dart' as implementation;
export 'src/common.dart' show minArgs, maxArgs, SUPPORTED_ARGS;
+import 'src/common.dart' show compareLists;
/// Configures this library to use [objectAccessor] for all read/write/invoke
/// APIs, [typeInspector] for all type query APIs, and [symbolConverter] for all
@@ -121,6 +122,10 @@ class QueryOptions {
/// included.
final List withAnnotations;
+ /// If [matches] is not null, then include only those fields, properties, or
+ /// methods that match the predicate.
+ final NameMatcher matches;
+
const QueryOptions({
this.includeFields: true,
this.includeProperties: true,
@@ -128,9 +133,25 @@ class QueryOptions {
this.includeUpTo: Object,
this.excludeFinal: false,
this.includeMethods: false,
- this.withAnnotations: null});
+ this.withAnnotations: null,
+ this.matches: null});
+
+ String toString() => (new StringBuffer()
+ ..write('(options:')
+ ..write(includeFields ? 'fields ' : '')
+ ..write(includeProperties ? 'properties ' : '')
+ ..write(includeMethods ? 'methods ' : '')
+ ..write(includeInherited ? 'inherited ' : '_')
+ ..write(excludeFinal ? 'no finals ' : '')
+ ..write('annotations: $withAnnotations')
+ ..write(matches != null ? 'with matcher' : '')
+ ..write(')')).toString();
}
+/// Used to filter query results based on a predicate on [name]. Returns true if
+/// [name] should be included in the query results.
+typedef bool NameMatcher(Symbol name);
+
/// Information associated with a symbol declaration (like a property or
/// method).
class Declaration {
@@ -166,15 +187,21 @@ class Declaration {
const Declaration(this.name, this.type, {this.kind: FIELD,
this.isFinal: false, this.isStatic: false, this.annotations: const []});
+ int get hashCode => name.hashCode;
+ operator ==(other) => other is Declaration && name == other.name &&
+ kind == other.kind && isFinal == other.isFinal &&
+ type == other.type && isStatic == other.isStatic &&
+ compareLists(annotations, other.annotations);
+
String toString() {
return (new StringBuffer()
- ..write('[declaration ')
+ ..write('(declaration ')
..write(name)
..write(isProperty ? ' (property) ' : ' (method) ')
..write(isFinal ? 'final ' : '')
..write(isStatic ? 'static ' : '')
..write(annotations)
- ..write(']')).toString();
+ ..write(')')).toString();
}
}
« 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