| OLD | NEW |
| 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 4059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4070 Object visitNode(AstNode node) { | 4070 Object visitNode(AstNode node) { |
| 4071 // Don't visit a new tree if the result has been already found. | 4071 // Don't visit a new tree if the result has been already found. |
| 4072 if (_foundNode != null) { | 4072 if (_foundNode != null) { |
| 4073 return null; | 4073 return null; |
| 4074 } | 4074 } |
| 4075 // Check whether the current node covers the selection. | 4075 // Check whether the current node covers the selection. |
| 4076 Token beginToken = node.beginToken; | 4076 Token beginToken = node.beginToken; |
| 4077 Token endToken = node.endToken; | 4077 Token endToken = node.endToken; |
| 4078 // Don't include synthetic tokens. | 4078 // Don't include synthetic tokens. |
| 4079 while (endToken != beginToken) { | 4079 while (endToken != beginToken) { |
| 4080 if (endToken.type == TokenType.EOF || !endToken.isSynthetic) { | 4080 // Fasta scanner reports unterminated string literal errors |
| 4081 // and generates a synthetic string token with non-zero length. |
| 4082 // Because of this, check for length > 0 rather than !isSynthetic. |
| 4083 if (endToken.type == TokenType.EOF || endToken.length > 0) { |
| 4081 break; | 4084 break; |
| 4082 } | 4085 } |
| 4083 endToken = endToken.previous; | 4086 endToken = endToken.previous; |
| 4084 } | 4087 } |
| 4085 int end = endToken.end; | 4088 int end = endToken.end; |
| 4086 int start = node.offset; | 4089 int start = node.offset; |
| 4087 if (end <= _startOffset) { | 4090 if (end <= _startOffset) { |
| 4088 return null; | 4091 return null; |
| 4089 } | 4092 } |
| 4090 if (start > _endOffset) { | 4093 if (start > _endOffset) { |
| (...skipping 5291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9382 if (node.star != null) { | 9385 if (node.star != null) { |
| 9383 sink.write("yield* "); | 9386 sink.write("yield* "); |
| 9384 } else { | 9387 } else { |
| 9385 sink.write("yield "); | 9388 sink.write("yield "); |
| 9386 } | 9389 } |
| 9387 safelyVisitNode(node.expression); | 9390 safelyVisitNode(node.expression); |
| 9388 sink.write(";"); | 9391 sink.write(";"); |
| 9389 return null; | 9392 return null; |
| 9390 } | 9393 } |
| 9391 } | 9394 } |
| OLD | NEW |