| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012, 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 /** Provides some basic model classes to test serialization. */ |
| 6 |
| 7 part of serialization_test; |
| 8 |
| 9 class Person { |
| 10 String name, rank, serialNumber; |
| 11 var address; |
| 12 } |
| 13 |
| 14 class Address { |
| 15 String street, city, state, zip; |
| 16 } |
| 17 |
| 18 class Various { |
| 19 Various.Foo(this._d, this.e); |
| 20 |
| 21 // Field |
| 22 var a; |
| 23 |
| 24 // Get/Set pair |
| 25 var _b; |
| 26 get b => _b; |
| 27 set b(value) { _b = value; } |
| 28 |
| 29 // Private field (shouldn't be visible) |
| 30 var _c = 'default value'; |
| 31 |
| 32 // Getter, value is set in the constructor |
| 33 var _d; |
| 34 get d => _d; |
| 35 |
| 36 // Final, value set is the constructor. |
| 37 final e; |
| 38 |
| 39 // Get without corresponding set |
| 40 get aLength => a.length; |
| 41 |
| 42 static String thisShouldBeIgnored = "because it's static"; |
| 43 static get thisShouldAlsoBeIgnored => "for the same reason"; |
| 44 static set thisShouldAlsoBeIgnored(x) {} |
| 45 } |
| 46 |
| 47 class Node { |
| 48 Node parent; |
| 49 String name; |
| 50 Node(this.name); |
| 51 Node.parentEssential(this.parent); |
| 52 List<Node> children; |
| 53 bool someBoolean = true; |
| 54 |
| 55 toString() => "Node($name)"; |
| 56 } |
| 57 |
| 58 class NodeEqualByName extends Node { |
| 59 NodeEqualByName(name) : super(name); |
| 60 operator ==(x) => x is NodeEqualByName && name == x.name; |
| 61 get hashCode => name.hashCode; |
| 62 } |
| 63 |
| 64 class Stream { |
| 65 // In a real stream the position wouldn't likely be settable, making |
| 66 // this trickier to reconstruct. |
| 67 List _collection; |
| 68 int position = 0; |
| 69 Stream(this._collection); |
| 70 |
| 71 next() => atEnd() ? null : _collection[position++]; |
| 72 atEnd() => position >= _collection.length; |
| 73 } |
| OLD | NEW |