Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(557)

Side by Side Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1668483003: Create ElementAnnotation objects prior to resolution. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.resolver_test; 5 library analyzer.test.generated.resolver_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/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 _listener.assertNoErrors(); 1591 _listener.assertNoErrors();
1592 } 1592 }
1593 1593
1594 void test_visitContinueStatement_withoutLabel() { 1594 void test_visitContinueStatement_withoutLabel() {
1595 ContinueStatement statement = AstFactory.continueStatement(); 1595 ContinueStatement statement = AstFactory.continueStatement();
1596 _resolveStatement(statement, null, null); 1596 _resolveStatement(statement, null, null);
1597 _listener.assertNoErrors(); 1597 _listener.assertNoErrors();
1598 } 1598 }
1599 1599
1600 void test_visitEnumDeclaration() { 1600 void test_visitEnumDeclaration() {
1601 CompilationUnitElementImpl compilationUnitElement =
1602 ElementFactory.compilationUnit('foo.dart');
1601 ClassElementImpl enumElement = 1603 ClassElementImpl enumElement =
1602 ElementFactory.enumElement(_typeProvider, ('E')); 1604 ElementFactory.enumElement(_typeProvider, ('E'));
1605 compilationUnitElement.enums = <ClassElement>[enumElement];
1603 EnumDeclaration enumNode = AstFactory.enumDeclaration2('E', []); 1606 EnumDeclaration enumNode = AstFactory.enumDeclaration2('E', []);
1604 Annotation annotationNode = 1607 Annotation annotationNode =
1605 AstFactory.annotation(AstFactory.identifier3('a')); 1608 AstFactory.annotation(AstFactory.identifier3('a'));
1606 annotationNode.element = ElementFactory.classElement2('A'); 1609 annotationNode.element = ElementFactory.classElement2('A');
1610 annotationNode.elementAnnotation =
1611 new ElementAnnotationImpl(compilationUnitElement);
1607 enumNode.metadata.add(annotationNode); 1612 enumNode.metadata.add(annotationNode);
1608 enumNode.name.staticElement = enumElement; 1613 enumNode.name.staticElement = enumElement;
1614 List<ElementAnnotation> metadata = <ElementAnnotation>[
1615 annotationNode.elementAnnotation
1616 ];
1609 _resolveNode(enumNode); 1617 _resolveNode(enumNode);
1610 List<ElementAnnotation> metadata = enumElement.metadata; 1618 expect(metadata[0].element, annotationNode.element);
1611 expect(metadata, hasLength(1));
1612 } 1619 }
1613 1620
1614 void test_visitExportDirective_noCombinators() { 1621 void test_visitExportDirective_noCombinators() {
1615 ExportDirective directive = AstFactory.exportDirective2(null); 1622 ExportDirective directive = AstFactory.exportDirective2(null);
1616 directive.element = ElementFactory 1623 directive.element = ElementFactory
1617 .exportFor(ElementFactory.library(_definingLibrary.context, "lib")); 1624 .exportFor(ElementFactory.library(_definingLibrary.context, "lib"));
1618 _resolveNode(directive); 1625 _resolveNode(directive);
1619 _listener.assertNoErrors(); 1626 _listener.assertNoErrors();
1620 } 1627 }
1621 1628
(...skipping 15407 matching lines...) Expand 10 before | Expand all | Expand 10 after
17029 17036
17030 void _resolveTestUnit(String code) { 17037 void _resolveTestUnit(String code) {
17031 testCode = code; 17038 testCode = code;
17032 testSource = addSource(testCode); 17039 testSource = addSource(testCode);
17033 LibraryElement library = resolve2(testSource); 17040 LibraryElement library = resolve2(testSource);
17034 assertNoErrors(testSource); 17041 assertNoErrors(testSource);
17035 verify([testSource]); 17042 verify([testSource]);
17036 testUnit = resolveCompilationUnit(testSource, library); 17043 testUnit = resolveCompilationUnit(testSource, library);
17037 } 17044 }
17038 } 17045 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/non_error_resolver_test.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698