| 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 // This file contains the node classes for the internal representations of YAML | 5 // This file contains the node classes for the internal representations of YAML |
| 6 // documents. These nodes are used for both the serialization tree and the | 6 // documents. These nodes are used for both the serialization tree and the |
| 7 // representation graph. | 7 // representation graph. |
| 8 | 8 |
| 9 /** A tag that indicates the type of a YAML node. */ | 9 /** A tag that indicates the type of a YAML node. */ |
| 10 class _Tag { | 10 class _Tag { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 bool operator ==(other) { | 81 bool operator ==(other) { |
| 82 // Should be super != other; bug 2554 | 82 // Should be super != other; bug 2554 |
| 83 if (!(super == other) || other is! _SequenceNode) return false; | 83 if (!(super == other) || other is! _SequenceNode) return false; |
| 84 if (content.length != other.content.length) return false; | 84 if (content.length != other.content.length) return false; |
| 85 for (var i = 0; i < content.length; i++) { | 85 for (var i = 0; i < content.length; i++) { |
| 86 if (content[i] != other.content[i]) return false; | 86 if (content[i] != other.content[i]) return false; |
| 87 } | 87 } |
| 88 return true; | 88 return true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 String toString() => '$tag [${Strings.join(content.mappedBy((e) => '$e'), ', '
)}]'; | 91 String toString() => |
| 92 '$tag [${Strings.join(content.mappedBy((e) => '$e'), ', ')}]'; |
| 92 | 93 |
| 93 int get hashCode => super.hashCode ^ _hashCode(content); | 94 int get hashCode => super.hashCode ^ _hashCode(content); |
| 94 | 95 |
| 95 visit(_Visitor v) => v.visitSequence(this); | 96 visit(_Visitor v) => v.visitSequence(this); |
| 96 } | 97 } |
| 97 | 98 |
| 98 /** An alias node is a reference to an anchor. */ | 99 /** An alias node is a reference to an anchor. */ |
| 99 class _AliasNode extends _Node { | 100 class _AliasNode extends _Node { |
| 100 _AliasNode(String anchor) : super(new _Tag.scalar(_Tag.yaml("str")), anchor); | 101 _AliasNode(String anchor) : super(new _Tag.scalar(_Tag.yaml("str")), anchor); |
| 101 | 102 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 String toString() { | 230 String toString() { |
| 230 var strContent = Strings.join(content.keys. | 231 var strContent = Strings.join(content.keys. |
| 231 mappedBy((k) => '${k}: ${content[k]}'), ', '); | 232 mappedBy((k) => '${k}: ${content[k]}'), ', '); |
| 232 return '$tag {$strContent}'; | 233 return '$tag {$strContent}'; |
| 233 } | 234 } |
| 234 | 235 |
| 235 int get hashCode => super.hashCode ^ _hashCode(content); | 236 int get hashCode => super.hashCode ^ _hashCode(content); |
| 236 | 237 |
| 237 visit(_Visitor v) => v.visitMapping(this); | 238 visit(_Visitor v) => v.visitMapping(this); |
| 238 } | 239 } |
| OLD | NEW |