| 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 /** | 5 /** |
| 6 * Code transform for @observable. The core transformation is relatively | 6 * Code transform for @observable. The core transformation is relatively |
| 7 * straightforward, and essentially like an editor refactoring. | 7 * straightforward, and essentially like an editor refactoring. |
| 8 */ | 8 */ |
| 9 library observe.transformer; | 9 library observe.transformer; |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 /** | 21 /** |
| 22 * A [Transformer] that replaces observables based on dirty-checking with an | 22 * A [Transformer] that replaces observables based on dirty-checking with an |
| 23 * implementation based on change notifications. | 23 * implementation based on change notifications. |
| 24 * | 24 * |
| 25 * The transformation adds hooks for field setters and notifies the observation | 25 * The transformation adds hooks for field setters and notifies the observation |
| 26 * system of the change. | 26 * system of the change. |
| 27 */ | 27 */ |
| 28 class ObservableTransformer extends Transformer { | 28 class ObservableTransformer extends Transformer { |
| 29 | 29 |
| 30 final List<String> _files; | 30 final List<String> _files; |
| 31 ObservableTransformer() : _files = null; | 31 ObservableTransformer([List<String> files]) : _files = files; |
| 32 ObservableTransformer.asPlugin(BarbackSettings settings) | 32 ObservableTransformer.asPlugin(BarbackSettings settings) |
| 33 : _files = _readFiles(settings.configuration['files']); | 33 : _files = _readFiles(settings.configuration['files']); |
| 34 | 34 |
| 35 static List<String> _readFiles(value) { | 35 static List<String> _readFiles(value) { |
| 36 if (value == null) return null; | 36 if (value == null) return null; |
| 37 var files = []; | 37 var files = []; |
| 38 bool error; | 38 bool error; |
| 39 if (value is List) { | 39 if (value is List) { |
| 40 files = value; | 40 files = value; |
| 41 error = value.any((e) => e is! String); | 41 error = value.any((e) => e is! String); |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 430 |
| 431 Token _findFieldSeperator(Token token) { | 431 Token _findFieldSeperator(Token token) { |
| 432 while (token != null) { | 432 while (token != null) { |
| 433 if (token.type == TokenType.COMMA || token.type == TokenType.SEMICOLON) { | 433 if (token.type == TokenType.COMMA || token.type == TokenType.SEMICOLON) { |
| 434 break; | 434 break; |
| 435 } | 435 } |
| 436 token = token.next; | 436 token = token.next; |
| 437 } | 437 } |
| 438 return token; | 438 return token; |
| 439 } | 439 } |
| OLD | NEW |