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

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

Issue 2899043006: cleanup fasta token classes (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/fasta/ast_builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.utilities; 5 library analyzer.src.dart.ast.utilities;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; 10 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 void _cloneTokens(Token token, int stopAfter) { 987 void _cloneTokens(Token token, int stopAfter) {
988 if (token == null) { 988 if (token == null) {
989 return; 989 return;
990 } 990 }
991 Token nonComment(Token token) { 991 Token nonComment(Token token) {
992 return token is CommentToken ? token.parent : token; 992 return token is CommentToken ? token.parent : token;
993 } 993 }
994 994
995 token = nonComment(token); 995 token = nonComment(token);
996 if (_lastCloned == null) { 996 if (_lastCloned == null) {
997 _lastCloned = new Token(TokenType.EOF, -1); 997 _lastCloned = new Token.eof(-1);
998 _lastCloned.setNext(_lastCloned);
999 } 998 }
1000 while (token != null) { 999 while (token != null) {
1001 Token clone = token.copy(); 1000 Token clone = token.copy();
1002 { 1001 {
1003 CommentToken c1 = token.precedingComments; 1002 CommentToken c1 = token.precedingComments;
1004 CommentToken c2 = clone.precedingComments; 1003 CommentToken c2 = clone.precedingComments;
1005 while (c1 != null && c2 != null) { 1004 while (c1 != null && c2 != null) {
1006 _clonedTokens[c1] = c2; 1005 _clonedTokens[c1] = c2;
1007 if (c1 is DocumentationCommentToken && 1006 if (c1 is DocumentationCommentToken &&
1008 c2 is DocumentationCommentToken) { 1007 c2 is DocumentationCommentToken) {
(...skipping 8372 matching lines...) Expand 10 before | Expand all | Expand 10 after
9381 if (node.star != null) { 9380 if (node.star != null) {
9382 sink.write("yield* "); 9381 sink.write("yield* ");
9383 } else { 9382 } else {
9384 sink.write("yield "); 9383 sink.write("yield ");
9385 } 9384 }
9386 safelyVisitNode(node.expression); 9385 safelyVisitNode(node.expression);
9387 sink.write(";"); 9386 sink.write(";");
9388 return null; 9387 return null;
9389 } 9388 }
9390 } 9389 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/fasta/ast_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698