OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 // Codegen dependency order test | 6 // Codegen dependency order test |
7 const UNINITIALIZED = const _Uninitialized(); | 7 const UNINITIALIZED = const _Uninitialized(); |
8 class _Uninitialized { const _Uninitialized(); } | 8 class _Uninitialized { const _Uninitialized(); } |
9 | 9 |
10 class Generic<T> { | 10 class Generic<T> { |
11 Type get type => Generic; | 11 Type get type => Generic; |
12 } | 12 } |
13 | 13 |
| 14 // super == |
| 15 // https://github.com/dart-lang/dev_compiler/issues/226 |
| 16 class Base { |
| 17 int x = 1, y = 2; |
| 18 operator==(obj) { |
| 19 return obj is Base && obj.x == x && obj.y == y; |
| 20 } |
| 21 } |
| 22 class Derived { |
| 23 int z = 3; |
| 24 operator==(obj) { |
| 25 return obj is Derived && obj.z == z && super == obj; |
| 26 } |
| 27 } |
| 28 |
| 29 // string escape tests |
| 30 // https://github.com/dart-lang/dev_compiler/issues/227 |
| 31 bool _isWhitespace(String ch) => |
| 32 ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t'; |
| 33 |
| 34 const _escapeMap = const { |
| 35 '\n': r'\n', |
| 36 '\r': r'\r', |
| 37 '\f': r'\f', |
| 38 '\b': r'\b', |
| 39 '\t': r'\t', |
| 40 '\v': r'\v', |
| 41 '\x7F': r'\x7F', // delete |
| 42 }; |
| 43 |
| 44 |
14 main() { | 45 main() { |
15 // Number literals in call expressions. | 46 // Number literals in call expressions. |
16 print(1.toString()); | 47 print(1.toString()); |
17 print(1.0.toString()); | 48 print(1.0.toString()); |
18 print(1.1.toString()); | 49 print(1.1.toString()); |
19 | 50 |
20 // Type literals, #184 | 51 // Type literals, #184 |
21 dynamic x = 42; | 52 dynamic x = 42; |
22 print(x == dynamic); | 53 print(x == dynamic); |
23 print(x == Generic); | 54 print(x == Generic); |
24 | 55 |
25 // Should be Generic<dynamic> | 56 // Should be Generic<dynamic> |
26 print(new Generic<int>().type); | 57 print(new Generic<int>().type); |
| 58 |
| 59 print(new Derived() == new Derived()); // true |
27 } | 60 } |
OLD | NEW |