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

Issue 1917863005: Qualify library names in packages (Closed)

Created:
4 years, 7 months ago by vsm
Modified:
4 years, 7 months ago
CC:
dev-compiler+reviews_dartlang.org
Base URL:
https://github.com/dart-lang/dev_compiler.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Qualify library names in packages Partially addresses #504. This is WIP, but wanted your thoughts. Comment / questions: - The current js_ast ImportDeclaration assumes a legal identifier I think. E.g., this gets lowered: import { src$interfaces } from "matcher" - Should we thread package root through ModuleCompiler to let it packagify urls? - How should we handle non-package urls? Pass in an explicit root dir and go relative? R=jmesserly@google.com Committed: https://github.com/dart-lang/dev_compiler/commit/bea365789e72bcc0c9e3dd7e5f87992d6d17bb3f

Patch Set 1 #

Total comments: 2

Patch Set 2 : Use restoreAbsolute #

Total comments: 13

Patch Set 3 : Revert restoreUri changes and add build-root for non-package files #

Patch Set 4 : One more revert #

Patch Set 5 : Rebase #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+241 lines, -192 lines) Patch
M lib/src/compiler/code_generator.dart View 1 2 3 4 5 chunks +30 lines, -5 lines 7 comments Download
M lib/src/compiler/command.dart View 1 2 2 chunks +12 lines, -1 line 0 comments Download
M lib/src/compiler/compiler.dart View 1 2 2 chunks +4 lines, -1 line 0 comments Download
M test/codegen/expect/language-all.js View 1 2 3 4 Binary file 0 comments Download
M test/codegen/expect/unittest.js View 1 2 4 chunks +87 lines, -87 lines 0 comments Download
M test/codegen/expect/unittest/unittest.js View 1 2 4 chunks +87 lines, -87 lines 0 comments Download
M test/codegen_test.dart View 1 2 7 chunks +21 lines, -11 lines 0 comments Download

Messages

