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

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

Issue 1311613005: Add ParameterMirror.isInitializingFormal to dart:mirrors Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | « sdk/lib/mirrors/mirrors.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/parameter_test.dart
diff --git a/tests/lib/mirrors/parameter_test.dart b/tests/lib/mirrors/parameter_test.dart
index 4eb6ad596432523ba8d400ee2f55e28872861e2b..497447cadc89ba69e08580b965e0288254c1c9d7 100644
--- a/tests/lib/mirrors/parameter_test.dart
+++ b/tests/lib/mirrors/parameter_test.dart
@@ -27,8 +27,10 @@ class B {
B.qux(int x, [int y= 3 + 1]);
B.quux(int x, {String str: "foo"});
B.corge({int x: 3 * 17, String str: "bar"});
+ B.corgi(int this.z);
var _x;
+ var z;
get x => _x;
set x(final value) { _x = value; }
@@ -51,7 +53,7 @@ main() {
});
List<Symbol> constructorKeys =
- [#B, #B.bar, #B.baz, #B.foo, #B.quux, #B.qux, #B.corge];
+ [#B, #B.bar, #B.baz, #B.foo, #B.quux, #B.qux, #B.corge, #B.corgi];
Expect.setEquals(constructorKeys, constructors.keys);
MethodMirror unnamedConstructor = constructors[#B];
@@ -127,6 +129,14 @@ main() {
expect('Class(s(B) in s(test.parameter_test), top-level)',
corgeConstructor.returnType);
+ ParameterMirror bazZParameter =
+ bazConstructor.parameters.firstWhere((p) => p.simpleName == #z);
+ Expect.isFalse(bazZParameter.isInitializingFormal);
+ MethodMirror corgiConstructor = constructors[#B.corgi];
+ ParameterMirror corgiZParameter =
+ corgiConstructor.parameters.firstWhere((p) => p.simpleName == #z);
+ Expect.isTrue(corgiZParameter.isInitializingFormal);
+
MethodMirror xGetter = cm.declarations[#x];
expect('Method(s(x) in s(B), getter)', xGetter);
expect('[]', xGetter.parameters);
« no previous file with comments | « sdk/lib/mirrors/mirrors.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698