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

Issue 10990060: Added support for exports and re-exports. (Closed)

Created:
8 years, 2 months ago by Johnni Winther
Modified:
8 years, 2 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Added support for exports and re-exports. BUG=5429 TESTS=language/export_test, language/export_cyclic_test Committed: https://code.google.com/p/dart/source/detail?r=13478

Patch Set 1 #

Patch Set 2 : Removed redundant check. #

Total comments: 55

Patch Set 3 : Rebase+refactoring #

Patch Set 4 : Rebase (again) #

Total comments: 12

Patch Set 5 : Status updated. #

Total comments: 20

Patch Set 6 : Updated cf. comments #

Total comments: 37

Patch Set 7 : dart2dart.status updated #

Patch Set 8 : Rebase #

Patch Set 9 : Updated cf. comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+668 lines, -460 lines) Patch
M lib/compiler/implementation/apiimpl.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M lib/compiler/implementation/compiler.dart View 1 2 3 4 5 6 7 8 6 chunks +13 lines, -23 lines 0 comments Download
M lib/compiler/implementation/dart_backend/utils.dart View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -0 lines 0 comments Download
M lib/compiler/implementation/elements/elements.dart View 1 2 3 4 5 6 7 8 7 chunks +46 lines, -12 lines 0 comments Download
M lib/compiler/implementation/leg.dart View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M lib/compiler/implementation/library_loader.dart View 1 2 3 4 5 6 7 8 6 chunks +434 lines, -104 lines 0 comments Download
M lib/compiler/implementation/patch_parser.dart View 1 2 3 4 5 6 7 8 2 chunks +5 lines, -3 lines 0 comments Download
M lib/compiler/implementation/scanner/scanner_task.dart View 1 2 3 3 chunks +0 lines, -211 lines 0 comments Download
M lib/compiler/implementation/tree/nodes.dart View 1 2 3 4 5 6 7 8 5 chunks +35 lines, -11 lines 0 comments Download
M lib/compiler/implementation/tree/prettyprint.dart View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -0 lines 0 comments Download
M lib/compiler/implementation/tree/unparser.dart View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -0 lines 0 comments Download
M lib/compiler/implementation/util/util.dart View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M lib/compiler/implementation/warnings.dart View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart View 1 2 3 chunks +7 lines, -8 lines 0 comments Download
M tests/co19/co19-dart2dart.status View 1 2 3 4 5 6 7 2 chunks +11 lines, -12 lines 0 comments Download
M tests/co19/co19-dart2js.status View 1 2 3 4 5 6 7 8 3 chunks +3 lines, -11 lines 0 comments Download
M tests/compiler/dart2js/mock_compiler.dart View 1 2 3 4 5 6 7 8 1 chunk +17 lines, -13 lines 0 comments Download
M tests/compiler/dart2js/patch_test.dart View 1 2 1 chunk +3 lines, -1 line 0 comments Download
A + tests/language/export_cyclic_helper1.dart View 1 chunk +8 lines, -9 lines 0 comments Download
A + tests/language/export_cyclic_helper2.dart View 1 chunk +10 lines, -13 lines 0 comments Download
A + tests/language/export_cyclic_helper3.dart View 1 chunk +2 lines, -2 lines 0 comments Download
A tests/language/export_cyclic_test.dart View 1 chunk +27 lines, -0 lines 0 comments Download
A + tests/language/export_helper1.dart View 1 chunk +6 lines, -6 lines 0 comments Download
A + tests/language/export_helper2.dart View 1 chunk +4 lines, -2 lines 0 comments Download
A + tests/language/export_helper3.dart View 1 2 1 chunk +5 lines, -7 lines 0 comments Download
A + tests/language/export_helper4.dart View 1 2 1 chunk +4 lines, -2 lines 0 comments Download
A + tests/language/export_test.dart View 1 2 3 1 chunk +11 lines, -9 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
Johnni Winther
https://codereview.chromium.org/10990060/diff/1017/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart File pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart (left): https://codereview.chromium.org/10990060/diff/1017/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart#oldcode372 pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart:372: _compiler.scanner.loadLibrary(uri, null); Stale code. https://codereview.chromium.org/10990060/diff/1017/tests/language/export_cyclic_helper1.dart File tests/language/export_cyclic_helper1.dart (right): https://codereview.chromium.org/10990060/diff/1017/tests/language/export_cyclic_helper1.dart#newcode4 ...
8 years, 2 months ago (2012-09-26 17:03:58 UTC) #1
kasperl
https://codereview.chromium.org/10990060/diff/1017/tests/language/export_helper1.dart File tests/language/export_helper1.dart (right): https://codereview.chromium.org/10990060/diff/1017/tests/language/export_helper1.dart#newcode8 tests/language/export_helper1.dart:8: export 'export_helper2.dart'; Very cool to see the support for ...
8 years, 2 months ago (2012-09-27 05:38:00 UTC) #2
Lasse Reichstein Nielsen
Needs serious renaming, and some refactoring. Please avoid "data classes". Find some way to describe ...
8 years, 2 months ago (2012-09-28 07:45:36 UTC) #3
Bob Nystrom
https://codereview.chromium.org/10990060/diff/1017/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): https://codereview.chromium.org/10990060/diff/1017/lib/compiler/implementation/elements/elements.dart#newcode564 lib/compiler/implementation/elements/elements.dart:564: Map<SourceString, Element> get exportScope { On 2012/09/28 07:45:36, Lasse ...
8 years, 2 months ago (2012-09-28 16:41:26 UTC) #4
Johnni Winther
Major refactoring. PTAL https://codereview.chromium.org/10990060/diff/1017/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): https://codereview.chromium.org/10990060/diff/1017/lib/compiler/implementation/elements/elements.dart#newcode107 lib/compiler/implementation/elements/elements.dart:107: static const ElementKind ERRONEOUS = On ...
8 years, 2 months ago (2012-10-09 09:47:10 UTC) #5
ahe
https://codereview.chromium.org/10990060/diff/14001/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (left): https://codereview.chromium.org/10990060/diff/14001/lib/compiler/implementation/elements/elements.dart#oldcode361 lib/compiler/implementation/elements/elements.dart:361: : super(const SourceString('erroneous element'), null, enclosing); Good catch! https://codereview.chromium.org/10990060/diff/14001/lib/compiler/implementation/elements/elements.dart ...
8 years, 2 months ago (2012-10-09 13:07:49 UTC) #6
Johnni Winther
https://codereview.chromium.org/10990060/diff/14001/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): https://codereview.chromium.org/10990060/diff/14001/lib/compiler/implementation/elements/elements.dart#newcode624 lib/compiler/implementation/elements/elements.dart:624: importScope.putIfAbsent(element.name, () => element); On 2012/10/09 13:07:50, ahe wrote: ...
8 years, 2 months ago (2012-10-09 13:50:07 UTC) #7
ahe
https://codereview.chromium.org/10990060/diff/14001/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): https://codereview.chromium.org/10990060/diff/14001/lib/compiler/implementation/elements/elements.dart#newcode644 lib/compiler/implementation/elements/elements.dart:644: Link<Element> _exports; On 2012/10/09 13:50:07, Johnni Winther wrote: > ...
8 years, 2 months ago (2012-10-09 14:41:32 UTC) #8
Bob Nystrom
https://codereview.chromium.org/10990060/diff/14001/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): https://codereview.chromium.org/10990060/diff/14001/lib/compiler/implementation/elements/elements.dart#newcode652 lib/compiler/implementation/elements/elements.dart:652: void setExports(Iterable<Element> iterable) { On 2012/10/09 13:50:07, Johnni Winther ...
8 years, 2 months ago (2012-10-09 16:20:37 UTC) #9
Lasse Reichstein Nielsen
LGTM https://codereview.chromium.org/10990060/diff/15024/lib/compiler/implementation/compiler.dart File lib/compiler/implementation/compiler.dart (right): https://codereview.chromium.org/10990060/diff/15024/lib/compiler/implementation/compiler.dart#newcode398 lib/compiler/implementation/compiler.dart:398: LibraryLoader.importLibrary(this, library, jsHelperLibrary, null); capital 'L'? https://codereview.chromium.org/10990060/diff/15024/lib/compiler/implementation/compiler.dart#newcode835 lib/compiler/implementation/compiler.dart:835: ...
8 years, 2 months ago (2012-10-10 08:07:33 UTC) #10
Johnni Winther
https://codereview.chromium.org/10990060/diff/14001/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): https://codereview.chromium.org/10990060/diff/14001/lib/compiler/implementation/elements/elements.dart#newcode644 lib/compiler/implementation/elements/elements.dart:644: Link<Element> _exports; On 2012/10/09 14:41:33, ahe wrote: > On ...
8 years, 2 months ago (2012-10-10 09:20:59 UTC) #11
ahe
I would appreciate if you could walk me through the logic. https://codereview.chromium.org/10990060/diff/12018/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): ...
8 years, 2 months ago (2012-10-10 12:06:26 UTC) #12
ahe
LGTM
8 years, 2 months ago (2012-10-10 13:35:28 UTC) #13
Johnni Winther
8 years, 2 months ago (2012-10-10 14:56:00 UTC) #14
https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
File lib/compiler/implementation/elements/elements.dart (right):

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/elements/elements.dart:664: message: 'Exports
already set to $slotForExports on $this'));
On 2012/10/10 12:06:27, ahe wrote:
> Long line.

