Skip to content

Commit af054ee

Browse files
jamesderlincommit-bot@chromium.org
authored andcommitted
Adjust documentation to various functions
* Adjust `exit()` documentation to mention `finally` and to further emphasize that calling `exit()` does not pass Go and does not collect $200. * Adjust `DateTime.difference` documentation to clarify the sign of the returned `Duration`. Fixes #36347. * Adjust `String.lastIndexOf` documentation to clarify what is returned. Fixes #41893. Change-Id: I6ed91e8c79a647928ced7e8f0268a62ed92fbd4e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149494 Reviewed-by: Jonas Termansen <[email protected]> Commit-Queue: Jonas Termansen <[email protected]>
1 parent 5425631 commit af054ee

File tree

7 files changed

+32
-26
lines changed

7 files changed

+32
-26
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|3719|5|94|Const constructors can't throw exceptions.
2-
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|7909|5|97|Const constructors can't throw exceptions.
1+
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|3722|5|94|Const constructors can't throw exceptions.
2+
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|7912|5|97|Const constructors can't throw exceptions.
33
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|940|5|95|Const constructors can't throw exceptions.
44
ERROR|COMPILE_TIME_ERROR|CONST_CONSTRUCTOR_THROWS_EXCEPTION|lib/core/core.dart|973|5|94|Const constructors can't throw exceptions.
5-
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|3717|3|5|Only redirecting factory constructors can be declared to be 'const'.
6-
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|7907|3|5|Only redirecting factory constructors can be declared to be 'const'.
5+
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|3720|3|5|Only redirecting factory constructors can be declared to be 'const'.
6+
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|7910|3|5|Only redirecting factory constructors can be declared to be 'const'.
77
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|938|3|5|Only redirecting factory constructors can be declared to be 'const'.
88
ERROR|SYNTACTIC_ERROR|CONST_FACTORY|lib/core/core.dart|971|3|5|Only redirecting factory constructors can be declared to be 'const'.

sdk/lib/core/date_time.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,10 @@ class DateTime implements Comparable<DateTime> {
653653
external DateTime subtract(Duration duration);
654654

655655
/**
656-
* Returns a [Duration] with the difference between [this] and [other].
656+
* Returns a [Duration] with the difference when subtracting [other] from
657+
* [this].
658+
*
659+
* The returned [Duration] will be negative if [other] occurs after [this].
657660
*
658661
* ```
659662
* var berlinWallFell = new DateTime.utc(1989, DateTime.november, 9);
@@ -865,8 +868,8 @@ class DateTime implements Comparable<DateTime> {
865868
* timezone ::= 'z' | 'Z' | sign digit{2} timezonemins_opt
866869
* timezonemins_opt ::= <empty> | colon_opt digit{2}
867870
*/
868-
static final RegExp _parseFormat = RegExp(
869-
r'^([+-]?\d{4,6})-?(\d\d)-?(\d\d)' // Day part.
870-
r'(?:[ T](\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d+))?)?)?' // Time part.
871-
r'( ?[zZ]| ?([-+])(\d\d)(?::?(\d\d))?)?)?$'); // Timezone part.
871+
static final RegExp _parseFormat =
872+
RegExp(r'^([+-]?\d{4,6})-?(\d\d)-?(\d\d)' // Day part.
873+
r'(?:[ T](\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d+))?)?)?' // Time part.
874+
r'( ?[zZ]| ?([-+])(\d\d)(?::?(\d\d))?)?)?$'); // Timezone part.
872875
}

