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

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

Issue 1009033002: Compute TYPE_PROVIDER using BuildTypeProviderTask. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | 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:async'; 10 import 'dart:async';
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 void fail_performAnalysisTask_importedLibraryDelete_html() { 198 void fail_performAnalysisTask_importedLibraryDelete_html() {
199 Source htmlSource = _addSource("/page.html", r''' 199 Source htmlSource = _addSource("/page.html", r'''
200 <html><body><script type="application/dart"> 200 <html><body><script type="application/dart">
201 import 'libB.dart'; 201 import 'libB.dart';
202 main() {print('hello dart');} 202 main() {print('hello dart');}
203 </script></body></html>'''); 203 </script></body></html>''');
204 Source libBSource = _addSource("/libB.dart", "library libB;"); 204 Source libBSource = _addSource("/libB.dart", "library libB;");
205 _analyzeAll_assertFinished(); 205 _analyzeAll_assertFinished();
206 expect(_context.getResolvedHtmlUnit(htmlSource), isNotNull, 206 expect(_context.getResolvedHtmlUnit(htmlSource), isNotNull,
207 reason: "htmlUnit resolved 1"); 207 reason: "htmlUnit resolved 1");
208 expect(_context.getResolvedCompilationUnit2(libBSource, libBSource), 208 expect(
209 isNotNull, reason: "libB resolved 1"); 209 _context.getResolvedCompilationUnit2(libBSource, libBSource), isNotNull,
210 reason: "libB resolved 1");
210 expect(!_hasAnalysisErrorWithErrorSeverity(_context.getErrors(htmlSource)), 211 expect(!_hasAnalysisErrorWithErrorSeverity(_context.getErrors(htmlSource)),
211 isTrue, reason: "htmlSource doesn't have errors"); 212 isTrue, reason: "htmlSource doesn't have errors");
212 // remove libB.dart content and analyze 213 // remove libB.dart content and analyze
213 _context.setContents(libBSource, null); 214 _context.setContents(libBSource, null);
214 _analyzeAll_assertFinished(); 215 _analyzeAll_assertFinished();
215 expect(_context.getResolvedHtmlUnit(htmlSource), isNotNull, 216 expect(_context.getResolvedHtmlUnit(htmlSource), isNotNull,
216 reason: "htmlUnit resolved 1"); 217 reason: "htmlUnit resolved 1");
217 AnalysisErrorInfo errors = _context.getErrors(htmlSource); 218 AnalysisErrorInfo errors = _context.getErrors(htmlSource);
218 expect(_hasAnalysisErrorWithErrorSeverity(errors), isTrue, 219 expect(_hasAnalysisErrorWithErrorSeverity(errors), isTrue,
219 reason: "htmlSource has an error"); 220 reason: "htmlSource has an error");
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 Future test_computeResolvedCompilationUnitAsync() { 684 Future test_computeResolvedCompilationUnitAsync() {
684 _context = AnalysisContextFactory.contextWithCore(); 685 _context = AnalysisContextFactory.contextWithCore();
685 _sourceFactory = _context.sourceFactory; 686 _sourceFactory = _context.sourceFactory;
686 Source source = _addSource("/lib.dart", "library lib;"); 687 Source source = _addSource("/lib.dart", "library lib;");
687 // Complete all pending analysis tasks and flush the AST so that it won't 688 // Complete all pending analysis tasks and flush the AST so that it won't
688 // be available immediately. 689 // be available immediately.
689 _performPendingAnalysisTasks(); 690 _performPendingAnalysisTasks();
690 DartEntry dartEntry = _context.getReadableSourceEntryOrNull(source); 691 DartEntry dartEntry = _context.getReadableSourceEntryOrNull(source);
691 dartEntry.flushAstStructures(); 692 dartEntry.flushAstStructures();
692 bool completed = false; 693 bool completed = false;
693 _context.computeResolvedCompilationUnitAsync(source, source).then( 694 _context
694 (CompilationUnit unit) { 695 .computeResolvedCompilationUnitAsync(source, source)
696 .then((CompilationUnit unit) {
695 expect(unit, isNotNull); 697 expect(unit, isNotNull);
696 completed = true; 698 completed = true;
697 }); 699 });
698 return pumpEventQueue().then((_) { 700 return pumpEventQueue().then((_) {
699 expect(completed, isFalse); 701 expect(completed, isFalse);
700 _performPendingAnalysisTasks(); 702 _performPendingAnalysisTasks();
701 }).then((_) => pumpEventQueue()).then((_) { 703 }).then((_) => pumpEventQueue()).then((_) {
702 expect(completed, isTrue); 704 expect(completed, isTrue);
703 }); 705 });
704 } 706 }
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 _analyzeAll_assertFinished(); 1679 _analyzeAll_assertFinished();
1678 expect(_context.getResolvedHtmlUnit(htmlSource), isNotNull, 1680 expect(_context.getResolvedHtmlUnit(htmlSource), isNotNull,
1679 reason: "htmlUnit resolved 1"); 1681 reason: "htmlUnit resolved 1");
1680 expect(_hasAnalysisErrorWithErrorSeverity(_context.getErrors(htmlSource)), 1682 expect(_hasAnalysisErrorWithErrorSeverity(_context.getErrors(htmlSource)),
1681 isTrue, reason: "htmlSource has an error"); 1683 isTrue, reason: "htmlSource has an error");
1682 // add libB.dart and analyze 1684 // add libB.dart and analyze
1683 Source libBSource = _addSource("/libB.dart", "library libB;"); 1685 Source libBSource = _addSource("/libB.dart", "library libB;");
1684 _analyzeAll_assertFinished(); 1686 _analyzeAll_assertFinished();
1685 expect(_context.getResolvedHtmlUnit(htmlSource), isNotNull, 1687 expect(_context.getResolvedHtmlUnit(htmlSource), isNotNull,
1686 reason: "htmlUnit resolved 1"); 1688 reason: "htmlUnit resolved 1");
1687 expect(_context.getResolvedCompilationUnit2(libBSource, libBSource), 1689 expect(
1688 isNotNull, reason: "libB resolved 2"); 1690 _context.getResolvedCompilationUnit2(libBSource, libBSource), isNotNull,
1691 reason: "libB resolved 2");
1689 // TODO (danrubel) commented out to fix red bots 1692 // TODO (danrubel) commented out to fix red bots
1690 // AnalysisErrorInfo errors = _context.getErrors(htmlSource); 1693 // AnalysisErrorInfo errors = _context.getErrors(htmlSource);
1691 // expect( 1694 // expect(
1692 // !_hasAnalysisErrorWithErrorSeverity(errors), 1695 // !_hasAnalysisErrorWithErrorSeverity(errors),
1693 // isTrue, 1696 // isTrue,
1694 // reason: "htmlSource doesn't have errors"); 1697 // reason: "htmlSource doesn't have errors");
1695 } 1698 }
1696 1699
1697 void test_performAnalysisTask_importedLibraryDelete() { 1700 void test_performAnalysisTask_importedLibraryDelete() {
1698 Source libASource = 1701 Source libASource =
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 entry.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, source, 2347 entry.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, source,
2345 <AnalysisError>[ 2348 <AnalysisError>[
2346 new AnalysisError.con1( 2349 new AnalysisError.con1(
2347 source, CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION) 2350 source, CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION)
2348 ]); 2351 ]);
2349 entry.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, source, 2352 entry.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, source,
2350 <AnalysisError>[ 2353 <AnalysisError>[
2351 new AnalysisError.con1( 2354 new AnalysisError.con1(
2352 source, StaticWarningCode.CASE_BLOCK_NOT_TERMINATED) 2355 source, StaticWarningCode.CASE_BLOCK_NOT_TERMINATED)
2353 ]); 2356 ]);
2354 entry.setValueInLibrary(DartEntry.HINTS, source, <AnalysisError>[ 2357 entry.setValueInLibrary(DartEntry.HINTS, source,
2355 new AnalysisError.con1(source, HintCode.DEAD_CODE) 2358 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE)]);
2356 ]);
2357 expect(entry.allErrors, hasLength(6)); 2359 expect(entry.allErrors, hasLength(6));
2358 } 2360 }
2359 2361
2360 void test_creation() { 2362 void test_creation() {
2361 Source librarySource = new TestSource(); 2363 Source librarySource = new TestSource();
2362 DartEntry entry = new DartEntry(); 2364 DartEntry entry = new DartEntry();
2363 expect(entry.getState(SourceEntry.CONTENT), same(CacheState.INVALID)); 2365 expect(entry.getState(SourceEntry.CONTENT), same(CacheState.INVALID));
2364 expect(entry.getState(SourceEntry.LINE_INFO), same(CacheState.INVALID)); 2366 expect(entry.getState(SourceEntry.LINE_INFO), same(CacheState.INVALID));
2365 expect(entry.getState(DartEntry.CONTAINING_LIBRARIES), 2367 expect(entry.getState(DartEntry.CONTAINING_LIBRARIES),
2366 same(CacheState.INVALID)); 2368 same(CacheState.INVALID));
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
3386 void test_setValue_element() { 3388 void test_setValue_element() {
3387 _setValue(DartEntry.ELEMENT, new LibraryElementImpl.forNode( 3389 _setValue(DartEntry.ELEMENT, new LibraryElementImpl.forNode(
3388 null, AstFactory.libraryIdentifier2(["lib"]))); 3390 null, AstFactory.libraryIdentifier2(["lib"])));
3389 } 3391 }
3390 3392
3391 void test_setValue_exportedLibraries() { 3393 void test_setValue_exportedLibraries() {
3392 _setValue(DartEntry.EXPORTED_LIBRARIES, <Source>[new TestSource()]); 3394 _setValue(DartEntry.EXPORTED_LIBRARIES, <Source>[new TestSource()]);
3393 } 3395 }
3394 3396
3395 void test_setValue_hints() { 3397 void test_setValue_hints() {
3396 _setValueInLibrary(DartEntry.HINTS, <AnalysisError>[ 3398 _setValueInLibrary(DartEntry.HINTS,
3397 new AnalysisError.con1(null, HintCode.DEAD_CODE) 3399 <AnalysisError>[new AnalysisError.con1(null, HintCode.DEAD_CODE)]);
3398 ]);
3399 } 3400 }
3400 3401
3401 void test_setValue_importedLibraries() { 3402 void test_setValue_importedLibraries() {
3402 _setValue(DartEntry.IMPORTED_LIBRARIES, <Source>[new TestSource()]); 3403 _setValue(DartEntry.IMPORTED_LIBRARIES, <Source>[new TestSource()]);
3403 } 3404 }
3404 3405
3405 void test_setValue_includedParts() { 3406 void test_setValue_includedParts() {
3406 _setValue(DartEntry.INCLUDED_PARTS, <Source>[new TestSource()]); 3407 _setValue(DartEntry.INCLUDED_PARTS, <Source>[new TestSource()]);
3407 } 3408 }
3408 3409
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
3946 void test_getAllErrors() { 3947 void test_getAllErrors() {
3947 Source source = new TestSource(); 3948 Source source = new TestSource();
3948 HtmlEntry entry = new HtmlEntry(); 3949 HtmlEntry entry = new HtmlEntry();
3949 expect(entry.allErrors, hasLength(0)); 3950 expect(entry.allErrors, hasLength(0));
3950 entry.setValue(HtmlEntry.PARSE_ERRORS, <AnalysisError>[ 3951 entry.setValue(HtmlEntry.PARSE_ERRORS, <AnalysisError>[
3951 new AnalysisError.con1(source, ParserErrorCode.EXPECTED_TOKEN, [";"]) 3952 new AnalysisError.con1(source, ParserErrorCode.EXPECTED_TOKEN, [";"])
3952 ]); 3953 ]);
3953 entry.setValue(HtmlEntry.RESOLUTION_ERRORS, <AnalysisError>[ 3954 entry.setValue(HtmlEntry.RESOLUTION_ERRORS, <AnalysisError>[
3954 new AnalysisError.con1(source, HtmlWarningCode.INVALID_URI, ["-"]) 3955 new AnalysisError.con1(source, HtmlWarningCode.INVALID_URI, ["-"])
3955 ]); 3956 ]);
3956 entry.setValue(HtmlEntry.HINTS, <AnalysisError>[ 3957 entry.setValue(HtmlEntry.HINTS,
3957 new AnalysisError.con1(source, HintCode.DEAD_CODE) 3958 <AnalysisError>[new AnalysisError.con1(source, HintCode.DEAD_CODE)]);
3958 ]);
3959 expect(entry.allErrors, hasLength(3)); 3959 expect(entry.allErrors, hasLength(3));
3960 } 3960 }
3961 3961
3962 void test_invalidateAllResolutionInformation() { 3962 void test_invalidateAllResolutionInformation() {
3963 HtmlEntry entry = _entryWithValidState(); 3963 HtmlEntry entry = _entryWithValidState();
3964 entry.invalidateAllResolutionInformation(false); 3964 entry.invalidateAllResolutionInformation(false);
3965 expect(entry.getState(HtmlEntry.ELEMENT), same(CacheState.INVALID)); 3965 expect(entry.getState(HtmlEntry.ELEMENT), same(CacheState.INVALID));
3966 expect(entry.getState(HtmlEntry.HINTS), same(CacheState.INVALID)); 3966 expect(entry.getState(HtmlEntry.HINTS), same(CacheState.INVALID));
3967 expect(entry.getState(SourceEntry.LINE_INFO), same(CacheState.VALID)); 3967 expect(entry.getState(SourceEntry.LINE_INFO), same(CacheState.VALID));
3968 expect(entry.getState(HtmlEntry.PARSE_ERRORS), same(CacheState.VALID)); 3968 expect(entry.getState(HtmlEntry.PARSE_ERRORS), same(CacheState.VALID));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4013 4013
4014 void test_setState_resolutionErrors() { 4014 void test_setState_resolutionErrors() {
4015 state = HtmlEntry.RESOLUTION_ERRORS; 4015 state = HtmlEntry.RESOLUTION_ERRORS;
4016 } 4016 }
4017 4017
4018 void test_setValue_element() { 4018 void test_setValue_element() {
4019 _setValue(HtmlEntry.ELEMENT, new HtmlElementImpl(null, "test.html")); 4019 _setValue(HtmlEntry.ELEMENT, new HtmlElementImpl(null, "test.html"));
4020 } 4020 }
4021 4021
4022 void test_setValue_hints() { 4022 void test_setValue_hints() {
4023 _setValue(HtmlEntry.HINTS, <AnalysisError>[ 4023 _setValue(HtmlEntry.HINTS,
4024 new AnalysisError.con1(null, HintCode.DEAD_CODE) 4024 <AnalysisError>[new AnalysisError.con1(null, HintCode.DEAD_CODE)]);
4025 ]);
4026 } 4025 }
4027 4026
4028 void test_setValue_illegal() { 4027 void test_setValue_illegal() {
4029 HtmlEntry entry = new HtmlEntry(); 4028 HtmlEntry entry = new HtmlEntry();
4030 try { 4029 try {
4031 entry.setValue(DartEntry.ELEMENT, null); 4030 entry.setValue(DartEntry.ELEMENT, null);
4032 fail("Expected IllegalArgumentException for DartEntry.ELEMENT"); 4031 fail("Expected IllegalArgumentException for DartEntry.ELEMENT");
4033 } on ArgumentError catch (exception) {} 4032 } on ArgumentError catch (exception) {}
4034 } 4033 }
4035 4034
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
5490 AnalysisContextStatistics get statistics { 5489 AnalysisContextStatistics get statistics {
5491 fail("Unexpected invocation of getStatistics"); 5490 fail("Unexpected invocation of getStatistics");
5492 return null; 5491 return null;
5493 } 5492 }
5494 @override 5493 @override
5495 TypeProvider get typeProvider { 5494 TypeProvider get typeProvider {
5496 fail("Unexpected invocation of getTypeProvider"); 5495 fail("Unexpected invocation of getTypeProvider");
5497 return null; 5496 return null;
5498 } 5497 }
5499 @override 5498 @override
5499 void set typeProvider(TypeProvider typeProvider) {
5500 fail("Unexpected invocation of set typeProvider");
5501 }
5502 @override
5500 TypeResolverVisitorFactory get typeResolverVisitorFactory { 5503 TypeResolverVisitorFactory get typeResolverVisitorFactory {
5501 fail("Unexpected invocation of getTypeResolverVisitorFactory"); 5504 fail("Unexpected invocation of getTypeResolverVisitorFactory");
5502 return null; 5505 return null;
5503 } 5506 }
5504 @override 5507 @override
5505 void addListener(AnalysisListener listener) { 5508 void addListener(AnalysisListener listener) {
5506 fail("Unexpected invocation of addListener"); 5509 fail("Unexpected invocation of addListener");
5507 } 5510 }
5508 @override 5511 @override
5509 void addSourceInfo(Source source, SourceEntry info) { 5512 void addSourceInfo(Source source, SourceEntry info) {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
5729 CompilationUnit resolveCompilationUnit2( 5732 CompilationUnit resolveCompilationUnit2(
5730 Source unitSource, Source librarySource) { 5733 Source unitSource, Source librarySource) {
5731 fail("Unexpected invocation of resolveCompilationUnit"); 5734 fail("Unexpected invocation of resolveCompilationUnit");
5732 return null; 5735 return null;
5733 } 5736 }
5734 @override 5737 @override
5735 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) { 5738 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) {
5736 fail("Unexpected invocation of resolveHtmlUnit"); 5739 fail("Unexpected invocation of resolveHtmlUnit");
5737 return null; 5740 return null;
5738 } 5741 }
5742
5739 @override 5743 @override
5740 void setChangedContents(Source source, String contents, int offset, 5744 void setChangedContents(Source source, String contents, int offset,
5741 int oldLength, int newLength) { 5745 int oldLength, int newLength) {
5742 fail("Unexpected invocation of setChangedContents"); 5746 fail("Unexpected invocation of setChangedContents");
5743 } 5747 }
5744 5748
5745 @override 5749 @override
5746 void setContents(Source source, String contents) { 5750 void setContents(Source source, String contents) {
5747 fail("Unexpected invocation of setContents"); 5751 fail("Unexpected invocation of setContents");
5748 } 5752 }
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
6572 @override 6576 @override
6573 bool exists() => true; 6577 bool exists() => true;
6574 } 6578 }
6575 6579
6576 class _UniversalCachePartitionTest_test_setMaxCacheSize 6580 class _UniversalCachePartitionTest_test_setMaxCacheSize
6577 implements CacheRetentionPolicy { 6581 implements CacheRetentionPolicy {
6578 @override 6582 @override
6579 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => 6583 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) =>
6580 RetentionPriority.LOW; 6584 RetentionPriority.LOW;
6581 } 6585 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698