File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
lsif-semanticdb/src/main/java/com/sourcegraph/lsif_semanticdb
semanticdb-java/src/main/protobuf Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -472,7 +472,9 @@ private String formatTree(Tree tree) {
472472 }
473473
474474 private String formatConstant (Constant constant ) {
475- if (constant .hasBooleanConstant ()) {
475+ if (constant .hasUnitConstant ()) {
476+ return isScala ? "()" : "scala.Unit()" ;
477+ } else if (constant .hasBooleanConstant ()) {
476478 return Boolean .toString (constant .getBooleanConstant ().getValue ());
477479 } else if (constant .hasByteConstant ()) {
478480 return Integer .toString (constant .getByteConstant ().getValue ());
@@ -490,6 +492,8 @@ private String formatConstant(Constant constant) {
490492 return Double .toString (constant .getDoubleConstant ().getValue ());
491493 } else if (constant .hasStringConstant ()) {
492494 return '"' + constant .getStringConstant ().getValue () + '"' ;
495+ } else if (constant .hasNullConstant ()) {
496+ return "null" ;
493497 }
494498 throw new IllegalArgumentException ("constant was not of known type " + constant );
495499 }
Original file line number Diff line number Diff line change @@ -346,6 +346,7 @@ enum BinaryOperator {
346346
347347message Constant {
348348 oneof sealed_value {
349+ UnitConstant unit_constant = 1 ;
349350 BooleanConstant boolean_constant = 2 ;
350351 ByteConstant byte_constant = 3 ;
351352 ShortConstant short_constant = 4 ;
@@ -355,9 +356,13 @@ message Constant {
355356 FloatConstant float_constant = 8 ;
356357 DoubleConstant double_constant = 9 ;
357358 StringConstant string_constant = 10 ;
359+ NullConstant null_constant = 11 ;
358360 }
359361}
360362
363+ message UnitConstant {
364+ }
365+
361366message BooleanConstant {
362367 bool value = 1 ;
363368}
@@ -392,4 +397,7 @@ message DoubleConstant {
392397
393398message StringConstant {
394399 string value = 1 ;
395- }
400+ }
401+
402+ message NullConstant {
403+ }
You can’t perform that action at this time.
0 commit comments