Skip to content

Fix line number cache #1939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed

Fix line number cache #1939

wants to merge 6 commits into from

Conversation

jcollins-g
Copy link
Contributor

Fixes #1938. The line number cache had some fencepost problems and this corrects them, adding tests. Also eliminates caching of file contents that won't be used more than once, anyway.

Note: dartfmt has some ideas about formatting that seem to have changed in the last version. See the first commit for real changes.

@googlebot googlebot added the cla: yes Google CLA check succeeded. label Feb 20, 2019
@jcollins-g jcollins-g requested review from pq and devoncarew February 20, 2019 20:40
@coveralls
Copy link

coveralls commented Feb 20, 2019

Coverage Status

Coverage decreased (-0.01%) to 94.08% when pulling 234b423 on fix-line-number-cache into 729d946 on master.

@@ -0,0 +1,65 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to 2019?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

import 'package:dartdoc/src/line_number_cache.dart';
import 'package:path/path.dart' as pathLib;
import 'package:test/test.dart';
import 'package:dartdoc/src/tuple.dart';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


test('single line without newline', () {
File singleLineWithoutNewline =
File(pathLib.join(_tempDir.path, 'single_line'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It hardly matters but I'm a little surprised to see news elided here (and not elsewhere).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new is now consistently absent.

Copy link
Contributor Author

@jcollins-g jcollins-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resynced with head, review comments addressed. PTAL.

@@ -0,0 +1,65 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

import 'package:dartdoc/src/line_number_cache.dart';
import 'package:path/path.dart' as pathLib;
import 'package:test/test.dart';
import 'package:dartdoc/src/tuple.dart';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


test('single line without newline', () {
File singleLineWithoutNewline =
File(pathLib.join(_tempDir.path, 'single_line'))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new is now consistently absent.

@jcollins-g jcollins-g requested review from pq and removed request for pq and devoncarew September 30, 2019 21:19
@jcollins-g
Copy link
Contributor Author

jcollins-g commented Sep 30, 2019

This results in a display error as originally written for locations that can't be found.

  warning: unresolved doc reference [asBroadcast]
    from dart-web_audio.ScriptProcessorNode.onAudioProcess: (file:///Users/jcollins/dart/all_sdks/2.6.0-dev.4.0/lib/web_audio/dart2js/web_audio_dart2js.dart:1:-1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA check succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dartdoc throws exception attempting to find offset inside empty file
4 participants