| 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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 SimpleFormalParameter node) => | 771 SimpleFormalParameter node) => |
| 772 new SimpleFormalParameter( | 772 new SimpleFormalParameter( |
| 773 cloneNode(node.documentationComment), | 773 cloneNode(node.documentationComment), |
| 774 cloneNodeList(node.metadata), | 774 cloneNodeList(node.metadata), |
| 775 cloneToken(node.keyword), | 775 cloneToken(node.keyword), |
| 776 cloneNode(node.type), | 776 cloneNode(node.type), |
| 777 cloneNode(node.identifier)); | 777 cloneNode(node.identifier)); |
| 778 | 778 |
| 779 @override | 779 @override |
| 780 SimpleIdentifier visitSimpleIdentifier(SimpleIdentifier node) => | 780 SimpleIdentifier visitSimpleIdentifier(SimpleIdentifier node) => |
| 781 new SimpleIdentifier(cloneToken(node.token)); | 781 new SimpleIdentifier(cloneToken(node.token), |
| 782 isDeclaration: node.inDeclarationContext()); |
| 782 | 783 |
| 783 @override | 784 @override |
| 784 SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node) => | 785 SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node) => |
| 785 new SimpleStringLiteral(cloneToken(node.literal), node.value); | 786 new SimpleStringLiteral(cloneToken(node.literal), node.value); |
| 786 | 787 |
| 787 @override | 788 @override |
| 788 StringInterpolation visitStringInterpolation(StringInterpolation node) => | 789 StringInterpolation visitStringInterpolation(StringInterpolation node) => |
| 789 new StringInterpolation(cloneNodeList(node.elements)); | 790 new StringInterpolation(cloneNodeList(node.elements)); |
| 790 | 791 |
| 791 @override | 792 @override |
| (...skipping 2634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3426 SimpleIdentifier visitSimpleIdentifier(SimpleIdentifier node) { | 3427 SimpleIdentifier visitSimpleIdentifier(SimpleIdentifier node) { |
| 3427 Token mappedToken = _mapToken(node.token); | 3428 Token mappedToken = _mapToken(node.token); |
| 3428 if (mappedToken == null) { | 3429 if (mappedToken == null) { |
| 3429 // This only happens for SimpleIdentifiers created by the parser as part | 3430 // This only happens for SimpleIdentifiers created by the parser as part |
| 3430 // of scanning documentation comments (the tokens for those identifiers | 3431 // of scanning documentation comments (the tokens for those identifiers |
| 3431 // are not in the original token stream and hence do not get copied). | 3432 // are not in the original token stream and hence do not get copied). |
| 3432 // This extra check can be removed if the scanner is changed to scan | 3433 // This extra check can be removed if the scanner is changed to scan |
| 3433 // documentation comments for the parser. | 3434 // documentation comments for the parser. |
| 3434 mappedToken = node.token; | 3435 mappedToken = node.token; |
| 3435 } | 3436 } |
| 3436 SimpleIdentifier copy = new SimpleIdentifier(mappedToken); | 3437 SimpleIdentifier copy = new SimpleIdentifier(mappedToken, |
| 3438 isDeclaration: node.inDeclarationContext()); |
| 3437 copy.auxiliaryElements = node.auxiliaryElements; | 3439 copy.auxiliaryElements = node.auxiliaryElements; |
| 3438 copy.propagatedElement = node.propagatedElement; | 3440 copy.propagatedElement = node.propagatedElement; |
| 3439 copy.propagatedType = node.propagatedType; | 3441 copy.propagatedType = node.propagatedType; |
| 3440 copy.staticElement = node.staticElement; | 3442 copy.staticElement = node.staticElement; |
| 3441 copy.staticType = node.staticType; | 3443 copy.staticType = node.staticType; |
| 3442 return copy; | 3444 return copy; |
| 3443 } | 3445 } |
| 3444 | 3446 |
| 3445 @override | 3447 @override |
| 3446 SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node) { | 3448 SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node) { |
| (...skipping 4336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7783 * Safely visit the given [token], printing the [suffix] after the token if it | 7785 * Safely visit the given [token], printing the [suffix] after the token if it |
| 7784 * is non-`null`. | 7786 * is non-`null`. |
| 7785 */ | 7787 */ |
| 7786 void _visitTokenWithSuffix(Token token, String suffix) { | 7788 void _visitTokenWithSuffix(Token token, String suffix) { |
| 7787 if (token != null) { | 7789 if (token != null) { |
| 7788 _writer.print(token.lexeme); | 7790 _writer.print(token.lexeme); |
| 7789 _writer.print(suffix); | 7791 _writer.print(suffix); |
| 7790 } | 7792 } |
| 7791 } | 7793 } |
| 7792 } | 7794 } |
| OLD | NEW |