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

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

Issue 2003633002: Use FastUri instead of Uri in analyzer. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Added test file. Created 4 years, 7 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) 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.generated.analysis_context_factory; 5 library analyzer.test.generated.analysis_context_factory;
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/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 505
506 void runTasks() { 506 void runTasks() {
507 AnalysisResult result = context.performAnalysisTask(); 507 AnalysisResult result = context.performAnalysisTask();
508 while (result.changeNotices != null) { 508 while (result.changeNotices != null) {
509 result = context.performAnalysisTask(); 509 result = context.performAnalysisTask();
510 } 510 }
511 } 511 }
512 } 512 }
513 513
514 class TestPackageUriResolver extends UriResolver { 514 class TestPackageUriResolver extends UriResolver {
515 Map<Uri, Source> sourceMap = new HashMap<Uri, Source>(); 515 Map<String, Source> sourceMap = new HashMap<String, Source>();
516 516
517 TestPackageUriResolver(Map<String, String> map) { 517 TestPackageUriResolver(Map<String, String> map) {
518 map.forEach((String uri, String contents) { 518 map.forEach((String uri, String contents) {
519 sourceMap[Uri.parse(uri)] = 519 sourceMap[uri] = new StringSource(contents, '/test_pkg_source.dart');
520 new StringSource(contents, '/test_pkg_source.dart');
521 }); 520 });
522 } 521 }
523 522
524 @override 523 @override
525 Source resolveAbsolute(Uri uri, [Uri actualUri]) => sourceMap[uri]; 524 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
525 String uriString = uri.toString();
526 return sourceMap[uriString];
527 }
526 528
527 @override 529 @override
528 Uri restoreAbsolute(Source source) => throw new UnimplementedError(); 530 Uri restoreAbsolute(Source source) => throw new UnimplementedError();
529 } 531 }
530 532
531 class _AnalysisContextFactory_initContextWithCore 533 class _AnalysisContextFactory_initContextWithCore
532 extends DirectoryBasedDartSdk { 534 extends DirectoryBasedDartSdk {
533 final bool enableAsync; 535 final bool enableAsync;
534 _AnalysisContextFactory_initContextWithCore(JavaFile arg0, 536 _AnalysisContextFactory_initContextWithCore(JavaFile arg0,
535 {this.enableAsync: true}) 537 {this.enableAsync: true})
(...skipping 17 matching lines...) Expand all
553 555
554 void _addLibrary(LibraryMap map, String uri, bool isInternal, String path) { 556 void _addLibrary(LibraryMap map, String uri, bool isInternal, String path) {
555 SdkLibraryImpl library = new SdkLibraryImpl(uri); 557 SdkLibraryImpl library = new SdkLibraryImpl(uri);
556 if (isInternal) { 558 if (isInternal) {
557 library.category = "Internal"; 559 library.category = "Internal";
558 } 560 }
559 library.path = path; 561 library.path = path;
560 map.setLibrary(uri, library); 562 map.setLibrary(uri, library);
561 } 563 }
562 } 564 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698