OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.src.dart.constant.utilities_test; | 5 library analyzer.test.src.dart.constant.utilities_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
8 import 'package:analyzer/dart/ast/token.dart'; | 9 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/src/dart/ast/token.dart'; | 11 import 'package:analyzer/src/dart/ast/token.dart'; |
11 import 'package:analyzer/src/dart/element/element.dart'; | 12 import 'package:analyzer/src/dart/element/element.dart'; |
12 import 'package:analyzer/src/generated/constant.dart'; | 13 import 'package:analyzer/src/generated/constant.dart'; |
13 import 'package:analyzer/src/generated/engine.dart'; | 14 import 'package:analyzer/src/generated/engine.dart'; |
14 import 'package:analyzer/src/generated/resolver.dart'; | 15 import 'package:analyzer/src/generated/resolver.dart'; |
15 import 'package:analyzer/src/generated/source.dart'; | 16 import 'package:analyzer/src/generated/source.dart'; |
16 import 'package:analyzer/src/generated/source_io.dart'; | 17 import 'package:analyzer/src/generated/source_io.dart'; |
17 import 'package:analyzer/src/generated/testing/ast_test_factory.dart'; | 18 import 'package:analyzer/src/generated/testing/ast_test_factory.dart'; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 new ElementAnnotationImpl(compilationUnitElement); | 59 new ElementAnnotationImpl(compilationUnitElement); |
59 _node = elementAnnotation.annotationAst = AstTestFactory.annotation( | 60 _node = elementAnnotation.annotationAst = AstTestFactory.annotation( |
60 AstTestFactory.identifier3('x'))..elementAnnotation = elementAnnotation; | 61 AstTestFactory.identifier3('x'))..elementAnnotation = elementAnnotation; |
61 expect(_findAnnotations(), contains(_node)); | 62 expect(_findAnnotations(), contains(_node)); |
62 } | 63 } |
63 | 64 |
64 void test_visitAnnotation_enumConstant() { | 65 void test_visitAnnotation_enumConstant() { |
65 // Analyzer ignores annotations on enum constant declarations. | 66 // Analyzer ignores annotations on enum constant declarations. |
66 Annotation annotation = AstTestFactory.annotation2( | 67 Annotation annotation = AstTestFactory.annotation2( |
67 AstTestFactory.identifier3('A'), null, AstTestFactory.argumentList()); | 68 AstTestFactory.identifier3('A'), null, AstTestFactory.argumentList()); |
68 _node = new EnumConstantDeclaration( | 69 _node = astFactory.enumConstantDeclaration( |
69 null, <Annotation>[annotation], AstTestFactory.identifier3('C')); | 70 null, <Annotation>[annotation], AstTestFactory.identifier3('C')); |
70 expect(_findConstants(), isEmpty); | 71 expect(_findConstants(), isEmpty); |
71 } | 72 } |
72 | 73 |
73 /** | 74 /** |
74 * Test an annotation that represents the invocation of a constant | 75 * Test an annotation that represents the invocation of a constant |
75 * constructor. | 76 * constructor. |
76 */ | 77 */ |
77 void test_visitAnnotation_invocation() { | 78 void test_visitAnnotation_invocation() { |
78 CompilationUnitElement compilationUnitElement = | 79 CompilationUnitElement compilationUnitElement = |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 356 |
356 void _visitNode(AstNode node) { | 357 void _visitNode(AstNode node) { |
357 node.accept(_createReferenceFinder(_head)); | 358 node.accept(_createReferenceFinder(_head)); |
358 } | 359 } |
359 } | 360 } |
360 | 361 |
361 class _TestAnalysisContext extends TestAnalysisContext { | 362 class _TestAnalysisContext extends TestAnalysisContext { |
362 @override | 363 @override |
363 InternalAnalysisContext getContextFor(Source source) => this; | 364 InternalAnalysisContext getContextFor(Source source) => this; |
364 } | 365 } |
OLD | NEW |