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

Side by Side Diff: pkg/analyzer/test/src/task/strong/strong_test_helper.dart

Issue 2016793002: Improve Future<T>.then<R> inference (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « pkg/analyzer/test/src/task/strong/inferred_type_test.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // TODO(jmesserly): this file needs to be refactored, it's a port from 5 // TODO(jmesserly): this file needs to be refactored, it's a port from
6 // package:dev_compiler's tests 6 // package:dev_compiler's tests
7 library analyzer.test.src.task.strong.strong_test_helper; 7 library analyzer.test.src.task.strong.strong_test_helper;
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 expect(files.getFile('/main.dart').exists, true, 60 expect(files.getFile('/main.dart').exists, true,
61 reason: '`/main.dart` is missing'); 61 reason: '`/main.dart` is missing');
62 62
63 var uriResolver = new _TestUriResolver(files); 63 var uriResolver = new _TestUriResolver(files);
64 // Enable task model strong mode 64 // Enable task model strong mode
65 var context = AnalysisEngine.instance.createAnalysisContext(); 65 var context = AnalysisEngine.instance.createAnalysisContext();
66 AnalysisOptionsImpl options = context.analysisOptions as AnalysisOptionsImpl; 66 AnalysisOptionsImpl options = context.analysisOptions as AnalysisOptionsImpl;
67 options.strongMode = true; 67 options.strongMode = true;
68 options.strongModeHints = true; 68 options.strongModeHints = true;
69 var mockSdk = new MockSdk();
70 mockSdk.context.analysisOptions.strongMode = true;
69 context.sourceFactory = 71 context.sourceFactory =
70 new SourceFactory([new DartUriResolver(new MockSdk()), uriResolver]); 72 new SourceFactory([new DartUriResolver(mockSdk), uriResolver]);
71 73
72 // Run the checker on /main.dart. 74 // Run the checker on /main.dart.
73 Source mainSource = uriResolver.resolveAbsolute(new Uri.file('/main.dart')); 75 Source mainSource = uriResolver.resolveAbsolute(new Uri.file('/main.dart'));
74 var initialLibrary = context.resolveCompilationUnit2(mainSource, mainSource); 76 var initialLibrary = context.resolveCompilationUnit2(mainSource, mainSource);
75 77
76 var collector = new _ErrorCollector(); 78 var collector = new _ErrorCollector();
77 79
78 // Extract expectations from the comments in the test files, and 80 // Extract expectations from the comments in the test files, and
79 // check that all errors we emit are included in the expected map. 81 // check that all errors we emit are included in the expected map.
80 var allLibraries = _reachableLibraries(initialLibrary.element.library); 82 var allLibraries = _reachableLibraries(initialLibrary.element.library);
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 393
392 @override 394 @override
393 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 395 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
394 if (uri.scheme == 'package') { 396 if (uri.scheme == 'package') {
395 return (provider.getResource('/packages/' + uri.path) as File) 397 return (provider.getResource('/packages/' + uri.path) as File)
396 .createSource(uri); 398 .createSource(uri);
397 } 399 }
398 return super.resolveAbsolute(uri, actualUri); 400 return super.resolveAbsolute(uri, actualUri);
399 } 401 }
400 } 402 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/task/strong/inferred_type_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698