Index: tests/language/rewrite_compound_assign_test.dart |
diff --git a/tests/language/rewrite_compound_assign_test.dart b/tests/language/rewrite_compound_assign_test.dart |
index b28ad962ffa7b2000c977d551f8552fc31d97631..ba4c1efad266e0394d61fb9a7da3d7f54255af33 100644 |
--- a/tests/language/rewrite_compound_assign_test.dart |
+++ b/tests/language/rewrite_compound_assign_test.dart |
@@ -7,113 +7,125 @@ import "package:expect/expect.dart"; |
var global = 0; |
class Foo { |
- var field = 0; |
- static var staticField = 0; |
+ var field = 0; |
+ static var staticField = 0; |
} |
field_compound1(obj) { |
- return obj.field = obj.field + 5; |
+ return obj.field = obj.field + 5; |
} |
+ |
field_compound2(obj) { |
- return obj.field = obj.field + 1; |
+ return obj.field = obj.field + 1; |
} |
+ |
field_compound3(obj) { |
- return obj.field = obj.field - 1; |
+ return obj.field = obj.field - 1; |
} |
+ |
field_compound4(obj) { |
- return obj.field = obj.field * 1; |
+ return obj.field = obj.field * 1; |
} |
static_compound1() { |
- return Foo.staticField = Foo.staticField + 5; |
+ return Foo.staticField = Foo.staticField + 5; |
} |
+ |
static_compound2() { |
- return Foo.staticField = Foo.staticField + 1; |
+ return Foo.staticField = Foo.staticField + 1; |
} |
+ |
static_compound3() { |
- return Foo.staticField = Foo.staticField - 1; |
+ return Foo.staticField = Foo.staticField - 1; |
} |
+ |
static_compound4() { |
- return Foo.staticField = Foo.staticField * 1; |
+ return Foo.staticField = Foo.staticField * 1; |
} |
global_compound1() { |
- return global = global + 5; |
+ return global = global + 5; |
} |
+ |
global_compound2() { |
- return global = global + 1; |
+ return global = global + 1; |
} |
+ |
global_compound3() { |
- return global = global - 1; |
+ return global = global - 1; |
} |
+ |
global_compound4() { |
- return global = global * 1; |
+ return global = global * 1; |
} |
local_compound1(x) { |
- x = x + 5; |
- if (x > 0) { |
- return x; |
- } |
- return -x; |
+ x = x + 5; |
+ if (x > 0) { |
+ return x; |
+ } |
+ return -x; |
} |
+ |
local_compound2(x) { |
- x = x + 1; |
- if (x > 0) { |
- return x; |
- } |
- return -x; |
+ x = x + 1; |
+ if (x > 0) { |
+ return x; |
+ } |
+ return -x; |
} |
+ |
local_compound3(x) { |
- x = x - 1; |
- if (x > 0) { |
- return x; |
- } |
- return -x; |
+ x = x - 1; |
+ if (x > 0) { |
+ return x; |
+ } |
+ return -x; |
} |
+ |
local_compound4(x) { |
- x = x * 1; |
- if (x > 0) { |
- return x; |
- } |
- return -x; |
+ x = x * 1; |
+ if (x > 0) { |
+ return x; |
+ } |
+ return -x; |
} |
main() { |
- var obj = new Foo(); |
- Expect.equals(5, field_compound1(obj)); |
- Expect.equals(5, obj.field); |
- Expect.equals(6, field_compound2(obj)); |
- Expect.equals(6, obj.field); |
- Expect.equals(5, field_compound3(obj)); |
- Expect.equals(5, obj.field); |
- Expect.equals(5, field_compound4(obj)); |
- Expect.equals(5, obj.field); |
- |
- Expect.equals(5, static_compound1()); |
- Expect.equals(5, Foo.staticField); |
- Expect.equals(6, static_compound2()); |
- Expect.equals(6, Foo.staticField); |
- Expect.equals(5, static_compound3()); |
- Expect.equals(5, Foo.staticField); |
- Expect.equals(5, static_compound4()); |
- Expect.equals(5, Foo.staticField); |
- |
- Expect.equals(5, global_compound1()); |
- Expect.equals(5, global); |
- Expect.equals(6, global_compound2()); |
- Expect.equals(6, global); |
- Expect.equals(5, global_compound3()); |
- Expect.equals(5, global); |
- Expect.equals(5, global_compound4()); |
- Expect.equals(5, global); |
- |
- Expect.equals(8, local_compound1(3)); |
- Expect.equals(3, local_compound1(-8)); |
- Expect.equals(4, local_compound2(3)); |
- Expect.equals(7, local_compound2(-8)); |
- Expect.equals(2, local_compound3(3)); |
- Expect.equals(9, local_compound3(-8)); |
- Expect.equals(3, local_compound4(3)); |
- Expect.equals(8, local_compound4(-8)); |
+ var obj = new Foo(); |
+ Expect.equals(5, field_compound1(obj)); |
+ Expect.equals(5, obj.field); |
+ Expect.equals(6, field_compound2(obj)); |
+ Expect.equals(6, obj.field); |
+ Expect.equals(5, field_compound3(obj)); |
+ Expect.equals(5, obj.field); |
+ Expect.equals(5, field_compound4(obj)); |
+ Expect.equals(5, obj.field); |
+ |
+ Expect.equals(5, static_compound1()); |
+ Expect.equals(5, Foo.staticField); |
+ Expect.equals(6, static_compound2()); |
+ Expect.equals(6, Foo.staticField); |
+ Expect.equals(5, static_compound3()); |
+ Expect.equals(5, Foo.staticField); |
+ Expect.equals(5, static_compound4()); |
+ Expect.equals(5, Foo.staticField); |
+ |
+ Expect.equals(5, global_compound1()); |
+ Expect.equals(5, global); |
+ Expect.equals(6, global_compound2()); |
+ Expect.equals(6, global); |
+ Expect.equals(5, global_compound3()); |
+ Expect.equals(5, global); |
+ Expect.equals(5, global_compound4()); |
+ Expect.equals(5, global); |
+ |
+ Expect.equals(8, local_compound1(3)); |
+ Expect.equals(3, local_compound1(-8)); |
+ Expect.equals(4, local_compound2(3)); |
+ Expect.equals(7, local_compound2(-8)); |
+ Expect.equals(2, local_compound3(3)); |
+ Expect.equals(9, local_compound3(-8)); |
+ Expect.equals(3, local_compound4(3)); |
+ Expect.equals(8, local_compound4(-8)); |
} |