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

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

Issue 2976963002: Add --no-declaration-casts option to analyzer. (Closed)
Patch Set: Fix comment Created 3 years, 5 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) 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 'dart:async'; 9 import 'dart:async';
10 10
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 263 }
264 264
265 /// Run the checker on a program, staring from '/main.dart', and verifies that 265 /// Run the checker on a program, staring from '/main.dart', and verifies that
266 /// errors/warnings/hints match the expected value. 266 /// errors/warnings/hints match the expected value.
267 /// 267 ///
268 /// See [addFile] for more information about how to encode expectations in 268 /// See [addFile] for more information about how to encode expectations in
269 /// the file text. 269 /// the file text.
270 /// 270 ///
271 /// Returns the main resolved library. This can be used for further checks. 271 /// Returns the main resolved library. This can be used for further checks.
272 Future<CompilationUnit> check( 272 Future<CompilationUnit> check(
273 {bool implicitCasts: true, 273 {bool declarationCasts: true,
274 bool implicitCasts: true,
274 bool implicitDynamic: true, 275 bool implicitDynamic: true,
275 List<String> nonnullableTypes: 276 List<String> nonnullableTypes:
276 AnalysisOptionsImpl.NONNULLABLE_TYPES}) async { 277 AnalysisOptionsImpl.NONNULLABLE_TYPES}) async {
277 _checkCalled = true; 278 _checkCalled = true;
278 279
279 File mainFile = 280 File mainFile =
280 _resourceProvider.getFile(_resourceProvider.convertPath('/main.dart')); 281 _resourceProvider.getFile(_resourceProvider.convertPath('/main.dart'));
281 expect(mainFile.exists, true, reason: '`/main.dart` is missing'); 282 expect(mainFile.exists, true, reason: '`/main.dart` is missing');
282 283
283 AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl(); 284 AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl();
284 analysisOptions.strongMode = true; 285 analysisOptions.strongMode = true;
285 analysisOptions.strongModeHints = true; 286 analysisOptions.strongModeHints = true;
287 analysisOptions.declarationCasts = declarationCasts;
286 analysisOptions.implicitCasts = implicitCasts; 288 analysisOptions.implicitCasts = implicitCasts;
287 analysisOptions.implicitDynamic = implicitDynamic; 289 analysisOptions.implicitDynamic = implicitDynamic;
288 analysisOptions.nonnullableTypes = nonnullableTypes; 290 analysisOptions.nonnullableTypes = nonnullableTypes;
289 291
290 var mockSdk = new MockSdk(resourceProvider: _resourceProvider); 292 var mockSdk = new MockSdk(resourceProvider: _resourceProvider);
291 mockSdk.context.analysisOptions = analysisOptions; 293 mockSdk.context.analysisOptions = analysisOptions;
292 294
293 SourceFactory sourceFactory; 295 SourceFactory sourceFactory;
294 { 296 {
295 var uriResolver = new _TestUriResolver(_resourceProvider); 297 var uriResolver = new _TestUriResolver(_resourceProvider);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 @override 474 @override
473 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 475 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
474 if (uri.scheme == 'package') { 476 if (uri.scheme == 'package') {
475 return (provider.getResource( 477 return (provider.getResource(
476 provider.convertPath('/packages/' + uri.path)) as File) 478 provider.convertPath('/packages/' + uri.path)) as File)
477 .createSource(uri); 479 .createSource(uri);
478 } 480 }
479 return super.resolveAbsolute(uri, actualUri); 481 return super.resolveAbsolute(uri, actualUri);
480 } 482 }
481 } 483 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/task/strong/checker_test.dart ('k') | pkg/analyzer_cli/lib/src/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698