Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: pkg/serialization/test/test_models.dart

Issue 11293283: Initial version of a serialization framework (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
54 toString() => "Node($name)";
55 }
56
57 class Stream {
58 // In a real stream the position wouldn't likely be settable, making
59 // this trickier to reconstruct.
60 List _collection;
61 int position = 0;
62 Stream(this._collection);
63
64 next() => atEnd() ? null : _collection[position++];
65 atEnd() => position >= _collection.length;
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698