OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 observe; | 5 part of observe; |
6 | 6 |
7 // This code is inspired by ChangeSummary: | 7 // This code is inspired by ChangeSummary: |
8 // https://github.com/rafaelw/ChangeSummary/blob/master/change_summary.js | 8 // https://github.com/rafaelw/ChangeSummary/blob/master/change_summary.js |
9 // ...which underlies MDV. Since we don't need the functionality of | 9 // ...which underlies MDV. Since we don't need the functionality of |
10 // ChangeSummary, we just implement what we need for data bindings. | 10 // ChangeSummary, we just implement what we need for data bindings. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 if (identical(_values[i + 1], newValue)) { | 125 if (identical(_values[i + 1], newValue)) { |
126 _observePath(start, i); | 126 _observePath(start, i); |
127 return; | 127 return; |
128 } | 128 } |
129 _values[i + 1] = newValue; | 129 _values[i + 1] = newValue; |
130 changed = true; | 130 changed = true; |
131 } | 131 } |
132 | 132 |
133 _observePath(start); | 133 _observePath(start); |
134 if (changed) { | 134 if (changed) { |
135 notifyChange(new PropertyChangeRecord(const Symbol('value'))); | 135 notifyChange(new PropertyChangeRecord(#value)); |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 void _observePath([int start = 0, int end]) { | 139 void _observePath([int start = 0, int end]) { |
140 if (end == null) end = _segments.length; | 140 if (end == null) end = _segments.length; |
141 | 141 |
142 for (int i = start; i < end; i++) { | 142 for (int i = start; i < end; i++) { |
143 if (_subs[i] != null) _subs[i].cancel(); | 143 if (_subs[i] != null) _subs[i].cancel(); |
144 _observeIndex(i); | 144 _observeIndex(i); |
145 } | 145 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 final _spacesRegExp = new RegExp(r'\s'); | 239 final _spacesRegExp = new RegExp(r'\s'); |
240 | 240 |
241 bool _isPathValid(String s) { | 241 bool _isPathValid(String s) { |
242 s = s.replaceAll(_spacesRegExp, ''); | 242 s = s.replaceAll(_spacesRegExp, ''); |
243 | 243 |
244 if (s == '') return true; | 244 if (s == '') return true; |
245 if (s[0] == '.') return false; | 245 if (s[0] == '.') return false; |
246 return _pathRegExp.hasMatch(s); | 246 return _pathRegExp.hasMatch(s); |
247 } | 247 } |
OLD | NEW |