Done.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
File lib/compiler/implementation/library_loader.dart (right):

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:24: LibraryDependency tag);
On 2012/10/10 12:06:27, ahe wrote:
> Add newline.

Done.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:26: * Adds the elements in the
export scope if [importedLibrary] to the import
On 2012/10/10 12:06:27, ahe wrote:
> if -> of

Done.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:42: class LibraryLoaderTask
extends CompilerTask implements LibraryLoader {
On 2012/10/10 12:06:27, ahe wrote:
> I feel it would be simpler to extend LibraryLoader and have LibaryLoader
extend
> CompilerTask.

Done.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:61: LibraryElement
loadLibrary(Uri uri, Node node, Uri canonicalUri) {
On 2012/10/10 12:06:27, ahe wrote:
> Do you have to repeat documentation like this?

No. Docs removed.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:105: // It is not safe to import
other libraries at this point as
On 2012/10/10 12:06:27, ahe wrote:
> Isn't this comment outdated by now?

Yes. Removed.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:139: // Now that we have
processed all the source tags, it is safe to
On 2012/10/10 12:06:27, ahe wrote:
> Is this still relevant?

No. Removed.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:198: * is, any resolution should
be done beforehand.
On 2012/10/10 12:06:27, ahe wrote:
> resolution -> URI resolution.

Done.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:200: void loadPart(Part part,
Uri path, LibraryElement library) {
On 2012/10/10 12:06:27, ahe wrote:
> if (!path.isAbsolute()) throw ArgumenError(path);

Done.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:200: void loadPart(Part part,
Uri path, LibraryElement library) {
On 2012/10/10 12:06:27, ahe wrote:
> Rename method to "scanPart" or "scanCompilationUnit"?

Done.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:252:
compiler.onLibraryLoaded(library, uri);
On 2012/10/10 12:06:27, ahe wrote:
> So this is called before the library is fully loaded?

Yes. Comment added on [onLibraryLoaded].

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:268: 'no #library tag found in
${importedLibrary.uri}');
On 2012/10/10 12:06:27, ahe wrote:
> Why is this error reported twice?

Bad rebase. Removed from here.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:293: compiler.reportWarning(new
Identifier(existing.position()),
On 2012/10/10 12:06:27, ahe wrote:
> This can be cleaned up. See checkDuplicatedLibraryName above.

Added a TODO.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/library_loader.dart:456:
exportScope.putIfAbsent(name, () => element);
On 2012/10/10 12:06:27, ahe wrote:
> Another weird use of putIfAbsent.

Done.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
File lib/compiler/implementation/tree/nodes.dart (right):

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/tree/nodes.dart:22: R visitExport(Export node) =>
visitLibraryTag(node);
On 2012/10/10 12:06:27, ahe wrote:
> Should return "visitLibraryDependency(node)"

Done.

https://chromiumcodereview.appspot.com/10990060/diff/12018/lib/compiler/imple...
lib/compiler/implementation/tree/nodes.dart:32: R visitImport(Import node) =>
visitLibraryTag(node);
On 2012/10/10 12:06:27, ahe wrote:
> Ditto.

Done.

https://chromiumcodereview.appspot.com/10990060/diff/12018/tests/co19/co19-da...
File tests/co19/co19-dart2js.status (left):

https://chromiumcodereview.appspot.com/10990060/diff/12018/tests/co19/co19-da...
tests/co19/co19-dart2js.status:756: 
On 2012/10/10 12:06:27, ahe wrote:
> Restore this line.

Done.

Powered by Google App Engine
This is Rietveld 408576698