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

Side by Side Diff: pkg/yaml/lib/model.dart

Issue 12090093: Reapply "Rename mappedBy to map." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed bug in previous commit. Created 7 years, 10 months 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
« no previous file with comments | « pkg/unittest/lib/src/config.dart ('k') | pkg/yaml/lib/visitor.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 part of yaml; 5 part of yaml;
6 6
7 // This file contains the node classes for the internal representations of YAML 7 // This file contains the node classes for the internal representations of YAML
8 // documents. These nodes are used for both the serialization tree and the 8 // documents. These nodes are used for both the serialization tree and the
9 // representation graph. 9 // representation graph.
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Should be super != other; bug 2554 84 // Should be super != other; bug 2554
85 if (!(super == other) || other is! _SequenceNode) return false; 85 if (!(super == other) || other is! _SequenceNode) return false;
86 if (content.length != other.content.length) return false; 86 if (content.length != other.content.length) return false;
87 for (var i = 0; i < content.length; i++) { 87 for (var i = 0; i < content.length; i++) {
88 if (content[i] != other.content[i]) return false; 88 if (content[i] != other.content[i]) return false;
89 } 89 }
90 return true; 90 return true;
91 } 91 }
92 92
93 String toString() => 93 String toString() =>
94 '$tag [${Strings.join(content.mappedBy((e) => '$e'), ', ')}]'; 94 '$tag [${Strings.join(content.map((e) => '$e'), ', ')}]';
95 95
96 int get hashCode => super.hashCode ^ _hashCode(content); 96 int get hashCode => super.hashCode ^ _hashCode(content);
97 97
98 visit(_Visitor v) => v.visitSequence(this); 98 visit(_Visitor v) => v.visitSequence(this);
99 } 99 }
100 100
101 /// An alias node is a reference to an anchor. 101 /// An alias node is a reference to an anchor.
102 class _AliasNode extends _Node { 102 class _AliasNode extends _Node {
103 _AliasNode(String anchor) : super(new _Tag.scalar(_Tag.yaml("str")), anchor); 103 _AliasNode(String anchor) : super(new _Tag.scalar(_Tag.yaml("str")), anchor);
104 104
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // 20 is the maximum value for this argument, which we use since YAML 143 // 20 is the maximum value for this argument, which we use since YAML
144 // doesn't specify a maximum. 144 // doesn't specify a maximum.
145 return value.toStringAsExponential(20). 145 return value.toStringAsExponential(20).
146 replaceFirst(new RegExp("0+e"), "e"); 146 replaceFirst(new RegExp("0+e"), "e");
147 } 147 }
148 148
149 if (value is String) { 149 if (value is String) {
150 // TODO(nweiz): This could be faster if we used a RegExp to check for 150 // TODO(nweiz): This could be faster if we used a RegExp to check for
151 // special characters and short-circuited if they didn't exist. 151 // special characters and short-circuited if they didn't exist.
152 152
153 var escapedValue = value.charCodes.mappedBy((c) { 153 var escapedValue = value.charCodes.map((c) {
154 switch (c) { 154 switch (c) {
155 case _Parser.TAB: return "\\t"; 155 case _Parser.TAB: return "\\t";
156 case _Parser.LF: return "\\n"; 156 case _Parser.LF: return "\\n";
157 case _Parser.CR: return "\\r"; 157 case _Parser.CR: return "\\r";
158 case _Parser.DOUBLE_QUOTE: return '\\"'; 158 case _Parser.DOUBLE_QUOTE: return '\\"';
159 case _Parser.NULL: return "\\0"; 159 case _Parser.NULL: return "\\0";
160 case _Parser.BELL: return "\\a"; 160 case _Parser.BELL: return "\\a";
161 case _Parser.BACKSPACE: return "\\b"; 161 case _Parser.BACKSPACE: return "\\b";
162 case _Parser.VERTICAL_TAB: return "\\v"; 162 case _Parser.VERTICAL_TAB: return "\\v";
163 case _Parser.FORM_FEED: return "\\f"; 163 case _Parser.FORM_FEED: return "\\f";
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 if (content.length != other.content.length) return false; 216 if (content.length != other.content.length) return false;
217 for (var key in content.keys) { 217 for (var key in content.keys) {
218 if (!other.content.containsKey(key)) return false; 218 if (!other.content.containsKey(key)) return false;
219 if (content[key] != other.content[key]) return false; 219 if (content[key] != other.content[key]) return false;
220 } 220 }
221 return true; 221 return true;
222 } 222 }
223 223
224 String toString() { 224 String toString() {
225 var strContent = content.keys 225 var strContent = content.keys
226 .mappedBy((k) => '${k}: ${content[k]}') 226 .map((k) => '${k}: ${content[k]}')
227 .join(', '); 227 .join(', ');
228 return '$tag {$strContent}'; 228 return '$tag {$strContent}';
229 } 229 }
230 230
231 int get hashCode => super.hashCode ^ _hashCode(content); 231 int get hashCode => super.hashCode ^ _hashCode(content);
232 232
233 visit(_Visitor v) => v.visitMapping(this); 233 visit(_Visitor v) => v.visitMapping(this);
234 } 234 }
OLDNEW
« no previous file with comments | « pkg/unittest/lib/src/config.dart ('k') | pkg/yaml/lib/visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698