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

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

Issue 738673002: Use shorter DartElementLocation. (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
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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 TimestampedData<String> contents = _context.getContents(source); 598 TimestampedData<String> contents = _context.getContents(source);
599 expect(contents.data.toString(), content); 599 expect(contents.data.toString(), content);
600 } 600 }
601 601
602 void test_getDeclaredVariables() { 602 void test_getDeclaredVariables() {
603 _context = AnalysisContextFactory.contextWithCore(); 603 _context = AnalysisContextFactory.contextWithCore();
604 expect(_context.declaredVariables, isNotNull); 604 expect(_context.declaredVariables, isNotNull);
605 } 605 }
606 606
607 void test_getElement() { 607 void test_getElement() {
608 _context = AnalysisContextFactory.contextWithCore(); 608 Source source = _addSource('/test.dart', r'''
609 _sourceFactory = _context.sourceFactory; 609 class A {}
610 LibraryElement core = 610 class B {}
611 _context.computeLibraryElement(_sourceFactory.forUri("dart:core")); 611 class C {}
612 expect(core, isNotNull); 612 ''');
613 ClassElement classObject = 613 _analyzeAll_assertFinished();
614 _findClass(core.definingCompilationUnit, "Object"); 614 LibraryElement library = _context.computeLibraryElement(source);
615 expect(classObject, isNotNull); 615 ClassElement classB = library.definingCompilationUnit.getType('B');
616 ElementLocation location = classObject.location; 616 expect(classB, isNotNull);
617 ElementLocation location = classB.location;
617 Element element = _context.getElement(location); 618 Element element = _context.getElement(location);
618 expect(element, same(classObject)); 619 expect(element, same(classB));
619 } 620 }
620 621
621 void test_getElement_constructor_named() { 622 void test_getElement_constructor_named() {
622 Source source = _addSource("/lib.dart", r''' 623 Source source = _addSource("/lib.dart", r'''
623 class A { 624 class A {
624 A.named() {} 625 A.named() {}
625 }'''); 626 }''');
626 _analyzeAll_assertFinished(); 627 _analyzeAll_assertFinished();
627 LibraryElement library = _context.computeLibraryElement(source); 628 LibraryElement library = _context.computeLibraryElement(source);
628 ClassElement classA = _findClass(library.definingCompilationUnit, "A"); 629 ClassElement classA = _findClass(library.definingCompilationUnit, "A");
(...skipping 6586 matching lines...) Expand 10 before | Expand all | Expand 10 after
7215 bool contains(Source source) => source == libB; 7216 bool contains(Source source) => source == libB;
7216 } 7217 }
7217 7218
7218 7219
7219 class _UniversalCachePartitionTest_test_setMaxCacheSize implements 7220 class _UniversalCachePartitionTest_test_setMaxCacheSize implements
7220 CacheRetentionPolicy { 7221 CacheRetentionPolicy {
7221 @override 7222 @override
7222 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => 7223 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) =>
7223 RetentionPriority.LOW; 7224 RetentionPriority.LOW;
7224 } 7225 }
OLDNEW
« pkg/analyzer/lib/src/generated/element.dart ('K') | « pkg/analyzer/test/generated/element_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698