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

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

Issue 1842363004: More strong mode fixes for analyzer (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Backout options changes Created 4 years, 8 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/options_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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 /// Returns the main resolved library. This can be used for further checks. 56 /// Returns the main resolved library. This can be used for further checks.
57 CompilationUnit check() { 57 CompilationUnit check() {
58 _checkCalled = true; 58 _checkCalled = true;
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 context.analysisOptions.strongMode = true; 66 AnalysisOptionsImpl options = context.analysisOptions as AnalysisOptionsImpl;
67 (context.analysisOptions as AnalysisOptionsImpl).strongModeHints = true; 67 options.strongMode = true;
68 options.strongModeHints = true;
68 context.sourceFactory = 69 context.sourceFactory =
69 new SourceFactory([new DartUriResolver(new MockSdk()), uriResolver]); 70 new SourceFactory([new DartUriResolver(new MockSdk()), uriResolver]);
70 71
71 // Run the checker on /main.dart. 72 // Run the checker on /main.dart.
72 Source mainSource = uriResolver.resolveAbsolute(new Uri.file('/main.dart')); 73 Source mainSource = uriResolver.resolveAbsolute(new Uri.file('/main.dart'));
73 var initialLibrary = context.resolveCompilationUnit2(mainSource, mainSource); 74 var initialLibrary = context.resolveCompilationUnit2(mainSource, mainSource);
74 75
75 var collector = new _ErrorCollector(); 76 var collector = new _ErrorCollector();
76 77
77 // Extract expectations from the comments in the test files, and 78 // Extract expectations from the comments in the test files, and
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 391
391 @override 392 @override
392 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 393 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
393 if (uri.scheme == 'package') { 394 if (uri.scheme == 'package') {
394 return (provider.getResource('/packages/' + uri.path) as File) 395 return (provider.getResource('/packages/' + uri.path) as File)
395 .createSource(uri); 396 .createSource(uri);
396 } 397 }
397 return super.resolveAbsolute(uri, actualUri); 398 return super.resolveAbsolute(uri, actualUri);
398 } 399 }
399 } 400 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/task/options_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698