Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/reflectable/example/bin/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const myReflectable = MyReflectable();
class A {
int arg0() => 42;
int arg1(int x) => x - 42;
int arg1to3(int x, int y, [int z = 0, w]) => x + y + z * 42;
int arg1to3(int x, int y, [int z = 0, String? w]) => x + y + z * 42;
int argNamed(int x, int y, {int z = 42}) => x + y - z;
int operator +(int x) => 42 + x;
int operator [](int x) => 42 + x;
Expand Down
6 changes: 3 additions & 3 deletions packages/test_reflectable/test/delegate_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ class A {
@D()
int arg1(int x) => 101;

int arg2to4(A x, int y, [Reflector? z, w]) => 102;
int arg2to4(A x, int y, [Reflector? z, int? w]) => 102;

@D()
int argNamed(int x, y, {num? z}) => 103;
int argNamed(int x, Object y, {num? z}) => 103;

int operator +(int x) => 104;

@D()
int operator [](int x) => indexTarget;

void operator []=(int x, v) {
void operator []=(int x, int v) {
indexTarget = v;
}

Expand Down
13 changes: 7 additions & 6 deletions packages/test_reflectable/test/invoke_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const myReflectable = MyReflectable();
class A {
int arg0() => 42;
int arg1(int x) => x - 42;
int arg1to3(int x, int y, [int z = 0, w]) => x + y + z * 42;
int arg1to3(int x, int y, [int z = 0, String? w]) => x + y + z * 42;
int argNamed(int x, int y, {int z = 42}) => x + y - z;
int operator +(x) => (42 + x).toInt();
int operator [](x) => 42 + (x as int);
void operator []=(x, v) {
int operator +(int x) => 42 + x;
int operator [](int x) => 42 + x;
void operator []=(int x, int v) {
f = x + v;
}

Expand All @@ -35,8 +35,9 @@ class A {
int f = 0;

static int noArguments() => 42;
static int oneArgument(x) => x - 42;
static int optionalArguments(x, y, [z = 0, w]) => x + y + z * 42;
static int oneArgument(int x) => x - 42;
static int optionalArguments(int x, int y, [int z = 0, String? w]) =>
x + y + z * 42;
static int namedArguments(int x, int y, {int z = 42}) => x + y - z;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/test_reflectable/test/invoker_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class A {
A(this.f);
int arg0() => 42 + f;
int arg1(int x) => x - 42 + f;
int arg1to3(int x, int y, [int z = 0, w]) => x + y + z * 42 + f;
int arg1to3(int x, int y, [int z = 0, String? w]) => x + y + z * 42 + f;
int argNamed(int x, int y, {int z = 42}) => x + y - z + f;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/test_reflectable/test/new_instance_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class A {
A.positional(int x) : f = x - 42;

@C()
A.optional(int x, int y, [int z = 1, w])
: f = x + y + z * 42 + ((w ?? 10) as int);
A.optional(int x, int y, [int z = 1, int? w])
: f = x + y + z * 42 + (w ?? 10);

@C()
A.argNamed(int x, int y, {int z = 42, int? p}) : f = x + y - z - (p ?? 10);
Expand Down
10 changes: 5 additions & 5 deletions packages/test_reflectable/test/no_such_method_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ const reflector = Reflector();
class A {
int arg0() => 100;
int arg1(int x) => 101;
int arg2to4(A x, int y, [Reflector? z, w]) => 102;
int argNamed(int x, y, {num? z}) => 103;
int arg2to4(A x, int y, [Reflector? z, Object? w]) => 102;
int argNamed(int x, int y, {num? z}) => 103;
int operator [](int x) => 104;
void operator []=(int x, v) {}
void operator []=(int x, Object? v) {}

// Not a movie title.
int deepThrow(o) => deepThrowImpl(o);
int deepThrowImpl(o) => o.thisGetterDoesNotExist;
int deepThrow(Object o) => deepThrowImpl(o);
int deepThrowImpl(dynamic o) => o.thisGetterDoesNotExist;
}

Matcher throwsReflectableNoSuchMethod = throwsA(
Expand Down