| 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; |
| 11 import 'package:analysis_server/src/services/correction/source_range.dart'; | 11 import 'package:analysis_server/src/services/correction/source_range.dart'; |
| 12 import 'package:analysis_server/src/services/correction/strings.dart'; | 12 import 'package:analysis_server/src/services/correction/strings.dart'; |
| 13 import 'package:analyzer/src/generated/ast.dart'; | 13 import 'package:analyzer/src/generated/ast.dart'; |
| 14 import 'package:analyzer/src/generated/element.dart'; | 14 import 'package:analyzer/src/generated/element.dart'; |
| 15 import 'package:analyzer/src/generated/engine.dart'; | 15 import 'package:analyzer/src/generated/engine.dart'; |
| 16 import 'package:analyzer/src/generated/resolver.dart'; | 16 import 'package:analyzer/src/generated/resolver.dart'; |
| 17 import 'package:analyzer/src/generated/scanner.dart'; | 17 import 'package:analyzer/src/generated/scanner.dart'; |
| 18 import 'package:analyzer/src/generated/source.dart'; | 18 import 'package:analyzer/src/generated/source.dart'; |
| 19 | 19 |
| 20 | 20 |
| 21 void addElementSourceChange(SourceChange change, Element element, | |
| 22 SourceEdit edit) { | |
| 23 AnalysisContext context = element.context; | |
| 24 Source source = element.source; | |
| 25 addSourceChange(change, context, source, edit); | |
| 26 } | |
| 27 | |
| 28 | |
| 29 void addSourceChange(SourceChange change, AnalysisContext context, | |
| 30 Source source, SourceEdit edit) { | |
| 31 String file = source.fullName; | |
| 32 int fileStamp = context.getModificationStamp(source); | |
| 33 change.addEdit(file, fileStamp, edit); | |
| 34 } | |
| 35 | |
| 36 | |
| 37 /** | 21 /** |
| 38 * @return <code>true</code> if given [List]s are identical at given position. | 22 * @return <code>true</code> if given [List]s are identical at given position. |
| 39 */ | 23 */ |
| 40 bool allListsIdentical(List<List> lists, int position) { | 24 bool allListsIdentical(List<List> lists, int position) { |
| 41 Object element = lists[0][position]; | 25 Object element = lists[0][position]; |
| 42 for (List list in lists) { | 26 for (List list in lists) { |
| 43 if (list[position] != element) { | 27 if (list[position] != element) { |
| 44 return false; | 28 return false; |
| 45 } | 29 } |
| 46 } | 30 } |
| (...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 | 1383 |
| 1400 @override | 1384 @override |
| 1401 Object visitExpression(Expression node) { | 1385 Object visitExpression(Expression node) { |
| 1402 if (node is BinaryExpression && node.operator.type == groupOperatorType) { | 1386 if (node is BinaryExpression && node.operator.type == groupOperatorType) { |
| 1403 return super.visitNode(node); | 1387 return super.visitNode(node); |
| 1404 } | 1388 } |
| 1405 operands.add(node); | 1389 operands.add(node); |
| 1406 return null; | 1390 return null; |
| 1407 } | 1391 } |
| 1408 } | 1392 } |
| OLD | NEW |