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

Side by Side Diff: pkg/analyzer/lib/src/dart/ast/token.dart

Issue 1909843002: Pull the 'keyword' property into Token. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.dart.ast.token; 5 library analyzer.src.dart.ast.token;
6 6
7 import 'package:analyzer/dart/ast/token.dart'; 7 import 'package:analyzer/dart/ast/token.dart';
8 import 'package:analyzer/src/generated/java_engine.dart'; 8 import 'package:analyzer/src/generated/java_engine.dart';
9 9
10 /** 10 /**
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 new DocumentationCommentToken(type, _value, offset); 135 new DocumentationCommentToken(type, _value, offset);
136 references.forEach((ref) => copy.references.add(ref.copy())); 136 references.forEach((ref) => copy.references.add(ref.copy()));
137 return copy; 137 return copy;
138 } 138 }
139 } 139 }
140 140
141 /** 141 /**
142 * A token representing a keyword in the language. 142 * A token representing a keyword in the language.
143 */ 143 */
144 class KeywordToken extends SimpleToken { 144 class KeywordToken extends SimpleToken {
145 /** 145 @override
146 * The keyword being represented by this token.
147 */
148 final Keyword keyword; 146 final Keyword keyword;
149 147
150 /** 148 /**
151 * Initialize a newly created token to represent the given [keyword] at the 149 * Initialize a newly created token to represent the given [keyword] at the
152 * given [offset]. 150 * given [offset].
153 */ 151 */
154 KeywordToken(this.keyword, int offset) : super(TokenType.KEYWORD, offset); 152 KeywordToken(this.keyword, int offset) : super(TokenType.KEYWORD, offset);
155 153
156 @override 154 @override
157 String get lexeme => keyword.syntax; 155 String get lexeme => keyword.syntax;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 @override 244 @override
247 bool get isOperator => type.isOperator; 245 bool get isOperator => type.isOperator;
248 246
249 @override 247 @override
250 bool get isSynthetic => length == 0; 248 bool get isSynthetic => length == 0;
251 249
252 @override 250 @override
253 bool get isUserDefinableOperator => type.isUserDefinableOperator; 251 bool get isUserDefinableOperator => type.isUserDefinableOperator;
254 252
255 @override 253 @override
254 Keyword get keyword => null;
255
256 @override
256 int get length => lexeme.length; 257 int get length => lexeme.length;
257 258
258 @override 259 @override
259 String get lexeme => type.lexeme; 260 String get lexeme => type.lexeme;
260 261
261 @override 262 @override
262 Token get next => _next; 263 Token get next => _next;
263 264
264 @override 265 @override
265 CommentToken get precedingComments => null; 266 CommentToken get precedingComments => null;
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 CommentToken get precedingComments => _precedingComment; 564 CommentToken get precedingComments => _precedingComment;
564 565
565 void set precedingComments(CommentToken comment) { 566 void set precedingComments(CommentToken comment) {
566 _precedingComment = comment; 567 _precedingComment = comment;
567 _setCommentParent(_precedingComment); 568 _setCommentParent(_precedingComment);
568 } 569 }
569 570
570 @override 571 @override
571 Token copy() => new TokenWithComment(type, offset, precedingComments); 572 Token copy() => new TokenWithComment(type, offset, precedingComments);
572 } 573 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698