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

Side by Side Diff: pkg/analysis_services/lib/src/correction/source_buffer.dart

Issue 418203002: Implement more fixes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments Created 6 years, 5 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
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library services.src.correction.source_buffer; 8 library services.src.correction.source_buffer;
9 9
10 import 'package:analysis_services/correction/change.dart'; 10 import 'package:analysis_services/correction/change.dart';
11 import 'package:analyzer/src/generated/source.dart'; 11 import 'package:analyzer/src/generated/source.dart';
12 12
13 13
14 /** 14 /**
15 * Helper for building Dart source with linked positions. 15 * Helper for building Dart source with linked positions.
16 */ 16 */
17 class SourceBuilder { 17 class SourceBuilder {
18 final String file; 18 final String file;
19 final int offset; 19 final int offset;
20 final StringBuffer _buffer = new StringBuffer(); 20 final StringBuffer _buffer = new StringBuffer();
21 21
22 final List<LinkedPositionGroup> linkedPositionGroups = <LinkedPositionGroup>[ 22 final List<LinkedPositionGroup> linkedPositionGroups = <LinkedPositionGroup>[
23 ]; 23 ];
24 LinkedPositionGroup _currentLinkedPositionGroup; 24 LinkedPositionGroup _currentLinkedPositionGroup;
25 int _currentPositionStart; 25 int _currentPositionStart;
26 26
27 SourceBuilder(this.file, this.offset); 27 SourceBuilder(this.file, this.offset);
28 28
29 SourceBuilder.buffer() : file = null, offset = 0;
30
31 int get length => _buffer.length;
32
29 void addProposal(String proposal) { 33 void addProposal(String proposal) {
30 // TODO(scheglov) implement 34 // TODO(scheglov) implement
31 // _currentPositionGroup.addProposal(); 35 // _currentPositionGroup.addProposal();
32 } 36 }
33 37
34 void addProposals(List<String> proposals) { 38 void addProposals(List<String> proposals) {
35 proposals.forEach((proposal) => addProposal(proposal)); 39 proposals.forEach((proposal) => addProposal(proposal));
36 } 40 }
37 41
38 /** 42 /**
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 /** 80 /**
77 * Adds position location [SourceRange] using current fields. 81 * Adds position location [SourceRange] using current fields.
78 */ 82 */
79 void _addPosition() { 83 void _addPosition() {
80 int start = offset + _currentPositionStart; 84 int start = offset + _currentPositionStart;
81 int end = offset + _buffer.length; 85 int end = offset + _buffer.length;
82 Position position = new Position(file, start, end - start); 86 Position position = new Position(file, start, end - start);
83 _currentLinkedPositionGroup.add(position); 87 _currentLinkedPositionGroup.add(position);
84 } 88 }
85 } 89 }
OLDNEW
« no previous file with comments | « pkg/analysis_services/lib/src/correction/fix.dart ('k') | pkg/analysis_services/lib/src/correction/strings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698