| 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 services.src.correction.util; | 5 library services.src.correction.util; |
| 6 | 6 |
| 7 import 'dart:math'; | 7 import 'dart:math'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' show SourceChange, | 9 import 'package:analysis_server/src/protocol.dart' show SourceChange, |
| 10 SourceEdit; | 10 SourceEdit; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 Source fileSource = new NonExistingSource(path, UriKind.FILE_URI); | 65 Source fileSource = new NonExistingSource(path, UriKind.FILE_URI); |
| 66 Uri uri = context.sourceFactory.restoreUri(fileSource); | 66 Uri uri = context.sourceFactory.restoreUri(fileSource); |
| 67 if (uri == null) { | 67 if (uri == null) { |
| 68 return null; | 68 return null; |
| 69 } | 69 } |
| 70 return uri.toString(); | 70 return uri.toString(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * TODO(scheglov) replace with nodes once there will be [CompilationUnit#getComm
ents]. | 75 * TODO(scheglov) replace with nodes once there will be [CompilationUnit.getComm
ents]. |
| 76 * | 76 * |
| 77 * Returns [SourceRange]s of all comments in [unit]. | 77 * Returns [SourceRange]s of all comments in [unit]. |
| 78 */ | 78 */ |
| 79 List<SourceRange> getCommentRanges(CompilationUnit unit) { | 79 List<SourceRange> getCommentRanges(CompilationUnit unit) { |
| 80 List<SourceRange> ranges = <SourceRange>[]; | 80 List<SourceRange> ranges = <SourceRange>[]; |
| 81 Token token = unit.beginToken; | 81 Token token = unit.beginToken; |
| 82 while (token != null && token.type != TokenType.EOF) { | 82 while (token != null && token.type != TokenType.EOF) { |
| 83 Token commentToken = token.precedingComments; | 83 Token commentToken = token.precedingComments; |
| 84 while (commentToken != null) { | 84 while (commentToken != null) { |
| 85 ranges.add(rangeToken(commentToken)); | 85 ranges.add(rangeToken(commentToken)); |
| (...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 | 1450 |
| 1451 @override | 1451 @override |
| 1452 Object visitExpression(Expression node) { | 1452 Object visitExpression(Expression node) { |
| 1453 if (node is BinaryExpression && node.operator.type == groupOperatorType) { | 1453 if (node is BinaryExpression && node.operator.type == groupOperatorType) { |
| 1454 return super.visitNode(node); | 1454 return super.visitNode(node); |
| 1455 } | 1455 } |
| 1456 operands.add(node); | 1456 operands.add(node); |
| 1457 return null; | 1457 return null; |
| 1458 } | 1458 } |
| 1459 } | 1459 } |
| OLD | NEW |