@@ -1227,6 +1227,37 @@ FunctionNode wrapSyncYieldingFunctionNode(
1227
1227
Case <FunctionNode > functionNodeSerializer =
1228
1228
new Case .uninitialized (const FunctionNodeTagger ());
1229
1229
1230
+ class ProcedureTagger implements Tagger <Procedure > {
1231
+ const ProcedureTagger ();
1232
+
1233
+ String tag (Procedure node) {
1234
+ String prefix = node.isStatic ? "static-" : "" ;
1235
+ switch (node.kind) {
1236
+ case ProcedureKind .Method :
1237
+ return "${prefix }method" ;
1238
+ default :
1239
+ throw new UnsupportedError ("${node .kind }" );
1240
+ }
1241
+ }
1242
+ }
1243
+
1244
+ TextSerializer <Procedure > staticMethodSerializer = new Wrapped (
1245
+ unwrapStaticMethod,
1246
+ wrapStaticMethod,
1247
+ new Tuple2Serializer (nameSerializer, functionNodeSerializer));
1248
+
1249
+ Tuple2 <Name , FunctionNode > unwrapStaticMethod (Procedure procedure) {
1250
+ return new Tuple2 (procedure.name, procedure.function);
1251
+ }
1252
+
1253
+ Procedure wrapStaticMethod (Tuple2 <Name , FunctionNode > tuple) {
1254
+ return new Procedure (tuple.first, ProcedureKind .Method , tuple.second,
1255
+ isStatic: true );
1256
+ }
1257
+
1258
+ Case <Procedure > procedureSerializer =
1259
+ new Case .uninitialized (const ProcedureTagger ());
1260
+
1230
1261
void initializeSerializers () {
1231
1262
expressionSerializer.tags.addAll ([
1232
1263
"string" ,
@@ -1358,4 +1389,6 @@ void initializeSerializers() {
1358
1389
asyncStarFunctionNodeSerializer,
1359
1390
syncYieldingStarFunctionNodeSerializer,
1360
1391
]);
1392
+ procedureSerializer.tags.addAll (["static-method" ]);
1393
+ procedureSerializer.serializers.addAll ([staticMethodSerializer]);
1361
1394
}
0 commit comments