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

Side by Side Diff: lib/src/yaml_node_wrapper.dart

Issue 1329763002: Don't use regular expressions in Loader. (Closed) Base URL: git@github.com:dart-lang/yaml@master
Patch Set: Code review changes Created 5 years, 3 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
« no previous file with comments | « lib/src/yaml_node.dart ('k') | lib/yaml.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library yaml.yaml_node_wrapper; 5 library yaml.yaml_node_wrapper;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:collection/collection.dart' as pkg_collection; 9 import 'package:collection/collection.dart' as pkg_collection;
10 import 'package:source_span/source_span.dart'; 10 import 'package:source_span/source_span.dart';
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 /// The implementation of [YamlMapWrapper.nodes] as a wrapper around the Dart 53 /// The implementation of [YamlMapWrapper.nodes] as a wrapper around the Dart
54 /// map. 54 /// map.
55 class _YamlMapNodes extends MapBase<dynamic, YamlNode> 55 class _YamlMapNodes extends MapBase<dynamic, YamlNode>
56 with pkg_collection.UnmodifiableMapMixin<dynamic, YamlNode> { 56 with pkg_collection.UnmodifiableMapMixin<dynamic, YamlNode> {
57 final Map _dartMap; 57 final Map _dartMap;
58 58
59 final SourceSpan _span; 59 final SourceSpan _span;
60 60
61 Iterable get keys => _dartMap.keys.map((key) => 61 Iterable get keys => _dartMap.keys.map((key) =>
62 new YamlScalar.internal(key, _span, ScalarStyle.ANY)); 62 new YamlScalar.internalWithSpan(key, _span));
63 63
64 _YamlMapNodes(this._dartMap, this._span); 64 _YamlMapNodes(this._dartMap, this._span);
65 65
66 YamlNode operator [](Object key) { 66 YamlNode operator [](Object key) {
67 // Use "as" here because key being assigned to invalidates type propagation. 67 // Use "as" here because key being assigned to invalidates type propagation.
68 if (key is YamlScalar) key = (key as YamlScalar).value; 68 if (key is YamlScalar) key = (key as YamlScalar).value;
69 if (!_dartMap.containsKey(key)) return null; 69 if (!_dartMap.containsKey(key)) return null;
70 return _nodeForValue(_dartMap[key], _span); 70 return _nodeForValue(_dartMap[key], _span);
71 } 71 }
72 72
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 int get hashCode => _dartList.hashCode; 145 int get hashCode => _dartList.hashCode;
146 146
147 operator ==(Object other) => 147 operator ==(Object other) =>
148 other is _YamlListNodes && other._dartList == _dartList; 148 other is _YamlListNodes && other._dartList == _dartList;
149 } 149 }
150 150
151 YamlNode _nodeForValue(value, SourceSpan span) { 151 YamlNode _nodeForValue(value, SourceSpan span) {
152 if (value is Map) return new YamlMapWrapper._(value, span); 152 if (value is Map) return new YamlMapWrapper._(value, span);
153 if (value is List) return new YamlListWrapper._(value, span); 153 if (value is List) return new YamlListWrapper._(value, span);
154 return new YamlScalar.internal(value, span, ScalarStyle.ANY); 154 return new YamlScalar.internalWithSpan(value, span);
155 } 155 }
OLDNEW
« no previous file with comments | « lib/src/yaml_node.dart ('k') | lib/yaml.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698