sdk/lib/core/string.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,16 +295,16 @@ abstract class String implements Comparable<String>, Pattern {
295295
int indexOf(Pattern pattern, [int start]);
296296

297297
/**
298-
* Returns the position of the last match [pattern] in this string, searching
299-
* backward starting at [start], inclusive:
298+
* Returns the starting position of the last match [pattern] in this string,
299+
* searching backward starting at [start], inclusive:
300300
*
301301
* var string = 'Dartisans';
302302
* string.lastIndexOf('a'); // 6
303-
* string.lastIndexOf(new RegExp(r'a(r|n)')); // 6
303+
* string.lastIndexOf(RegExp(r'a(r|n)')); // 6
304304
*
305305
* Returns -1 if [pattern] could not be found in this string.
306306
*
307-
* string.lastIndexOf(new RegExp(r'DART')); // -1
307+
* string.lastIndexOf(RegExp(r'DART')); // -1
308308
*
309309
* The [start] must be non-negative and not greater than [length].
310310
*/

sdk/lib/io/process.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class _ProcessUtils {
2020
/**
2121
* Exit the Dart VM process immediately with the given exit code.
2222
*
23-
* This does not wait for any asynchronous operations to terminate. Using
24-
* [exit] is therefore very likely to lose data.
23+
* This does not wait for any asynchronous operations to terminate nor execute
24+
* `finally` blocks. Using [exit] is therefore very likely to lose data.
2525
*
2626
* While debugging, the VM will not respect the `--pause-isolates-on-exit`
2727
* flag if [exit] is called as invoking this method causes the Dart VM

sdk_nnbd/lib/core/date_time.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,10 @@ class DateTime implements Comparable<DateTime> {
653653
external DateTime subtract(Duration duration);
654654

655655
/**
656-
* Returns a [Duration] with the difference between [this] and [other].
656+
* Returns a [Duration] with the difference when subtracting [other] from
657+
* [this].
658+
*
659+
* The returned [Duration] will be negative if [other] occurs after [this].
657660
*
658661
* ```
659662
* var berlinWallFell = new DateTime.utc(1989, DateTime.november, 9);
@@ -865,8 +868,8 @@ class DateTime implements Comparable<DateTime> {
865868
* timezone ::= 'z' | 'Z' | sign digit{2} timezonemins_opt
866869
* timezonemins_opt ::= <empty> | colon_opt digit{2}
867870
*/
868-
static final RegExp _parseFormat = RegExp(
869-
r'^([+-]?\d{4,6})-?(\d\d)-?(\d\d)' // Day part.
870-
r'(?:[ T](\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d+))?)?)?' // Time part.
871-
r'( ?[zZ]| ?([-+])(\d\d)(?::?(\d\d))?)?)?$'); // Timezone part.
871+
static final RegExp _parseFormat =
872+
RegExp(r'^([+-]?\d{4,6})-?(\d\d)-?(\d\d)' // Day part.
873+
r'(?:[ T](\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d+))?)?)?' // Time part.
874+
r'( ?[zZ]| ?([-+])(\d\d)(?::?(\d\d))?)?)?$'); // Timezone part.
872875
}

sdk_nnbd/lib/core/string.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,16 +293,16 @@ abstract class String implements Comparable<String>, Pattern {
293293
int indexOf(Pattern pattern, [int start = 0]);
294294

295295
/**
296-
* Returns the position of the last match [pattern] in this string, searching
297-
* backward starting at [start], inclusive:
296+
* Returns the starting position of the last match [pattern] in this string,
297+
* searching backward starting at [start], inclusive:
298298
*
299299
* var string = 'Dartisans';
300300
* string.lastIndexOf('a'); // 6
301-
* string.lastIndexOf(new RegExp(r'a(r|n)')); // 6
301+
* string.lastIndexOf(RegExp(r'a(r|n)')); // 6
302302
*
303303
* Returns -1 if [pattern] could not be found in this string.
304304
*
305-
* string.lastIndexOf(new RegExp(r'DART')); // -1
305+
* string.lastIndexOf(RegExp(r'DART')); // -1
306306
*
307307
* If [start] is omitted, search starts from the end of the string.
308308
* If supplied, [start] must be non-negative and not greater than [length].

sdk_nnbd/lib/io/process.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class _ProcessUtils {
1818
/**
1919
* Exit the Dart VM process immediately with the given exit code.
2020
*
21-
* This does not wait for any asynchronous operations to terminate. Using
22-
* [exit] is therefore very likely to lose data.
21+
* This does not wait for any asynchronous operations to terminate nor execute
22+
* `finally` blocks. Using [exit] is therefore very likely to lose data.
2323
*
2424
* While debugging, the VM will not respect the `--pause-isolates-on-exit`
2525
* flag if [exit] is called as invoking this method causes the Dart VM

0 commit comments

Comments
 (0)