| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 // Test symbol literals. |
| 6 |
| 7 library symbol_literal_test; |
| 8 |
| 9 import 'package:expect/expect.dart'; |
| 10 |
| 11 foo(a, b) => Expect.isTrue(identical(a, b)); |
| 12 |
| 13 var check = foo; // Indirection used to avoid inlining. |
| 14 |
| 15 main() { |
| 16 check(const Symbol("a"), #a); |
| 17 check(const Symbol("a"), # |
| 18 a); |
| 19 check(const Symbol("ab"), #ab); |
| 20 check(const Symbol("ab"), # |
| 21 ab); |
| 22 check(const Symbol("a.b"), #a.b); |
| 23 check(const Symbol("a.b"), # |
| 24 a |
| 25 . |
| 26 b); |
| 27 check(const Symbol("=="), #==); |
| 28 check(const Symbol("=="), # ==); |
| 29 check(const Symbol("a.toString"), #a.toString); |
| 30 |
| 31 // Tries to call the symbol literal #a.toString |
| 32 Expect.throws(() => #a.toString(), (e) => e is NoSuchMethodError); /// 01: sta
tic type warning |
| 33 } |
| OLD | NEW |