[analyzer] Remove unnecessary non-null assertion util
These assertions are no longer necessary now that the analyzer always runs in sound mode now. Change-Id: Ie5888c3f424b69fda39d55d442770c51accdc8f9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424360 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
committed by
Commit Queue
parent
7f932b09b6
commit
cc1383e2ea
@@ -6,7 +6,6 @@ import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/source/file_source.dart';
|
||||
import 'package:analyzer/source/source.dart';
|
||||
import 'package:analyzer/src/generated/source.dart' show UriResolver;
|
||||
import 'package:analyzer/src/util/asserts.dart' as asserts;
|
||||
import 'package:analyzer/src/utilities/uri_cache.dart';
|
||||
import 'package:path/path.dart' as pathos;
|
||||
|
||||
@@ -28,12 +27,10 @@ class PackageMapUriResolver extends UriResolver {
|
||||
/// [packageMap] is a table mapping package names to the paths of the
|
||||
/// directories containing the package
|
||||
PackageMapUriResolver(this.resourceProvider, this.packageMap) {
|
||||
asserts.notNull(resourceProvider);
|
||||
asserts.notNull(packageMap);
|
||||
packageMap.forEach((name, folders) {
|
||||
if (folders.length != 1) {
|
||||
throw ArgumentError(
|
||||
'Exactly one folder must be specified for a package.'
|
||||
'Exactly one folder must be specified for a package. '
|
||||
'Found $name = $folders',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
/// Ensures that the given [value] is not null.
|
||||
/// Otherwise throws an [ArgumentError].
|
||||
/// An optional [description] is used in the error message.
|
||||
void notNull(Object? value, [String? description]) {
|
||||
if (value == null) {
|
||||
if (description == null) {
|
||||
throw ArgumentError('Must not be null');
|
||||
} else {
|
||||
throw ArgumentError('Must not be null: $description');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/util/asserts.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
main() {
|
||||
defineReflectiveSuite(() {
|
||||
defineReflectiveTests(AnalysisTaskTest);
|
||||
});
|
||||
}
|
||||
|
||||
@reflectiveTest
|
||||
class AnalysisTaskTest {
|
||||
void test_notNull_notNull() {
|
||||
notNull(this);
|
||||
}
|
||||
|
||||
void test_notNull_null_hasDescription() {
|
||||
expect(() => notNull(null, 'desc'), throwsArgumentError);
|
||||
}
|
||||
|
||||
void test_notNull_null_noDescription() {
|
||||
expect(() => notNull(null), throwsArgumentError);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import 'asserts_test.dart' as asserts_test;
|
||||
import 'either_test.dart' as either_test;
|
||||
import 'glob_test.dart' as glob_test;
|
||||
import 'lru_map_test.dart' as lru_map_test;
|
||||
@@ -13,7 +12,6 @@ import 'yaml_test.dart' as yaml_test;
|
||||
/// Utility for manually running all tests.
|
||||
main() {
|
||||
defineReflectiveSuite(() {
|
||||
asserts_test.main();
|
||||
either_test.main();
|
||||
glob_test.main();
|
||||
lru_map_test.main();
|
||||
|
||||
Reference in New Issue
Block a user