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