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

Side by Side Diff: pkg/analyzer/lib/src/services/formatter_impl.dart

Issue 125103003: Formatter workaround for missing abstract keyword in ClassTypeAliases (dartbug.com/15912). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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/analyzer/test/services/data/cu_tests.data » ('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 library formatter_impl; 5 library formatter_impl;
6 6
7 import 'dart:math'; 7 import 'dart:math';
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/src/generated/java_core.dart' show CharSequence; 10 import 'package:analyzer/src/generated/java_core.dart' show CharSequence;
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 }); 509 });
510 token(node.leftBracket); 510 token(node.leftBracket);
511 indent(); 511 indent();
512 visitNodes(node.members, precededBy: newlines, separatedBy: newlines); 512 visitNodes(node.members, precededBy: newlines, separatedBy: newlines);
513 unindent(); 513 unindent();
514 newlines(); 514 newlines();
515 token(node.rightBracket); 515 token(node.rightBracket);
516 } 516 }
517 517
518 visitClassTypeAlias(ClassTypeAlias node) { 518 visitClassTypeAlias(ClassTypeAlias node) {
519 preserveLeadingNewlines();
520 //TODO(pquitslund): the following _should_ work (dartbug.com/15912)
521 //modifier(node.abstractKeyword);
522 // ... in the meantime we use this workaround
523 var prev = node.keyword.previous;
524 if (prev.keyword == Keyword.ABSTRACT) {
525 token(prev);
526 space();
527 }
519 token(node.keyword); 528 token(node.keyword);
520 space(); 529 space();
521 visit(node.name); 530 visit(node.name);
522 visit(node.typeParameters); 531 visit(node.typeParameters);
523 space(); 532 space();
524 token(node.equals); 533 token(node.equals);
525 space(); 534 space();
526 if (node.abstractKeyword != null) {
527 token(node.abstractKeyword);
528 space();
529 }
530 visit(node.superclass); 535 visit(node.superclass);
531 visitNode(node.withClause, precededBy: space); 536 visitNode(node.withClause, precededBy: space);
532 visitNode(node.implementsClause, precededBy: space); 537 visitNode(node.implementsClause, precededBy: space);
533 token(node.semicolon); 538 token(node.semicolon);
534 } 539 }
535 540
536 visitComment(Comment node) => null; 541 visitComment(Comment node) => null;
537 542
538 visitCommentReference(CommentReference node) => null; 543 visitCommentReference(CommentReference node) => null;
539 544
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 var lastLine = 1633 var lastLine =
1629 lineInfo.getLocation(lastOffset).lineNumber; 1634 lineInfo.getLocation(lastOffset).lineNumber;
1630 var currentLine = 1635 var currentLine =
1631 lineInfo.getLocation(currentOffset).lineNumber; 1636 lineInfo.getLocation(currentOffset).lineNumber;
1632 return currentLine - lastLine; 1637 return currentLine - lastLine;
1633 } 1638 }
1634 1639
1635 String toString() => writer.toString(); 1640 String toString() => writer.toString();
1636 1641
1637 } 1642 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/services/data/cu_tests.data » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698