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

Side by Side Diff: pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Issue 1086273002: Fix for linked position offsets when insert directly before. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/analysis_server/test/services/correction/fix_test.dart » ('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) 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 analysis_server.src.services.correction.fix_internal; 5 library analysis_server.src.services.correction.fix_internal;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analysis_server/edit/fix/fix_core.dart'; 9 import 'package:analysis_server/edit/fix/fix_core.dart';
10 import 'package:analysis_server/edit/fix/fix_dart.dart'; 10 import 'package:analysis_server/edit/fix/fix_dart.dart';
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 SourceEdit edit = new SourceEdit(offset, 0, text); 1881 SourceEdit edit = new SourceEdit(offset, 0, text);
1882 _addEdit(target, edit); 1882 _addEdit(target, edit);
1883 } 1883 }
1884 1884
1885 /** 1885 /**
1886 * Adds a single linked position to [groupId]. 1886 * Adds a single linked position to [groupId].
1887 */ 1887 */
1888 void _addLinkedPosition(String groupId, SourceBuilder sb, SourceRange range) { 1888 void _addLinkedPosition(String groupId, SourceBuilder sb, SourceRange range) {
1889 // prepare offset 1889 // prepare offset
1890 int offset = range.offset; 1890 int offset = range.offset;
1891 if (sb.offset < offset) { 1891 if (sb.offset <= offset) {
1892 int delta = sb.length; 1892 int delta = sb.length;
1893 offset += delta; 1893 offset += delta;
1894 } 1894 }
1895 // prepare group 1895 // prepare group
1896 LinkedEditGroup group = _getLinkedPosition(groupId); 1896 LinkedEditGroup group = _getLinkedPosition(groupId);
1897 // add position 1897 // add position
1898 Position position = new Position(file, offset); 1898 Position position = new Position(file, offset);
1899 group.addPosition(position, range.length); 1899 group.addPosition(position, range.length);
1900 } 1900 }
1901 1901
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2502 /** 2502 /**
2503 * Describes the location for a newly created [FieldDeclaration]. 2503 * Describes the location for a newly created [FieldDeclaration].
2504 */ 2504 */
2505 class _FieldLocation { 2505 class _FieldLocation {
2506 final String prefix; 2506 final String prefix;
2507 final int offset; 2507 final int offset;
2508 final String suffix; 2508 final String suffix;
2509 2509
2510 _FieldLocation(this.prefix, this.offset, this.suffix); 2510 _FieldLocation(this.prefix, this.offset, this.suffix);
2511 } 2511 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698