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

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

Issue 2936143002: update statement completion for fasta scanner (Closed)
Patch Set: address comments 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 | « pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart ('k') | no next file » | 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 3959 matching lines...) Expand 10 before | Expand all | Expand 10 after
3970 Object visitNode(AstNode node) { 3970 Object visitNode(AstNode node) {
3971 // Don't visit a new tree if the result has been already found. 3971 // Don't visit a new tree if the result has been already found.
3972 if (_foundNode != null) { 3972 if (_foundNode != null) {
3973 return null; 3973 return null;
3974 } 3974 }
3975 // Check whether the current node covers the selection. 3975 // Check whether the current node covers the selection.
3976 Token beginToken = node.beginToken; 3976 Token beginToken = node.beginToken;
3977 Token endToken = node.endToken; 3977 Token endToken = node.endToken;
3978 // Don't include synthetic tokens. 3978 // Don't include synthetic tokens.
3979 while (endToken != beginToken) { 3979 while (endToken != beginToken) {
3980 if (endToken.type == TokenType.EOF || !endToken.isSynthetic) { 3980 // Fasta scanner reports unterminated string literal errors
3981 // and generates a synthetic string token with non-zero length.
3982 // Because of this, check for length > 0 rather than !isSynthetic.
3983 if (endToken.type == TokenType.EOF || endToken.length > 0) {
3981 break; 3984 break;
3982 } 3985 }
3983 endToken = endToken.previous; 3986 endToken = endToken.previous;
3984 } 3987 }
3985 int end = endToken.end; 3988 int end = endToken.end;
3986 int start = node.offset; 3989 int start = node.offset;
3987 if (end < _startOffset) { 3990 if (end < _startOffset) {
3988 return null; 3991 return null;
3989 } 3992 }
3990 if (start > _endOffset) { 3993 if (start > _endOffset) {
(...skipping 5388 matching lines...) Expand 10 before | Expand all | Expand 10 after
9379 if (node.star != null) { 9382 if (node.star != null) {
9380 sink.write("yield* "); 9383 sink.write("yield* ");
9381 } else { 9384 } else {
9382 sink.write("yield "); 9385 sink.write("yield ");
9383 } 9386 }
9384 safelyVisitNode(node.expression); 9387 safelyVisitNode(node.expression);
9385 sink.write(";"); 9388 sink.write(";");
9386 return null; 9389 return null;
9387 } 9390 }
9388 } 9391 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698