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

Unified Diff: pkg/analyzer/lib/src/generated/scanner.dart

Issue 766233002: Set for all preceding comment tokens. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/scanner.dart
diff --git a/pkg/analyzer/lib/src/generated/scanner.dart b/pkg/analyzer/lib/src/generated/scanner.dart
index 271ceb04a379f66f41e58217ec99f573ad09e2d1..af06edfc94ec8ab6a79436590c47fbfde98e372d 100644
--- a/pkg/analyzer/lib/src/generated/scanner.dart
+++ b/pkg/analyzer/lib/src/generated/scanner.dart
@@ -43,18 +43,23 @@ class BeginTokenWithComment extends BeginToken {
/**
* The first comment in the list of comments that precede this token.
*/
- CommentToken precedingComments;
+ CommentToken _precedingComment;
/**
* Initialize a newly created token to have the given [type] at the given
* [offset] and to be preceded by the comments reachable from the given
* [comment].
*/
- BeginTokenWithComment(TokenType type, int offset, this.precedingComments)
+ BeginTokenWithComment(TokenType type, int offset, this._precedingComment)
: super(type, offset) {
- if (precedingComments != null) {
- precedingComments.parent = this;
- }
+ _setCommentParent(_precedingComment);
+ }
+
+ CommentToken get precedingComments => _precedingComment;
+
+ void set precedingComments(CommentToken comment) {
+ _precedingComment = comment;
+ _setCommentParent(_precedingComment);
}
@override
@@ -595,18 +600,23 @@ class KeywordTokenWithComment extends KeywordToken {
/**
* The first comment in the list of comments that precede this token.
*/
- CommentToken precedingComments;
+ CommentToken _precedingComment;
/**
* Initialize a newly created token to to represent the given [keyword] at the
* given [offset] and to be preceded by the comments reachable from the given
* [comment].
*/
- KeywordTokenWithComment(Keyword keyword, int offset, this.precedingComments)
+ KeywordTokenWithComment(Keyword keyword, int offset, this._precedingComment)
: super(keyword, offset) {
- if (precedingComments != null) {
- precedingComments.parent = this;
- }
+ _setCommentParent(_precedingComment);
+ }
+
+ CommentToken get precedingComments => _precedingComment;
+
+ void set precedingComments(CommentToken comment) {
+ _precedingComment = comment;
+ _setCommentParent(_precedingComment);
}
@override
@@ -1842,7 +1852,7 @@ class StringTokenWithComment extends StringToken {
/**
* The first comment in the list of comments that precede this token.
*/
- CommentToken precedingComments;
+ CommentToken _precedingComment;
/**
* Initialize a newly created token to have the given [type] at the given
@@ -1850,11 +1860,16 @@ class StringTokenWithComment extends StringToken {
* [comment].
*/
StringTokenWithComment(TokenType type, String value, int offset,
- this.precedingComments)
+ this._precedingComment)
: super(type, value, offset) {
- if (precedingComments != null) {
- precedingComments.parent = this;
- }
+ _setCommentParent(_precedingComment);
+ }
+
+ CommentToken get precedingComments => _precedingComment;
+
+ void set precedingComments(CommentToken comment) {
+ _precedingComment = comment;
+ _setCommentParent(_precedingComment);
}
@override
@@ -2083,6 +2098,17 @@ class Token {
Object value() => type.lexeme;
/**
+ * Sets the `parent` property to `this` for the given [comment] and all the
+ * next tokens.
+ */
+ void _setCommentParent(CommentToken comment) {
+ while (comment != null) {
+ comment.parent = this;
+ comment = comment.next;
+ }
+ }
+
+ /**
* Compare the given [tokens] to find the token that appears first in the
* source being parsed. That is, return the left-most of all of the tokens.
* The list must be non-`null`, but the elements of the list are allowed to be
@@ -2572,18 +2598,23 @@ class TokenWithComment extends Token {
/**
* The first comment in the list of comments that precede this token.
*/
- CommentToken precedingComments;
+ CommentToken _precedingComment;
/**
* Initialize a newly created token to have the given [type] at the given
* [offset] and to be preceded by the comments reachable from the given
* [comment].
*/
- TokenWithComment(TokenType type, int offset, this.precedingComments)
+ TokenWithComment(TokenType type, int offset, this._precedingComment)
: super(type, offset) {
- if (precedingComments != null) {
- precedingComments.parent = this;
- }
+ _setCommentParent(_precedingComment);
+ }
+
+ CommentToken get precedingComments => _precedingComment;
+
+ void set precedingComments(CommentToken comment) {
+ _precedingComment = comment;
+ _setCommentParent(_precedingComment);
}
@override
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698