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

Unified Diff: tests/lib/mirrors/invocation_fuzz_test.dart

Issue 2752803003: Add test case to regress case where fields of a closure are accessed (reproduces the problem we enc… (Closed)
Patch Set: Address self review comment. Created 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/invocation_fuzz_test.dart
diff --git a/tests/lib/mirrors/invocation_fuzz_test.dart b/tests/lib/mirrors/invocation_fuzz_test.dart
index 1043145218327f17cc4705dfef871550ed1a140b..7cc6393fe7dc1ef51764c2c86f71de40ff100582 100644
--- a/tests/lib/mirrors/invocation_fuzz_test.dart
+++ b/tests/lib/mirrors/invocation_fuzz_test.dart
@@ -96,12 +96,26 @@ checkMethod(MethodMirror m, ObjectMirror target, [origin]) {
queue.add(task);
}
+checkField(VariableMirror v, ObjectMirror target, [origin]) {
+ if (isBlacklisted(v.qualifiedName)) return;
+
+ var task = new Task();
+ task.name = '${MirrorSystem.getName(v.qualifiedName)} from $origin';
+
+ task.action = () => target.getField(v.simpleName);
+
+ queue.add(task);
+}
+
checkInstance(instanceMirror, origin) {
ClassMirror klass = instanceMirror.type;
while (klass != null) {
instanceMirror.type.declarations.values
.where((d) => d is MethodMirror && !d.isStatic)
.forEach((m) => checkMethod(m, instanceMirror, origin));
+ instanceMirror.type.declarations.values
+ .where((d) => d is VariableMirror)
+ .forEach((v) => checkField(v, instanceMirror, origin));
klass = klass.superclass;
}
}
@@ -177,7 +191,7 @@ main() {
var valueObjects =
[true, false, null, [], {}, dynamic,
- 0, 0xEFFFFFF, 0xFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 3.14159,
+ 0, 0xEFFFFFF, 0xFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 3.14159, () {},
"foo", 'blåbærgrød', 'Îñţérñåţîöñåļîžåţîờñ', "\u{1D11E}", #symbol];
valueObjects.forEach((v) => checkInstance(reflect(v), 'value object'));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698