OLD | NEW |
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 library engine.utilities.asserts; | 5 library analyzer.src.util.asserts; |
6 | 6 |
7 /** | 7 /** |
8 * Ensures that the given [value] is not null. | 8 * Ensures that the given [value] is not null. |
9 * Otherwise throws an [ArgumentError]. | 9 * Otherwise throws an [ArgumentError]. |
10 * An optional [description] is used in the error message. | 10 * An optional [description] is used in the error message. |
11 */ | 11 */ |
12 void notNull(Object value, [String description]) { | 12 void notNull(Object value, [String description]) { |
13 if (value == null) { | 13 if (value == null) { |
14 if (description == null) { | 14 if (description == null) { |
15 throw new ArgumentError('Must not be null'); | 15 throw new ArgumentError('Must not be null'); |
16 } else { | 16 } else { |
17 throw new ArgumentError('Must not be null: $description'); | 17 throw new ArgumentError('Must not be null: $description'); |
18 } | 18 } |
19 } | 19 } |
20 } | 20 } |
OLD | NEW |