Skip to content

Commit ce5210b

Browse files
derekxu16Commit Queue
authored andcommitted
[package:vm_service] Make generator generate abstract classes for enums in service.md
Change-Id: Idd7542daadcecdd8f71eebafdae3a8e7eecb7e9e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313641 Reviewed-by: Ben Konyi <[email protected]>
1 parent 98b63e1 commit ce5210b

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

pkg/vm_service/lib/src/vm_service.dart

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2806,19 +2806,15 @@ class _NullLog implements Log {
28062806
}
28072807
// enums
28082808

2809-
class CodeKind {
2810-
CodeKind._();
2811-
2809+
abstract class CodeKind {
28122810
static const String kDart = 'Dart';
28132811
static const String kNative = 'Native';
28142812
static const String kStub = 'Stub';
28152813
static const String kTag = 'Tag';
28162814
static const String kCollected = 'Collected';
28172815
}
28182816

2819-
class ErrorKind {
2820-
ErrorKind._();
2821-
2817+
abstract class ErrorKind {
28222818
/// The isolate has encountered an unhandled Dart exception.
28232819
static const String kUnhandledException = 'UnhandledException';
28242820

@@ -2959,9 +2955,7 @@ abstract class EventKind {
29592955

29602956
/// Adding new values to `InstanceKind` is considered a backwards compatible
29612957
/// change. Clients should treat unrecognized instance kinds as `PlainInstance`.
2962-
class InstanceKind {
2963-
InstanceKind._();
2964-
2958+
abstract class InstanceKind {
29652959
/// A general instance of the Dart class Object.
29662960
static const String kPlainInstance = 'PlainInstance';
29672961

@@ -3067,9 +3061,7 @@ class InstanceKind {
30673061
///
30683062
/// Adding new values to `SentinelKind` is considered a backwards compatible
30693063
/// change. Clients must handle this gracefully.
3070-
class SentinelKind {
3071-
SentinelKind._();
3072-
3064+
abstract class SentinelKind {
30733065
/// Indicates that the object referred to has been collected by the GC.
30743066
static const String kCollected = 'Collected';
30753067

@@ -3090,9 +3082,7 @@ class SentinelKind {
30903082
}
30913083

30923084
/// A `FrameKind` is used to distinguish different kinds of `Frame` objects.
3093-
class FrameKind {
3094-
FrameKind._();
3095-
3085+
abstract class FrameKind {
30963086
static const String kRegular = 'Regular';
30973087
static const String kAsyncCausal = 'AsyncCausal';
30983088
static const String kAsyncSuspensionMarker = 'AsyncSuspensionMarker';
@@ -3101,9 +3091,7 @@ class FrameKind {
31013091
static const String kAsyncActivation = 'AsyncActivation';
31023092
}
31033093

3104-
class SourceReportKind {
3105-
SourceReportKind._();
3106-
3094+
abstract class SourceReportKind {
31073095
/// Used to request a code coverage information.
31083096
static const String kCoverage = 'Coverage';
31093097

@@ -3116,19 +3104,15 @@ class SourceReportKind {
31163104

31173105
/// An `ExceptionPauseMode` indicates how the isolate pauses when an exception
31183106
/// is thrown.
3119-
class ExceptionPauseMode {
3120-
ExceptionPauseMode._();
3121-
3107+
abstract class ExceptionPauseMode {
31223108
static const String kNone = 'None';
31233109
static const String kUnhandled = 'Unhandled';
31243110
static const String kAll = 'All';
31253111
}
31263112

31273113
/// A `StepOption` indicates which form of stepping is requested in a [resume]
31283114
/// RPC.
3129-
class StepOption {
3130-
StepOption._();
3131-
3115+
abstract class StepOption {
31323116
static const String kInto = 'Into';
31333117
static const String kOver = 'Over';
31343118
static const String kOverAsyncSuspension = 'OverAsyncSuspension';

pkg/vm_service/tool/dart/generate_dart.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,7 @@ class _OutstandingRequest<T> {
10371037
void _generateEventStream(DartGenerator gen) {
10381038
gen.writeln();
10391039
gen.writeDocs('An enum of available event streams.');
1040-
gen.writeln('class EventStreams {');
1041-
gen.writeln('EventStreams._();');
1040+
gen.writeln('abstract class EventStreams {');
10421041
gen.writeln();
10431042

10441043
for (var c in streamCategories) {
@@ -2026,8 +2025,7 @@ class Enum extends Member {
20262025
void generate(DartGenerator gen) {
20272026
gen.writeln();
20282027
if (docs != null) gen.writeDocs(docs!);
2029-
gen.writeStatement('class $name {');
2030-
gen.writeStatement('$name._();');
2028+
gen.writeStatement('abstract class $name {');
20312029
gen.writeln();
20322030
for (var e in enums) {
20332031
e.generate(gen);

0 commit comments

Comments
 (0)