Total messages: 27 (6 generated)
vsm
4 years, 7 months ago (2016-04-26 20:11:52 UTC) #3
vsm
On 2016/04/26 20:11:52, vsm wrote: We may have multiple package roots (multi-resolver).
4 years, 7 months ago (2016-04-26 20:50:53 UTC) #5
Jennifer Messerly
https://codereview.chromium.org/1917863005/diff/1/lib/src/compiler/code_generator.dart File lib/src/compiler/code_generator.dart (right): https://codereview.chromium.org/1917863005/diff/1/lib/src/compiler/code_generator.dart#newcode3769 lib/src/compiler/code_generator.dart:3769: var packageRelativePath = uri.pathSegments.skip(1).join('/'); Yeah in general it's not ...
4 years, 7 months ago (2016-04-26 22:59:34 UTC) #6
Jennifer Messerly
BTW it would be nice to replace $47, but conceptually this LGTM, definitely the easiest ...
4 years, 7 months ago (2016-04-26 23:32:29 UTC) #7
vsm
Using the analyzer's restoreAbsolute now. https://codereview.chromium.org/1917863005/diff/20001/lib/src/analyzer/multi_package_resolver.dart File lib/src/analyzer/multi_package_resolver.dart (right): https://codereview.chromium.org/1917863005/diff/20001/lib/src/analyzer/multi_package_resolver.dart#newcode46 lib/src/analyzer/multi_package_resolver.dart:46: var libIndex = segments.lastIndexOf('lib'); ...
4 years, 7 months ago (2016-04-27 18:24:35 UTC) #9
Jennifer Messerly
Not sure if you saw my comments from the first round? The new code looks ...
4 years, 7 months ago (2016-04-27 18:30:06 UTC) #10
Paul Berry
Note: you might want to read my last comment first, since it might render the ...
4 years, 7 months ago (2016-04-27 19:19:57 UTC) #11
Jennifer Messerly
https://codereview.chromium.org/1917863005/diff/20001/lib/src/compiler/code_generator.dart File lib/src/compiler/code_generator.dart (right): https://codereview.chromium.org/1917863005/diff/20001/lib/src/compiler/code_generator.dart#newcode3770 lib/src/compiler/code_generator.dart:3770: var uri = resolver.restoreAbsolute(library.source); On 2016/04/27 19:19:57, Paul Berry ...
4 years, 7 months ago (2016-04-27 19:24:21 UTC) #12
vsm
thanks! still iterating but some quick replies... :-) https://codereview.chromium.org/1917863005/diff/20001/lib/src/compiler/code_generator.dart File lib/src/compiler/code_generator.dart (right): https://codereview.chromium.org/1917863005/diff/20001/lib/src/compiler/code_generator.dart#newcode3768 lib/src/compiler/code_generator.dart:3768: var ...
4 years, 7 months ago (2016-04-27 20:56:09 UTC) #13
vsm
On 2016/04/27 20:56:09, vsm wrote: > thanks! still iterating but some quick replies... :-) > ...
4 years, 7 months ago (2016-04-27 21:13:20 UTC) #14
Paul Berry
https://codereview.chromium.org/1917863005/diff/20001/lib/src/compiler/code_generator.dart File lib/src/compiler/code_generator.dart (right): https://codereview.chromium.org/1917863005/diff/20001/lib/src/compiler/code_generator.dart#newcode3770 lib/src/compiler/code_generator.dart:3770: var uri = resolver.restoreAbsolute(library.source); On 2016/04/27 20:56:08, vsm wrote: ...
4 years, 7 months ago (2016-04-27 21:13:49 UTC) #15
Jennifer Messerly
https://codereview.chromium.org/1917863005/diff/20001/lib/src/compiler/code_generator.dart File lib/src/compiler/code_generator.dart (right): https://codereview.chromium.org/1917863005/diff/20001/lib/src/compiler/code_generator.dart#newcode3770 lib/src/compiler/code_generator.dart:3770: var uri = resolver.restoreAbsolute(library.source); On 2016/04/27 21:13:49, Paul Berry ...
4 years, 7 months ago (2016-04-27 21:52:52 UTC) #16
vsm
PTAL Ripped out restoreUri code. Added build-root for non-package uris.
4 years, 7 months ago (2016-04-27 23:27:28 UTC) #17
Jennifer Messerly
LGTM!
4 years, 7 months ago (2016-04-28 00:05:44 UTC) #18
vsm
Committed patchset #5 (id:80001) manually as bea365789e72bcc0c9e3dd7e5f87992d6d17bb3f (presubmit successful).
4 years, 7 months ago (2016-04-28 04:04:10 UTC) #20
Siggi Cherem (dart-lang)
lgtm - so in terms of how to use this, if I wanted the root ...
4 years, 7 months ago (2016-04-28 15:13:28 UTC) #21
vsm
https://codereview.chromium.org/1917863005/diff/80001/lib/src/compiler/code_generator.dart File lib/src/compiler/code_generator.dart (right): https://codereview.chromium.org/1917863005/diff/80001/lib/src/compiler/code_generator.dart#newcode3864 lib/src/compiler/code_generator.dart:3864: throw 'Invalid build root. $buildRoot does not contain ${uri.path}'; ...
4 years, 7 months ago (2016-04-28 15:31:45 UTC) #22
Siggi Cherem (dart-lang)
https://codereview.chromium.org/1917863005/diff/80001/lib/src/compiler/code_generator.dart File lib/src/compiler/code_generator.dart (right): https://codereview.chromium.org/1917863005/diff/80001/lib/src/compiler/code_generator.dart#newcode3864 lib/src/compiler/code_generator.dart:3864: throw 'Invalid build root. $buildRoot does not contain ${uri.path}'; ...
4 years, 7 months ago (2016-04-28 15:43:49 UTC) #23
Paul Berry
https://codereview.chromium.org/1917863005/diff/80001/lib/src/compiler/code_generator.dart File lib/src/compiler/code_generator.dart (right): https://codereview.chromium.org/1917863005/diff/80001/lib/src/compiler/code_generator.dart#newcode137 lib/src/compiler/code_generator.dart:137: if (!_buildRoot.endsWith('/')) { AFAICT, buildRoot uses OS conventions, this ...
4 years, 7 months ago (2016-04-28 15:49:31 UTC) #24
vsm
https://codereview.chromium.org/1917863005/diff/80001/lib/src/compiler/code_generator.dart File lib/src/compiler/code_generator.dart (right): https://codereview.chromium.org/1917863005/diff/80001/lib/src/compiler/code_generator.dart#newcode137 lib/src/compiler/code_generator.dart:137: if (!_buildRoot.endsWith('/')) { On 2016/04/28 15:49:30, Paul Berry wrote: ...
4 years, 7 months ago (2016-04-28 21:18:04 UTC) #26
jakemac
4 years, 7 months ago (2016-04-28 21:41:43 UTC) #27
Message was sent while issue was closed.
On 2016/04/28 21:18:04, vsm wrote:
>
https://codereview.chromium.org/1917863005/diff/80001/lib/src/compiler/code_g...
> File lib/src/compiler/code_generator.dart (right):
> 
>
https://codereview.chromium.org/1917863005/diff/80001/lib/src/compiler/code_g...
> lib/src/compiler/code_generator.dart:137: if (!_buildRoot.endsWith('/')) {
> On 2016/04/28 15:49:30, Paul Berry wrote:
> > AFAICT, buildRoot uses OS conventions, this won't work on Windows.  Use
> > `path.separator` (here and in the line below).
> 
> Hmm, buildRoot might not actually be a native file path (though it is by
> default).  jakemac passes in some sort of assert uri.
> 
> Perhaps this should be a Uri?

Actually, in my case it looks like it will never use the buildRoot anyways
(should follow the same path as a package:uri).

Powered by Google App Engine
This is Rietveld 408576698