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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 cloneNode(node.elseExpression)); | 270 cloneNode(node.elseExpression)); |
271 | 271 |
272 @override | 272 @override |
273 Configuration visitConfiguration(Configuration node) => new Configuration( | 273 Configuration visitConfiguration(Configuration node) => new Configuration( |
274 cloneToken(node.ifKeyword), | 274 cloneToken(node.ifKeyword), |
275 cloneToken(node.leftParenthesis), | 275 cloneToken(node.leftParenthesis), |
276 cloneNode(node.name), | 276 cloneNode(node.name), |
277 cloneToken(node.equalToken), | 277 cloneToken(node.equalToken), |
278 cloneNode(node.value), | 278 cloneNode(node.value), |
279 cloneToken(node.rightParenthesis), | 279 cloneToken(node.rightParenthesis), |
280 cloneNode(node.libraryUri)); | 280 cloneNode(node.uri)); |
281 | 281 |
282 @override | 282 @override |
283 ConstructorDeclaration visitConstructorDeclaration( | 283 ConstructorDeclaration visitConstructorDeclaration( |
284 ConstructorDeclaration node) => | 284 ConstructorDeclaration node) => |
285 new ConstructorDeclaration( | 285 new ConstructorDeclaration( |
286 cloneNode(node.documentationComment), | 286 cloneNode(node.documentationComment), |
287 cloneNodeList(node.metadata), | 287 cloneNodeList(node.metadata), |
288 cloneToken(node.externalKeyword), | 288 cloneToken(node.externalKeyword), |
289 cloneToken(node.constKeyword), | 289 cloneToken(node.constKeyword), |
290 cloneToken(node.factoryKeyword), | 290 cloneToken(node.factoryKeyword), |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 | 1260 |
1261 @override | 1261 @override |
1262 bool visitConfiguration(Configuration node) { | 1262 bool visitConfiguration(Configuration node) { |
1263 Configuration other = _other as Configuration; | 1263 Configuration other = _other as Configuration; |
1264 return isEqualTokens(node.ifKeyword, other.ifKeyword) && | 1264 return isEqualTokens(node.ifKeyword, other.ifKeyword) && |
1265 isEqualTokens(node.leftParenthesis, other.leftParenthesis) && | 1265 isEqualTokens(node.leftParenthesis, other.leftParenthesis) && |
1266 isEqualNodes(node.name, other.name) && | 1266 isEqualNodes(node.name, other.name) && |
1267 isEqualTokens(node.equalToken, other.equalToken) && | 1267 isEqualTokens(node.equalToken, other.equalToken) && |
1268 isEqualNodes(node.value, other.value) && | 1268 isEqualNodes(node.value, other.value) && |
1269 isEqualTokens(node.rightParenthesis, other.rightParenthesis) && | 1269 isEqualTokens(node.rightParenthesis, other.rightParenthesis) && |
1270 isEqualNodes(node.libraryUri, other.libraryUri); | 1270 isEqualNodes(node.uri, other.uri); |
1271 } | 1271 } |
1272 | 1272 |
1273 @override | 1273 @override |
1274 bool visitConstructorDeclaration(ConstructorDeclaration node) { | 1274 bool visitConstructorDeclaration(ConstructorDeclaration node) { |
1275 ConstructorDeclaration other = _other as ConstructorDeclaration; | 1275 ConstructorDeclaration other = _other as ConstructorDeclaration; |
1276 return isEqualNodes( | 1276 return isEqualNodes( |
1277 node.documentationComment, other.documentationComment) && | 1277 node.documentationComment, other.documentationComment) && |
1278 _isEqualNodeLists(node.metadata, other.metadata) && | 1278 _isEqualNodeLists(node.metadata, other.metadata) && |
1279 isEqualTokens(node.externalKeyword, other.externalKeyword) && | 1279 isEqualTokens(node.externalKeyword, other.externalKeyword) && |
1280 isEqualTokens(node.constKeyword, other.constKeyword) && | 1280 isEqualTokens(node.constKeyword, other.constKeyword) && |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2849 } | 2849 } |
2850 | 2850 |
2851 @override | 2851 @override |
2852 Configuration visitConfiguration(Configuration node) => new Configuration( | 2852 Configuration visitConfiguration(Configuration node) => new Configuration( |
2853 _mapToken(node.ifKeyword), | 2853 _mapToken(node.ifKeyword), |
2854 _mapToken(node.leftParenthesis), | 2854 _mapToken(node.leftParenthesis), |
2855 _cloneNode(node.name), | 2855 _cloneNode(node.name), |
2856 _mapToken(node.equalToken), | 2856 _mapToken(node.equalToken), |
2857 _cloneNode(node.value), | 2857 _cloneNode(node.value), |
2858 _mapToken(node.rightParenthesis), | 2858 _mapToken(node.rightParenthesis), |
2859 _cloneNode(node.libraryUri)); | 2859 _cloneNode(node.uri)); |
2860 | 2860 |
2861 @override | 2861 @override |
2862 ConstructorDeclaration visitConstructorDeclaration( | 2862 ConstructorDeclaration visitConstructorDeclaration( |
2863 ConstructorDeclaration node) { | 2863 ConstructorDeclaration node) { |
2864 ConstructorDeclaration copy = new ConstructorDeclaration( | 2864 ConstructorDeclaration copy = new ConstructorDeclaration( |
2865 _cloneNode(node.documentationComment), | 2865 _cloneNode(node.documentationComment), |
2866 _cloneNodeList(node.metadata), | 2866 _cloneNodeList(node.metadata), |
2867 _mapToken(node.externalKeyword), | 2867 _mapToken(node.externalKeyword), |
2868 _mapToken(node.constKeyword), | 2868 _mapToken(node.constKeyword), |
2869 _mapToken(node.factoryKeyword), | 2869 _mapToken(node.factoryKeyword), |
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4163 } | 4163 } |
4164 | 4164 |
4165 @override | 4165 @override |
4166 bool visitConfiguration(Configuration node) { | 4166 bool visitConfiguration(Configuration node) { |
4167 if (identical(node.name, _oldNode)) { | 4167 if (identical(node.name, _oldNode)) { |
4168 node.name = _newNode as DottedName; | 4168 node.name = _newNode as DottedName; |
4169 return true; | 4169 return true; |
4170 } else if (identical(node.value, _oldNode)) { | 4170 } else if (identical(node.value, _oldNode)) { |
4171 node.value = _newNode as StringLiteral; | 4171 node.value = _newNode as StringLiteral; |
4172 return true; | 4172 return true; |
4173 } else if (identical(node.libraryUri, _oldNode)) { | 4173 } else if (identical(node.uri, _oldNode)) { |
4174 node.libraryUri = _newNode as StringLiteral; | 4174 node.uri = _newNode as StringLiteral; |
4175 return true; | 4175 return true; |
4176 } | 4176 } |
4177 return visitNode(node); | 4177 return visitNode(node); |
4178 } | 4178 } |
4179 | 4179 |
4180 @override | 4180 @override |
4181 bool visitConstructorDeclaration(ConstructorDeclaration node) { | 4181 bool visitConstructorDeclaration(ConstructorDeclaration node) { |
4182 if (identical(node.returnType, _oldNode)) { | 4182 if (identical(node.returnType, _oldNode)) { |
4183 node.returnType = _newNode as Identifier; | 4183 node.returnType = _newNode as Identifier; |
4184 return true; | 4184 return true; |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5353 @override | 5353 @override |
5354 bool visitConfiguration(Configuration node) { | 5354 bool visitConfiguration(Configuration node) { |
5355 Configuration toNode = this._toNode as Configuration; | 5355 Configuration toNode = this._toNode as Configuration; |
5356 if (_and( | 5356 if (_and( |
5357 _isEqualTokens(node.ifKeyword, toNode.ifKeyword), | 5357 _isEqualTokens(node.ifKeyword, toNode.ifKeyword), |
5358 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 5358 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
5359 _isEqualNodes(node.name, toNode.name), | 5359 _isEqualNodes(node.name, toNode.name), |
5360 _isEqualTokens(node.equalToken, toNode.equalToken), | 5360 _isEqualTokens(node.equalToken, toNode.equalToken), |
5361 _isEqualNodes(node.value, toNode.value), | 5361 _isEqualNodes(node.value, toNode.value), |
5362 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), | 5362 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), |
5363 _isEqualNodes(node.libraryUri, toNode.libraryUri))) { | 5363 _isEqualNodes(node.uri, toNode.uri))) { |
5364 return true; | 5364 return true; |
5365 } | 5365 } |
5366 return false; | 5366 return false; |
5367 } | 5367 } |
5368 | 5368 |
5369 @override | 5369 @override |
5370 bool visitConstructorDeclaration(ConstructorDeclaration node) { | 5370 bool visitConstructorDeclaration(ConstructorDeclaration node) { |
5371 ConstructorDeclaration toNode = this._toNode as ConstructorDeclaration; | 5371 ConstructorDeclaration toNode = this._toNode as ConstructorDeclaration; |
5372 if (_and( | 5372 if (_and( |
5373 _isEqualNodes(node.documentationComment, toNode.documentationComment), | 5373 _isEqualNodes(node.documentationComment, toNode.documentationComment), |
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6900 _visitNode(node.elseExpression); | 6900 _visitNode(node.elseExpression); |
6901 return null; | 6901 return null; |
6902 } | 6902 } |
6903 | 6903 |
6904 @override | 6904 @override |
6905 Object visitConfiguration(Configuration node) { | 6905 Object visitConfiguration(Configuration node) { |
6906 _writer.print('if ('); | 6906 _writer.print('if ('); |
6907 _visitNode(node.name); | 6907 _visitNode(node.name); |
6908 _visitNodeWithPrefix(" == ", node.value); | 6908 _visitNodeWithPrefix(" == ", node.value); |
6909 _writer.print(') '); | 6909 _writer.print(') '); |
6910 _visitNode(node.libraryUri); | 6910 _visitNode(node.uri); |
6911 return null; | 6911 return null; |
6912 } | 6912 } |
6913 | 6913 |
6914 @override | 6914 @override |
6915 Object visitConstructorDeclaration(ConstructorDeclaration node) { | 6915 Object visitConstructorDeclaration(ConstructorDeclaration node) { |
6916 _visitNodeListWithSeparatorAndSuffix(node.metadata, " ", " "); | 6916 _visitNodeListWithSeparatorAndSuffix(node.metadata, " ", " "); |
6917 _visitTokenWithSuffix(node.externalKeyword, " "); | 6917 _visitTokenWithSuffix(node.externalKeyword, " "); |
6918 _visitTokenWithSuffix(node.constKeyword, " "); | 6918 _visitTokenWithSuffix(node.constKeyword, " "); |
6919 _visitTokenWithSuffix(node.factoryKeyword, " "); | 6919 _visitTokenWithSuffix(node.factoryKeyword, " "); |
6920 _visitNode(node.returnType); | 6920 _visitNode(node.returnType); |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7828 * Safely visit the given [token], printing the [suffix] after the token if it | 7828 * Safely visit the given [token], printing the [suffix] after the token if it |
7829 * is non-`null`. | 7829 * is non-`null`. |
7830 */ | 7830 */ |
7831 void _visitTokenWithSuffix(Token token, String suffix) { | 7831 void _visitTokenWithSuffix(Token token, String suffix) { |
7832 if (token != null) { | 7832 if (token != null) { |
7833 _writer.print(token.lexeme); | 7833 _writer.print(token.lexeme); |
7834 _writer.print(suffix); | 7834 _writer.print(suffix); |
7835 } | 7835 } |
7836 } | 7836 } |
7837 } | 7837 } |
OLD | NEW |