| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 import 'dart:fletch'; | 5 import 'dart:dartino'; |
| 6 | 6 |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 | 8 |
| 9 // This class is missing: final fields and const constructor. | 9 // This class is missing: final fields and const constructor. |
| 10 class Fisk { | 10 class Fisk { |
| 11 int age; | 11 int age; |
| 12 Fisk(this.age); | 12 Fisk(this.age); |
| 13 } | 13 } |
| 14 | 14 |
| 15 // This class is missing: const constructor. | 15 // This class is missing: const constructor. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 testMutable(new Node(nonConstConstructorObj, leaf)); | 71 testMutable(new Node(nonConstConstructorObj, leaf)); |
| 72 testMutable(new Node(new Node(leaf, nonConstConstructorObj), leaf)); | 72 testMutable(new Node(new Node(leaf, nonConstConstructorObj), leaf)); |
| 73 int y; | 73 int y; |
| 74 testMutable(() { y = 4; }); | 74 testMutable(() { y = 4; }); |
| 75 | 75 |
| 76 // TODO(kustermann): Runtime types are not working ATM. | 76 // TODO(kustermann): Runtime types are not working ATM. |
| 77 // Expect.isFalse(isImmutable(bool)); | 77 // Expect.isFalse(isImmutable(bool)); |
| 78 // Expect.isFalse(isImmutable(String)); | 78 // Expect.isFalse(isImmutable(String)); |
| 79 // Expect.isFalse(isImmutable(Hest)); | 79 // Expect.isFalse(isImmutable(Hest)); |
| 80 | 80 |
| 81 // TODO(kustermann/fletchc-experts): Allow self recursive closures. | 81 // TODO(kustermann/dartino_compiler-experts): Allow self recursive closures. |
| 82 // [The recursive reference causes a storeField instruction to be | 82 // [The recursive reference causes a storeField instruction to be |
| 83 // emitted which makes it mutable ATM.] | 83 // emitted which makes it mutable ATM.] |
| 84 void recurse(x) { if (x > 0) { return recurse(x - 1); } } | 84 void recurse(x) { if (x > 0) { return recurse(x - 1); } } |
| 85 Expect.isFalse(isImmutable(recurse)); | 85 Expect.isFalse(isImmutable(recurse)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 testImmutable(obj) { | 88 testImmutable(obj) { |
| 89 Expect.isTrue(isImmutable(obj)); | 89 Expect.isTrue(isImmutable(obj)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 testMutable(obj) { | 92 testMutable(obj) { |
| 93 Expect.isFalse(isImmutable(obj)); | 93 Expect.isFalse(isImmutable(obj)); |
| 94 } | 94 } |
| 95 | 95 |
| OLD | NEW |