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 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 token(node.period); | 1123 token(node.period); |
1124 visit(node.identifier); | 1124 visit(node.identifier); |
1125 } | 1125 } |
1126 | 1126 |
1127 visitPrefixExpression(PrefixExpression node) { | 1127 visitPrefixExpression(PrefixExpression node) { |
1128 token(node.operator); | 1128 token(node.operator); |
1129 | 1129 |
1130 // Corner case: put a space between successive "-" operators so we don't | 1130 // Corner case: put a space between successive "-" operators so we don't |
1131 // inadvertently turn them into a "--" decrement operator. | 1131 // inadvertently turn them into a "--" decrement operator. |
1132 if (node.operand is PrefixExpression && | 1132 if (node.operand is PrefixExpression && |
1133 node.operand.operator.lexeme == "-") { | 1133 (node.operand as PrefixExpression).operator.lexeme == "-") { |
1134 space(); | 1134 space(); |
1135 } | 1135 } |
1136 | 1136 |
1137 visit(node.operand); | 1137 visit(node.operand); |
1138 } | 1138 } |
1139 | 1139 |
1140 visitPropertyAccess(PropertyAccess node) { | 1140 visitPropertyAccess(PropertyAccess node) { |
1141 if (node.isCascaded) { | 1141 if (node.isCascaded) { |
1142 token(node.operator); | 1142 token(node.operator); |
1143 } else { | 1143 } else { |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 /// Gets the 1-based line number that the beginning of [token] lies on. | 1931 /// Gets the 1-based line number that the beginning of [token] lies on. |
1932 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; | 1932 int _startLine(Token token) => _lineInfo.getLocation(token.offset).lineNumber; |
1933 | 1933 |
1934 /// Gets the 1-based line number that the end of [token] lies on. | 1934 /// Gets the 1-based line number that the end of [token] lies on. |
1935 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; | 1935 int _endLine(Token token) => _lineInfo.getLocation(token.end).lineNumber; |
1936 | 1936 |
1937 /// Gets the 1-based column number that the beginning of [token] lies on. | 1937 /// Gets the 1-based column number that the beginning of [token] lies on. |
1938 int _startColumn(Token token) => | 1938 int _startColumn(Token token) => |
1939 _lineInfo.getLocation(token.offset).columnNumber; | 1939 _lineInfo.getLocation(token.offset).columnNumber; |
1940 } | 1940 } |
OLD | NEW |