Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions lib/ui/semantics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ part of dart.ui;
// `lib/ui/semantics/semantics_node.h` and in each of the embedders *must* be
// updated.
class SemanticsAction {
const SemanticsAction._(this.index);
const SemanticsAction._(this.index) : assert(index != null);

static const int _kTapIndex = 1 << 0;
static const int _kLongPressIndex = 1 << 1;
Expand Down Expand Up @@ -42,7 +42,7 @@ class SemanticsAction {
/// The numerical value for this action.
///
/// Each action has one bit set in this bit field.
final int index;
final int/*!*/ index;

/// The equivalent of a user briefly tapping the screen with the finger
/// without moving it.
Expand Down Expand Up @@ -263,7 +263,8 @@ class SemanticsAction {
case _kMoveCursorBackwardByWordIndex:
return 'SemanticsAction.moveCursorBackwardByWord';
}
return null;
assert(false, 'Unhandled index: $index');
return '';
}
}

Expand Down Expand Up @@ -299,12 +300,12 @@ class SemanticsFlag {
// READ THIS: if you add a flag here, you MUST update the numSemanticsFlags
// value in testing/dart/semantics_test.dart, or tests will fail.

const SemanticsFlag._(this.index);
const SemanticsFlag._(this.index) : assert(index != null);

/// The numerical value for this flag.
///
/// Each flag has one bit set in this bit field.
final int index;
final int/*!*/ index;

/// The semantics node has the quality of either being "checked" or "unchecked".
///
Expand Down Expand Up @@ -596,7 +597,8 @@ class SemanticsFlag {
case _kIsLinkIndex:
return 'SemanticsFlag.isLink';
}
return null;
assert(false, 'Unhandled index: $index');
return '';
}
}

Expand Down
14 changes: 8 additions & 6 deletions lib/web_ui/lib/src/ui/semantics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ part of ui;
/// The possible actions that can be conveyed from the operating system
/// accessibility APIs to a semantics node.
class SemanticsAction {
const SemanticsAction._(this.index);
const SemanticsAction._(this.index) : assert(index != null);

static const int _kTapIndex = 1 << 0;
static const int _kLongPressIndex = 1 << 1;
Expand All @@ -35,7 +35,7 @@ class SemanticsAction {
/// The numerical value for this action.
///
/// Each action has one bit set in this bit field.
final int index;
final int/*!*/ index;

/// The equivalent of a user briefly tapping the screen with the finger
/// without moving it.
Expand Down Expand Up @@ -267,7 +267,8 @@ class SemanticsAction {
case _kMoveCursorBackwardByWordIndex:
return 'SemanticsAction.moveCursorBackwardByWord';
}
return null;
assert(false, 'Unhandled index: $index');
return '';
}
}

Expand Down Expand Up @@ -297,12 +298,12 @@ class SemanticsFlag {
static const int _kIsFocusableIndex = 1 << 21;
static const int _kIsLinkIndex = 1 << 22;

const SemanticsFlag._(this.index);
const SemanticsFlag._(this.index) : assert(index != null);

/// The numerical value for this flag.
///
/// Each flag has one bit set in this bit field.
final int index;
final int/*!*/ index;

/// The semantics node has the quality of either being "checked" or "unchecked".
///
Expand Down Expand Up @@ -601,7 +602,8 @@ class SemanticsFlag {
case _kIsReadOnlyIndex:
return 'SemanticsFlag.isReadOnly';
}
return null;
assert(false, 'Unhandled index: $index');
return '';
}
}

Expand Down