OLD | NEW |
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.source_visitor; | 5 library dart_style.src.source_visitor; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
8 import 'package:analyzer/src/generated/scanner.dart'; | 8 import 'package:analyzer/src/generated/scanner.dart'; |
9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
10 | 10 |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 } | 640 } |
641 | 641 |
642 visitEnumDeclaration(EnumDeclaration node) { | 642 visitEnumDeclaration(EnumDeclaration node) { |
643 visitDeclarationMetadata(node.metadata); | 643 visitDeclarationMetadata(node.metadata); |
644 | 644 |
645 token(node.enumKeyword); | 645 token(node.enumKeyword); |
646 space(); | 646 space(); |
647 visit(node.name); | 647 visit(node.name); |
648 space(); | 648 space(); |
649 | 649 |
650 _writeBody(node.leftBracket, node.rightBracket, | 650 _writeBody(node.leftBracket, node.rightBracket, space: true, body: () { |
651 space: true, | 651 visitCommaSeparatedNodes(node.constants, between: split); |
652 body: () { | 652 }); |
653 visitCommaSeparatedNodes(node.constants, between: split); | |
654 }); | |
655 } | 653 } |
656 | 654 |
657 visitExportDirective(ExportDirective node) { | 655 visitExportDirective(ExportDirective node) { |
658 visitDeclarationMetadata(node.metadata); | 656 visitDeclarationMetadata(node.metadata); |
659 | 657 |
660 _simpleStatement(node, () { | 658 _simpleStatement(node, () { |
661 token(node.keyword); | 659 token(node.keyword); |
662 space(); | 660 space(); |
663 visit(node.uri); | 661 visit(node.uri); |
664 | 662 |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2161 /// Gets the 1-based line number that the beginning of [token] lies on. | 2159 /// Gets the 1-based line number that the beginning of [token] lies on. |
2162 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; | 2160 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; |
2163 | 2161 |
2164 /// Gets the 1-based line number that the end of [token] lies on. | 2162 /// Gets the 1-based line number that the end of [token] lies on. |
2165 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; | 2163 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; |
2166 | 2164 |
2167 /// Gets the 1-based column number that the beginning of [token] lies on. | 2165 /// Gets the 1-based column number that the beginning of [token] lies on. |
2168 int _startColumn(Token token) => | 2166 int _startColumn(Token token) => |
2169 _lineInfo.getLocation(token.offset).columnNumber; | 2167 _lineInfo.getLocation(token.offset).columnNumber; |
2170 } | 2168 } |
OLD | NEW |