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

Issue 1281313002: Fix regression in import fixups introduced by .packages support. (Closed)

Created:
5 years, 4 months ago by Paul Berry
Modified:
5 years, 4 months ago
Reviewers:
Brian Wilkerson
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Fix regression in import fixups introduced by .packages support. With the introduction of support for ".packages" files, analysis server now uses a slightly different code path for translating the Source objects from imported package files into "package:" URI's. Previously it used PackageUriResolver.resolveAbsolute(); now it uses ResourceUriResolver.resolveAbsolute(), and then translates the resulting file: URI to a package: URI uring the .packages file. The old code path used Source.fullName (the file path) to locate the file in the filesystem; the new code path uses Source.uri. This causes problems because when figuring out the correct import statement to insert, the analysis server creates a bogus Source object whose uri field is null. As a result, import fixups were getting relative paths like "../../../../.pub-cache/..." rather than package imports, which is clearly wrong. As a short term non-invasive fix, we set Source.uri in the bogus Source object, so that the new codepath is able to find the path of the imported file. R=brianwilkerson@google.com Committed: https://github.com/dart-lang/sdk/commit/f3f52d4b59081e2f294126ac7f69f902968692d7

Patch Set 1 #

Patch Set 2 : Cleaner fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -6 lines) Patch
M pkg/analysis_server/lib/src/services/correction/fix_internal.dart View 2 chunks +2 lines, -2 lines 0 comments Download
M pkg/analysis_server/lib/src/services/correction/util.dart View 1 1 chunk +4 lines, -3 lines 0 comments Download
M pkg/analysis_server/test/services/correction/fix_test.dart View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 4 (1 generated)
Paul Berry
5 years, 4 months ago (2015-08-10 18:22:49 UTC) #2
Brian Wilkerson
LGTM
5 years, 4 months ago (2015-08-10 18:32:12 UTC) #3
Paul Berry
5 years, 4 months ago (2015-08-10 19:14:31 UTC) #4
Message was sent while issue was closed.
Committed patchset #2 (id:20001) manually as
f3f52d4b59081e2f294126ac7f69f902968692d7 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698