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

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

Issue 1257793003: Add regression test for previously fixed bug. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | test/regression/0300/0388.unit » ('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 dart_style.src.chunk_builder; 5 library dart_style.src.chunk_builder;
6 6
7 import 'chunk.dart'; 7 import 'chunk.dart';
8 import 'dart_formatter.dart'; 8 import 'dart_formatter.dart';
9 import 'debug.dart' as debug; 9 import 'debug.dart' as debug;
10 import 'line_writer.dart'; 10 import 'line_writer.dart';
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 504
505 if (chunk.isHardSplit && chunk.rule != ignoredSplit) { 505 if (chunk.isHardSplit && chunk.rule != ignoredSplit) {
506 forceSplit = true; 506 forceSplit = true;
507 break; 507 break;
508 } 508 }
509 } 509 }
510 } 510 }
511 511
512 // If there is a hard newline within the block, force the surrounding rule 512 // If there is a hard newline within the block, force the surrounding rule
513 // for it so that we apply that constraint. 513 // for it so that we apply that constraint.
514 // TODO(rnystrom): This does the wrong thing when there is are multiple
515 // block arguments. We correctly force the rule, but then it gets popped
516 // off the writer's stack and it forgets it was forced. Can repro with:
517 //
518 // longFunctionName(
519 // [longElementName, longElementName, longElementName],
520 // [short]);
521 if (forceSplit) _parent.forceRules(); 514 if (forceSplit) _parent.forceRules();
522 515
523 // Write the split for the block contents themselves. 516 // Write the split for the block contents themselves.
524 _parent._writeSplit(_parent._rules.last, _parent._blockArgumentNesting.last, 517 _parent._writeSplit(_parent._rules.last, _parent._blockArgumentNesting.last,
525 flushLeft: _firstFlushLeft); 518 flushLeft: _firstFlushLeft);
526 return _parent; 519 return _parent;
527 } 520 }
528 521
529 /// Finishes writing and returns a [SourceCode] containing the final output 522 /// Finishes writing and returns a [SourceCode] containing the final output
530 /// and updated selection, if any. 523 /// and updated selection, if any.
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 } 787 }
795 788
796 // Harden every chunk that uses one of these rules. 789 // Harden every chunk that uses one of these rules.
797 for (var chunk in _chunks) { 790 for (var chunk in _chunks) {
798 if (hardenedRules.contains(chunk.rule)) { 791 if (hardenedRules.contains(chunk.rule)) {
799 chunk.harden(); 792 chunk.harden();
800 } 793 }
801 } 794 }
802 } 795 }
803 } 796 }
OLDNEW
« no previous file with comments | « no previous file | test/regression/0300/0388.unit » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698