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

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

Issue 685483003: Fix for AnalysisContext.getElement() for enums. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.engine_test; 8 library engine.engine_test;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 @override 204 @override
205 void setUp() { 205 void setUp() {
206 _context = new AnalysisContextImpl(); 206 _context = new AnalysisContextImpl();
207 _sourceFactory = new SourceFactory( 207 _sourceFactory = new SourceFactory(
208 [new DartUriResolver(DirectoryBasedDartSdk.defaultSdk), new FileUriResol ver()]); 208 [new DartUriResolver(DirectoryBasedDartSdk.defaultSdk), new FileUriResol ver()]);
209 _context.sourceFactory = _sourceFactory; 209 _context.sourceFactory = _sourceFactory;
210 AnalysisOptionsImpl options = 210 AnalysisOptionsImpl options =
211 new AnalysisOptionsImpl.con1(_context.analysisOptions); 211 new AnalysisOptionsImpl.con1(_context.analysisOptions);
212 options.cacheSize = 256; 212 options.cacheSize = 256;
213 options.enableAsync = true;
214 options.enableEnum = true;
213 _context.analysisOptions = options; 215 _context.analysisOptions = options;
214 } 216 }
215 217
216 @override 218 @override
217 void tearDown() { 219 void tearDown() {
218 _context = null; 220 _context = null;
219 _sourceFactory = null; 221 _sourceFactory = null;
220 super.tearDown(); 222 super.tearDown();
221 } 223 }
222 224
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 }'''); 672 }''');
671 _analyzeAll_assertFinished(); 673 _analyzeAll_assertFinished();
672 LibraryElement library = _context.computeLibraryElement(source); 674 LibraryElement library = _context.computeLibraryElement(source);
673 ClassElement classA = _findClass(library.definingCompilationUnit, "A"); 675 ClassElement classA = _findClass(library.definingCompilationUnit, "A");
674 ConstructorElement constructor = classA.constructors[0]; 676 ConstructorElement constructor = classA.constructors[0];
675 ElementLocation location = constructor.location; 677 ElementLocation location = constructor.location;
676 Element element = _context.getElement(location); 678 Element element = _context.getElement(location);
677 JUnitTestCase.assertSame(constructor, element); 679 JUnitTestCase.assertSame(constructor, element);
678 } 680 }
679 681
682 void test_getElement_enum() {
683 Source source = _addSource('/test.dart', 'enum MyEnum {A, B, C}');
684 _analyzeAll_assertFinished();
685 LibraryElement library = _context.computeLibraryElement(source);
686 ClassElement myEnum = library.definingCompilationUnit.getEnum('MyEnum');
687 ElementLocation location = myEnum.location;
688 Element element = _context.getElement(location);
689 JUnitTestCase.assertSame(myEnum, element);
690 }
691
680 void test_getErrors_dart_none() { 692 void test_getErrors_dart_none() {
681 Source source = _addSource("/lib.dart", "library lib;"); 693 Source source = _addSource("/lib.dart", "library lib;");
682 List<AnalysisError> errors = _context.getErrors(source).errors; 694 List<AnalysisError> errors = _context.getErrors(source).errors;
683 EngineTestCase.assertLength(0, errors); 695 EngineTestCase.assertLength(0, errors);
684 _context.computeErrors(source); 696 _context.computeErrors(source);
685 errors = _context.getErrors(source).errors; 697 errors = _context.getErrors(source).errors;
686 EngineTestCase.assertLength(0, errors); 698 EngineTestCase.assertLength(0, errors);
687 } 699 }
688 700
689 void test_getErrors_dart_some() { 701 void test_getErrors_dart_some() {
(...skipping 6518 matching lines...) Expand 10 before | Expand all | Expand 10 after
7208 } 7220 }
7209 } 7221 }
7210 7222
7211 7223
7212 class _UniversalCachePartitionTest_test_setMaxCacheSize implements 7224 class _UniversalCachePartitionTest_test_setMaxCacheSize implements
7213 CacheRetentionPolicy { 7225 CacheRetentionPolicy {
7214 @override 7226 @override
7215 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => 7227 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) =>
7216 RetentionPriority.LOW; 7228 RetentionPriority.LOW;
7217 } 7229 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698