Skip to content

Commit 234b423

Browse files
committed
Review comments and lint fixup for modern Dart
1 parent 0f6433b commit 234b423

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/src/line_number_cache.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'dart:collection';
88
import 'dart:io';
99

1010
import 'package:dartdoc/src/tuple.dart';
11-
import 'package:path/path.dart' as pathLib;
11+
import 'package:path/path.dart' as path;
1212

1313
String _getNewlineChar(String contents) {
1414
if (contents.contains("\r\n")) {
@@ -44,7 +44,7 @@ class LineNumberCache {
4444
<String, SplayTreeMap<int, int>>{};
4545

4646
Tuple2<int, int> lineAndColumn(String file, int offset) {
47-
file = pathLib.canonicalize(file);
47+
file = path.canonicalize(file);
4848
var lineMap = _lineNumbers.putIfAbsent(
4949
file, () => _createLineNumbersMap(File(file).readAsStringSync()));
5050
var lastKey = lineMap.lastKeyBefore(offset);

test/line_number_cache_test.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
1+
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

@@ -7,9 +7,9 @@ library dartdoc.cache_test;
77
import 'dart:io';
88

99
import 'package:dartdoc/src/line_number_cache.dart';
10-
import 'package:path/path.dart' as pathLib;
11-
import 'package:test/test.dart';
1210
import 'package:dartdoc/src/tuple.dart';
11+
import 'package:path/path.dart' as path;
12+
import 'package:test/test.dart';
1313

1414
void main() {
1515
group('Verify basic line cache behavior', () {
@@ -24,15 +24,15 @@ void main() {
2424
});
2525

2626
test('validate empty file behavior', () {
27-
File emptyFile = File(pathLib.join(_tempDir.path, 'empty_file'))
27+
File emptyFile = File(path.join(_tempDir.path, 'empty_file'))
2828
..writeAsStringSync('');
2929
LineNumberCache cache = LineNumberCache();
3030
expect(cache.lineAndColumn(emptyFile.path, 0), equals(Tuple2(1, 0)));
3131
});
3232

3333
test('single line without newline', () {
3434
File singleLineWithoutNewline =
35-
File(pathLib.join(_tempDir.path, 'single_line'))
35+
File(path.join(_tempDir.path, 'single_line'))
3636
..writeAsStringSync('a single line');
3737
LineNumberCache cache = LineNumberCache();
3838
expect(cache.lineAndColumn(singleLineWithoutNewline.path, 2),
@@ -42,7 +42,7 @@ void main() {
4242
});
4343

4444
test('multiple line without trailing newline', () {
45-
File multipleLine = File(pathLib.join(_tempDir.path, 'multiple_line'))
45+
File multipleLine = File(path.join(_tempDir.path, 'multiple_line'))
4646
..writeAsStringSync('This is the first line\nThis is the second line');
4747
LineNumberCache cache = LineNumberCache();
4848
expect(cache.lineAndColumn(multipleLine.path, 60), equals(Tuple2(2, 38)));
@@ -52,7 +52,7 @@ void main() {
5252
});
5353

5454
test('multiple lines with trailing newline', () {
55-
File multipleLine = File(pathLib.join(_tempDir.path, 'multiple_line'))
55+
File multipleLine = File(path.join(_tempDir.path, 'multiple_line'))
5656
..writeAsStringSync(
5757
'This is the first line\nThis is the second line\n');
5858
LineNumberCache cache = LineNumberCache();

0 commit comments

Comments
 (0)