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

Side by Side Diff: pkg/observe/lib/transform.dart

Issue 23742002: Fix observable transform bug introduced in a recent change, add regression tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/observe/test/transform_test.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) 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.transform; 9 library observe.transform;
10 10
(...skipping 30 matching lines...) Expand all
41 Future apply(Transform transform) { 41 Future apply(Transform transform) {
42 return transform.primaryInput.readAsString().then((content) { 42 return transform.primaryInput.readAsString().then((content) {
43 var id = transform.primaryInput.id; 43 var id = transform.primaryInput.id;
44 // TODO(sigmund): improve how we compute this url 44 // TODO(sigmund): improve how we compute this url
45 var url = id.path.startsWith('lib/') 45 var url = id.path.startsWith('lib/')
46 ? 'package:${id.package}/${id.path.substring(4)}' : id.path; 46 ? 'package:${id.package}/${id.path.substring(4)}' : id.path;
47 var sourceFile = new SourceFile.text(url, content); 47 var sourceFile = new SourceFile.text(url, content);
48 var transaction = _transformCompilationUnit( 48 var transaction = _transformCompilationUnit(
49 content, sourceFile, transform.logger); 49 content, sourceFile, transform.logger);
50 if (!transaction.hasEdits) { 50 if (!transaction.hasEdits) {
51 transform.addOutput(input); 51 transform.addOutput(transform.primaryInput);
52 return; 52 return;
53 } 53 }
54 var printer = transaction.commit(); 54 var printer = transaction.commit();
55 // TODO(sigmund): emit source maps when barback supports it (see 55 // TODO(sigmund): emit source maps when barback supports it (see
56 // dartbug.com/12340) 56 // dartbug.com/12340)
57 printer.build(url); 57 printer.build(url);
58 transform.addOutput(new Asset.fromString(id, printer.text)); 58 transform.addOutput(new Asset.fromString(id, printer.text));
59 }); 59 });
60 } 60 }
61 } 61 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 $type __\$$name$initializer; 321 $type __\$$name$initializer;
322 $type get $name => __\$$name; 322 $type get $name => __\$$name;
323 set $name($type value) { 323 set $name($type value) {
324 __\$$name = notifyPropertyChange(const Symbol('$name'), __\$$name, value); 324 __\$$name = notifyPropertyChange(const Symbol('$name'), __\$$name, value);
325 } 325 }
326 '''.replaceAll('\n', '\n$indent')); 326 '''.replaceAll('\n', '\n$indent'));
327 } 327 }
328 328
329 code.edit(begin, end, '$replace'); 329 code.edit(begin, end, '$replace');
330 } 330 }
OLDNEW
« no previous file with comments | « no previous file | pkg/observe/test/transform_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698