Skip to content

Commit ab8eafd

Browse files
author
Dart CI
committed
Version 2.18.0-180.0.dev
Merge commit '503e7232ab5da9b5d5cacdda097d641e9f7a6062' into 'dev'
2 parents 41e17af + 503e723 commit ab8eafd

File tree

4 files changed

+823
-1074
lines changed

4 files changed

+823
-1074
lines changed

pkg/analysis_server/lib/lsp_protocol/protocol_custom_generated.dart

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,11 +1945,7 @@ class RequestMessage implements IncomingMessage, ToJsonable {
19451945
final clientRequestTimeJson = json['clientRequestTime'];
19461946
final clientRequestTime = clientRequestTimeJson as int?;
19471947
final idJson = json['id'];
1948-
final id = idJson is int
1949-
? Either2<int, String>.t1(idJson)
1950-
: (idJson is String
1951-
? Either2<int, String>.t2(idJson)
1952-
: (throw '''$idJson was not one of (int, String)'''));
1948+
final id = _eitherIntString(idJson);
19531949
final jsonrpcJson = json['jsonrpc'];
19541950
final jsonrpc = jsonrpcJson as String;
19551951
final methodJson = json['method'];
@@ -2226,13 +2222,7 @@ class ResponseMessage implements Message, ToJsonable {
22262222
? ResponseError.fromJson(errorJson as Map<String, Object?>)
22272223
: null;
22282224
final idJson = json['id'];
2229-
final id = idJson == null
2230-
? null
2231-
: (idJson is int
2232-
? Either2<int, String>.t1(idJson)
2233-
: (idJson is String
2234-
? Either2<int, String>.t2(idJson)
2235-
: (throw '''$idJson was not one of (int, String)''')));
2225+
final id = idJson == null ? null : _eitherIntString(idJson);
22362226
final jsonrpcJson = json['jsonrpc'];
22372227
final jsonrpc = jsonrpcJson as String;
22382228
final resultJson = json['result'];
@@ -2574,3 +2564,11 @@ class ValidateRefactorResult implements ToJsonable {
25742564
@override
25752565
String toString() => jsonEncoder.convert(toJson());
25762566
}
2567+
2568+
Either2<int, String> _eitherIntString(Object? value) {
2569+
return value is int
2570+
? Either2.t1(value)
2571+
: value is String
2572+
? Either2.t2(value)
2573+
: throw '$value was not one of (int, String)';
2574+
}

0 commit comments

Comments
 (0)