OLD | NEW |
(Empty) | |
| 1 import 'dart:collection'; |
| 2 import 'dart:html'; |
| 3 import 'dart:math' as math; |
| 4 |
| 5 main() { |
| 6 window.onMessage.listen(handleMessage); |
| 7 } |
| 8 |
| 9 handleMessage(event) { |
| 10 if (event.data == 'fromJS') { |
| 11 Test test = new Test('Test.instanceField'); |
| 12 String _private = 'private'; |
| 13 window.postMessage('fromDart', '*'); |
| 14 } |
| 15 } |
| 16 |
| 17 class IntEntry extends LinkedListEntry<IntEntry> { |
| 18 final int value; |
| 19 |
| 20 IntEntry(this.value); |
| 21 |
| 22 String toString() => value.toString(); |
| 23 } |
| 24 |
| 25 LinkedList intList = new LinkedList() |
| 26 ..add(new IntEntry(4)) |
| 27 ..add(new IntEntry(2)); |
| 28 |
| 29 class Base { |
| 30 int baseField = 0; |
| 31 } |
| 32 |
| 33 class Test extends Base { |
| 34 String instanceField; |
| 35 int _foo; |
| 36 |
| 37 Test(this.instanceField); |
| 38 |
| 39 get foo => _foo; |
| 40 set foo(int value) => _foo = value; |
| 41 |
| 42 Test create(String string) => new Test(string); |
| 43 |
| 44 String concat(Test x, Test y) { |
| 45 return '$instanceField:${x.instanceField}:${y.instanceField}'; |
| 46 } |
| 47 |
| 48 set baseField(value) {} |
| 49 |
| 50 String toString() => '<Test instance with instanceField = $instanceField>'; |
| 51 } |
| 52 |
| 53 String globalField; |
| 54 |
| 55 int calculateSquareRoot(int x) => math.sqrt(x).toInt(); |
OLD | NEW |