| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2016, 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 foo({fisk}) { | |
| 6 print(fisk); | |
| 7 } | |
| 8 | |
| 9 caller(f) { | |
| 10 f(); | |
| 11 } | |
| 12 | |
| 13 main() { | |
| 14 int i = 0; | |
| 15 print(i == 1 ? "bad" : "good"); | |
| 16 print("$i"); | |
| 17 print("'$i'"); | |
| 18 print(" '${i}' "); | |
| 19 print(" '${i}' '${i}'"); | |
| 20 print(" '$i' '${i}'"); | |
| 21 print("foo" "bar"); | |
| 22 print(" '${i}' '${i}'" " '$i' '${i}'"); | |
| 23 try { | |
| 24 throw "fisk"; | |
| 25 } on String catch (e, s) { | |
| 26 print(e); | |
| 27 if (s != null) print(s); | |
| 28 } | |
| 29 for(;false;) {} | |
| 30 var list = ["Hello, World!"]; | |
| 31 print(list[i]); | |
| 32 list[i] = "Hello, Brave New World!"; | |
| 33 print(list[i]); | |
| 34 i = 87; | |
| 35 print(-i); | |
| 36 print(~i); | |
| 37 print(!(i == 42)); | |
| 38 print(--i); | |
| 39 print(++i); | |
| 40 print(i--); | |
| 41 print(i++); | |
| 42 print(new Object()); | |
| 43 print(const Object()); | |
| 44 print((new List<String>(2)).runtimeType); | |
| 45 foo(fisk: "Blorp gulp"); | |
| 46 f() { | |
| 47 print("f was called"); | |
| 48 } | |
| 49 caller(f); | |
| 50 caller(() { | |
| 51 print("<anon> was called"); | |
| 52 }); | |
| 53 g([message]) { | |
| 54 print(message); | |
| 55 } | |
| 56 g("Hello, World"); | |
| 57 caller(([x]) { | |
| 58 print("<anon> was called with $x"); | |
| 59 }); | |
| 60 h({message}) { | |
| 61 print(message); | |
| 62 } | |
| 63 h(message: "Hello, World"); | |
| 64 caller(({x}) { | |
| 65 print("<anon> was called with $x"); | |
| 66 }); | |
| 67 print((int).toString()); | |
| 68 print(int); | |
| 69 print(int..toString()); | |
| 70 try { | |
| 71 print(int?.toString()); | |
| 72 throw "Shouldn't work"; | |
| 73 } on NoSuchMethodError catch (e) { | |
| 74 print("As expected: $e"); | |
| 75 } | |
| 76 print(int.parse("42")); | |
| 77 } | |
| OLD | NEW |