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.test.generated.utilities_test; | 5 library analyzer.test.generated.utilities_test; |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 return super.isEqualNodes(first, second); | 55 return super.isEqualNodes(first, second); |
56 } | 56 } |
57 | 57 |
58 @override | 58 @override |
59 bool isEqualTokens(Token first, Token second) { | 59 bool isEqualTokens(Token first, Token second) { |
60 if (expectTokensCopied && first != null && identical(first, second)) { | 60 if (expectTokensCopied && first != null && identical(first, second)) { |
61 fail('Failed to copy token: ${first.lexeme} (${first.offset})'); | 61 fail('Failed to copy token: ${first.lexeme} (${first.offset})'); |
62 return false; | 62 return false; |
63 } | 63 } |
64 if (first is TokenWithComment) { | 64 if (first?.precedingComments != null) { |
65 CommentToken comment = first.precedingComments; | 65 CommentToken comment = first.precedingComments; |
66 if (comment.parent != first) { | 66 if (comment.parent != first) { |
67 fail('Failed to link the comment "$comment" with the token "$first".'); | 67 fail('Failed to link the comment "$comment" with the token "$first".'); |
68 } | 68 } |
69 } | 69 } |
70 return super.isEqualTokens(first, second); | 70 return super.isEqualTokens(first, second); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 @reflectiveTest | 74 @reflectiveTest |
(...skipping 4314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4389 tokenMap.put(key, value); | 4389 tokenMap.put(key, value); |
4390 expect(tokenMap.get(key), same(value)); | 4390 expect(tokenMap.get(key), same(value)); |
4391 } | 4391 } |
4392 } | 4392 } |
4393 | 4393 |
4394 class _ExceptionThrowingVisitor extends SimpleAstVisitor { | 4394 class _ExceptionThrowingVisitor extends SimpleAstVisitor { |
4395 visitNullLiteral(NullLiteral node) { | 4395 visitNullLiteral(NullLiteral node) { |
4396 throw new ArgumentError(''); | 4396 throw new ArgumentError(''); |
4397 } | 4397 } |
4398 } | 4398 } |
OLD | NEW |