OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class _MessageTraverserVisitedMap { | 5 class _MessageTraverserVisitedMap { |
6 | 6 |
7 operator[](var object) => null; | 7 operator[](var object) => null; |
8 void operator[]=(var object, var info) { } | 8 void operator[]=(var object, var info) { } |
9 | 9 |
10 void reset() { } | 10 void reset() { } |
(...skipping 18 matching lines...) Expand all Loading... |
29 _visited.cleanup(); | 29 _visited.cleanup(); |
30 } | 30 } |
31 return result; | 31 return result; |
32 } | 32 } |
33 | 33 |
34 _dispatch(var x) { | 34 _dispatch(var x) { |
35 if (isPrimitive(x)) return visitPrimitive(x); | 35 if (isPrimitive(x)) return visitPrimitive(x); |
36 if (x is List) return visitList(x); | 36 if (x is List) return visitList(x); |
37 if (x is Map) return visitMap(x); | 37 if (x is Map) return visitMap(x); |
38 if (x is SendPort) return visitSendPort(x); | 38 if (x is SendPort) return visitSendPort(x); |
| 39 if (x is SendPortSync) return visitSendPortSync(x); |
39 | 40 |
40 // TODO(floitsch): make this a real exception. (which one)? | 41 // TODO(floitsch): make this a real exception. (which one)? |
41 throw "Message serialization: Illegal value $x passed"; | 42 throw "Message serialization: Illegal value $x passed"; |
42 } | 43 } |
43 | 44 |
44 abstract visitPrimitive(x); | 45 abstract visitPrimitive(x); |
45 abstract visitList(List x); | 46 abstract visitList(List x); |
46 abstract visitMap(Map x); | 47 abstract visitMap(Map x); |
47 abstract visitSendPort(SendPort x); | 48 abstract visitSendPort(SendPort x); |
| 49 abstract visitSendPortSync(SendPortSync x); |
48 | 50 |
49 static bool isPrimitive(x) { | 51 static bool isPrimitive(x) { |
50 return (x === null) || (x is String) || (x is num) || (x is bool); | 52 return (x === null) || (x is String) || (x is num) || (x is bool); |
51 } | 53 } |
52 } | 54 } |
53 | 55 |
54 | 56 |
55 /** A visitor that recursively copies a message. */ | 57 /** A visitor that recursively copies a message. */ |
56 class _Copier extends _MessageTraverser { | 58 class _Copier extends _MessageTraverser { |
57 | 59 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 var key = _deserializeHelper(keys[i]); | 189 var key = _deserializeHelper(keys[i]); |
188 var value = _deserializeHelper(values[i]); | 190 var value = _deserializeHelper(values[i]); |
189 result[key] = value; | 191 result[key] = value; |
190 } | 192 } |
191 return result; | 193 return result; |
192 } | 194 } |
193 | 195 |
194 abstract deserializeSendPort(List x); | 196 abstract deserializeSendPort(List x); |
195 | 197 |
196 } | 198 } |
OLD | NEW |