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

Issue 11726005: Dartdoc comments retrieved as metadata through dart2js mirrors. (Closed)

Created:
7 years, 11 months ago by Johnni Winther
Modified:
7 years, 11 months ago
Reviewers:
ahe, Andrei Mouravski
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Dartdoc comments retrieved as metadata through dart2js mirrors. Committed: https://code.google.com/p/dart/source/detail?r=16798

Patch Set 1 #

Total comments: 26

Patch Set 2 : Updated cf. comments. #

Total comments: 18

Patch Set 3 : Rebased #

Patch Set 4 : Updated cf. comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+607 lines, -183 lines) Patch
M sdk/lib/_internal/compiler/implementation/apiimpl.dart View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M sdk/lib/_internal/compiler/implementation/compiler.dart View 1 2 3 7 chunks +79 lines, -0 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart View 1 2 3 12 chunks +116 lines, -54 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart View 1 2 2 chunks +26 lines, -9 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart View 1 2 1 chunk +44 lines, -0 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/scanner/scanner_task.dart View 1 chunk +5 lines, -1 line 0 comments Download
M sdk/lib/_internal/dartdoc/lib/dartdoc.dart View 1 2 7 chunks +45 lines, -25 lines 0 comments Download
M sdk/lib/_internal/dartdoc/lib/universe_serializer.dart View 8 chunks +17 lines, -21 lines 0 comments Download
M sdk/lib/mirrors/mirrors_impl.dart View 1 chunk +28 lines, -0 lines 0 comments Download
M tests/compiler/dart2js/mirrors_helper.dart View 1 2 chunks +6 lines, -1 line 0 comments Download
M tests/compiler/dart2js/mirrors_test.dart View 1 2 4 chunks +160 lines, -71 lines 0 comments Download
A tests/compiler/dart2js/strip_comment_test.dart View 1 2 3 1 chunk +79 lines, -0 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
Johnni Winther
7 years, 11 months ago (2013-01-02 14:50:17 UTC) #1
Andrei Mouravski
Looks good, but I'd love to see some tests so it's unambiguous how comments work. ...
7 years, 11 months ago (2013-01-02 16:56:06 UTC) #2
ahe
+1 for more tests of strange comments. Ideally, this would be tested by standalone tests ...
7 years, 11 months ago (2013-01-03 13:04:09 UTC) #3
ahe
I'm not saying go because I'm concerned with the performance of the token to comment ...
7 years, 11 months ago (2013-01-03 13:04:54 UTC) #4
Johnni Winther
On 2013/01/03 13:04:54, ahe wrote: > I'm not saying go because I'm concerned with the ...
7 years, 11 months ago (2013-01-03 13:19:32 UTC) #5
ahe
On 2013/01/03 13:19:32, Johnni Winther wrote: > I actually tested several implementations. Using a Map<Token,Token> ...
7 years, 11 months ago (2013-01-03 13:31:00 UTC) #6
Andrei Mouravski
After you determine which method is most efficient, could you add a // comment in ...
7 years, 11 months ago (2013-01-03 17:41:46 UTC) #7
Johnni Winther
PTAL New commentMap implementation class TokenKeyMap including reasoning and measurements. stripComment is moved to mirrors_util ...
7 years, 11 months ago (2013-01-04 16:40:53 UTC) #8
Andrei Mouravski
Good stuff! https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler/implementation/compiler.dart File sdk/lib/_internal/compiler/implementation/compiler.dart (right): https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler/implementation/compiler.dart#newcode120 sdk/lib/_internal/compiler/implementation/compiler.dart:120: * This implementation was chosen among several ...
7 years, 11 months ago (2013-01-04 17:46:24 UTC) #9
ahe
LGTM! https://codereview.chromium.org/11726005/diff/1/sdk/lib/_internal/compiler/implementation/elements/elements.dart File sdk/lib/_internal/compiler/implementation/elements/elements.dart (right): https://codereview.chromium.org/11726005/diff/1/sdk/lib/_internal/compiler/implementation/elements/elements.dart#newcode2165 sdk/lib/_internal/compiler/implementation/elements/elements.dart:2165: * The beginning token of this annotation, or ...
7 years, 11 months ago (2013-01-08 11:59:42 UTC) #10
Johnni Winther
7 years, 11 months ago (2013-01-08 13:39:46 UTC) #11
https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler...
File sdk/lib/_internal/compiler/implementation/compiler.dart (right):

https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler...
sdk/lib/_internal/compiler/implementation/compiler.dart:120: * This
implementation was chosen among several candidates for its space/time
On 2013/01/04 17:46:24, Andrei Mouravski wrote:
> Since it is an implementation detail, this rationale could go into a non doc
> comment.
> 
> /// Map of tokens and the first associated comment.
> /* 
>  * This implementation...
>  * ...
>  */

Done.

https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler...
sdk/lib/_internal/compiler/implementation/compiler.dart:132: class TokenKeyMap {
On 2013/01/08 11:59:43, ahe wrote:
> This really is a TokenMap.

Done.

https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler...
File sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
(right):

https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler...
sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart:478:
abstract class Dart2JsTypeMirror extends Dart2JsDeclarationMirror
On 2013/01/08 11:59:43, ahe wrote:
> This class defines no behavior, so it has no purpose.
> 
> Chances are that you have code somewhere that says:
> 
> if (m is Dart2JsTypeMirror) doSomething(x);
> 
> Generally, I'd prefer:
> 
> m.doSomething();

It is an 'interface' extending both Dart2JsDeclarationMirror and TypeMirror, and
as such defines their combined behavior.

https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler...
sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart:480: 
On 2013/01/08 11:59:43, ahe wrote:
> Extra line.

Done.

https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler...
sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart:483:
abstract class Dart2JsElementMirror extends Dart2JsDeclarationMirror {
On 2013/01/08 11:59:43, ahe wrote:
> Generally, I prefer having the super class first. Makes the code easier to
read.

Done.

https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler...
File sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart
(right):

https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler...
sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart:137: while
(lines.hasNext) {
On 2013/01/08 11:59:43, ahe wrote:
> lines.moveNext()

Changed to use List and index.

https://codereview.chromium.org/11726005/diff/3002/sdk/lib/_internal/compiler...
sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart:148: } else
if (lines.hasNext || !line.trim().isEmpty) {
On 2013/01/08 11:59:43, ahe wrote:
> This wont work with the new iterators :-(

Refactored.

https://codereview.chromium.org/11726005/diff/3002/tests/compiler/dart2js/str...
File tests/compiler/dart2js/strip_comment_test.dart (right):

https://codereview.chromium.org/11726005/diff/3002/tests/compiler/dart2js/str...
tests/compiler/dart2js/strip_comment_test.dart:16: testComment('', '// ');
On 2013/01/08 11:59:43, ahe wrote:
> Did you mean:
>  testComment(' ', '//  ');

Yes. Done.

https://codereview.chromium.org/11726005/diff/3002/tests/compiler/dart2js/str...
tests/compiler/dart2js/strip_comment_test.dart:24: testComment('', '/// ');
On 2013/01/08 11:59:43, ahe wrote:
> Ditto?

Done.

Powered by Google App Engine
This is Rietveld 408576698