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/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return null; | 65 return null; |
66 } | 66 } |
67 return node.accept(this) as AstNode/*=E*/; | 67 return node.accept(this) as AstNode/*=E*/; |
68 } | 68 } |
69 | 69 |
70 /** | 70 /** |
71 * Return a list containing cloned versions of the nodes in the given list of | 71 * Return a list containing cloned versions of the nodes in the given list of |
72 * [nodes]. | 72 * [nodes]. |
73 */ | 73 */ |
74 List<AstNode/*=E*/ > cloneNodeList/*<E extends AstNode>*/( | 74 List<AstNode/*=E*/ > cloneNodeList/*<E extends AstNode>*/( |
75 NodeList/*<E>*/ nodes) { | 75 List/*<E>*/ nodes) { |
76 int count = nodes.length; | 76 int count = nodes.length; |
77 List/*<E>*/ clonedNodes = new List/*<E>*/(); | 77 List/*<E>*/ clonedNodes = new List/*<E>*/(); |
78 for (int i = 0; i < count; i++) { | 78 for (int i = 0; i < count; i++) { |
79 clonedNodes.add((nodes[i]).accept(this) as AstNode/*=E*/); | 79 clonedNodes.add((nodes[i]).accept(this) as AstNode/*=E*/); |
80 } | 80 } |
81 return clonedNodes; | 81 return clonedNodes; |
82 } | 82 } |
83 | 83 |
84 /** | 84 /** |
85 * Clone the given [token] if tokens are supposed to be cloned. | 85 * Clone the given [token] if tokens are supposed to be cloned. |
(...skipping 7743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7829 * Safely visit the given [token], printing the [suffix] after the token if it | 7829 * Safely visit the given [token], printing the [suffix] after the token if it |
7830 * is non-`null`. | 7830 * is non-`null`. |
7831 */ | 7831 */ |
7832 void _visitTokenWithSuffix(Token token, String suffix) { | 7832 void _visitTokenWithSuffix(Token token, String suffix) { |
7833 if (token != null) { | 7833 if (token != null) { |
7834 _writer.print(token.lexeme); | 7834 _writer.print(token.lexeme); |
7835 _writer.print(suffix); | 7835 _writer.print(suffix); |
7836 } | 7836 } |
7837 } | 7837 } |
7838 } | 7838 } |
OLD | NEW |