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

Side by Side Diff: pkg/compiler/lib/src/io/position_information.dart

Issue 2804613003: Make lines and columns one-based in SourceLocation. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/io/source_information.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// Source information system mapping that attempts a semantic mapping between 5 /// Source information system mapping that attempts a semantic mapping between
6 /// offsets of JavaScript code points to offsets of Dart code points. 6 /// offsets of JavaScript code points to offsets of Dart code points.
7 7
8 library dart2js.source_information.position; 8 library dart2js.source_information.position;
9 9
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 closingPosition == other.closingPosition; 62 closingPosition == other.closingPosition;
63 } 63 }
64 64
65 /// Create a textual representation of the source information using [uriText] 65 /// Create a textual representation of the source information using [uriText]
66 /// as the Uri representation. 66 /// as the Uri representation.
67 String _computeText(String uriText) { 67 String _computeText(String uriText) {
68 StringBuffer sb = new StringBuffer(); 68 StringBuffer sb = new StringBuffer();
69 sb.write('$uriText:'); 69 sb.write('$uriText:');
70 // Use 1-based line/column info to match usual dart tool output. 70 // Use 1-based line/column info to match usual dart tool output.
71 if (startPosition != null) { 71 if (startPosition != null) {
72 sb.write('[${startPosition.line + 1},' 72 sb.write('[${startPosition.line},'
73 '${startPosition.column + 1}]'); 73 '${startPosition.column}]');
74 } 74 }
75 if (closingPosition != null) { 75 if (closingPosition != null) {
76 sb.write('-[${closingPosition.line + 1},' 76 sb.write('-[${closingPosition.line},'
77 '${closingPosition.column + 1}]'); 77 '${closingPosition.column}]');
78 } 78 }
79 return sb.toString(); 79 return sb.toString();
80 } 80 }
81 81
82 String get shortText { 82 String get shortText {
83 if (startPosition != null) { 83 if (startPosition != null) {
84 return _computeText(startPosition.sourceUri.pathSegments.last); 84 return _computeText(startPosition.sourceUri.pathSegments.last);
85 } else { 85 } else {
86 return _computeText(closingPosition.sourceUri.pathSegments.last); 86 return _computeText(closingPosition.sourceUri.pathSegments.last);
87 } 87 }
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 1336
1337 @override 1337 @override
1338 CodePosition operator [](js.Node node) { 1338 CodePosition operator [](js.Node node) {
1339 CodePosition codePosition = codePositions[node]; 1339 CodePosition codePosition = codePositions[node];
1340 if (codePosition == null) { 1340 if (codePosition == null) {
1341 coverage.registerNodesWithoutOffset(node); 1341 coverage.registerNodesWithoutOffset(node);
1342 } 1342 }
1343 return codePosition; 1343 return codePosition;
1344 } 1344 }
1345 } 1345 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/io/source_information.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698