File tree Expand file tree Collapse file tree
liquidjava-verifier/src/main/java/liquidjava/rj_language/opt/derivation_node Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package liquidjava .rj_language .opt .derivation_node ;
22
3+ import java .lang .reflect .Type ;
4+
5+ import com .google .gson .JsonElement ;
6+ import com .google .gson .JsonPrimitive ;
7+ import com .google .gson .JsonSerializationContext ;
8+ import com .google .gson .JsonSerializer ;
9+ import com .google .gson .annotations .JsonAdapter ;
10+
11+ import liquidjava .rj_language .ast .formatter .VariableFormatter ;
12+
313public class VarDerivationNode extends DerivationNode {
414
15+ @ JsonAdapter (VariableSerializer .class )
516 private final String var ;
617 private final DerivationNode origin ;
718
@@ -22,4 +33,11 @@ public String getVar() {
2233 public DerivationNode getOrigin () {
2334 return origin ;
2435 }
36+
37+ private static class VariableSerializer implements JsonSerializer <String > {
38+ @ Override
39+ public JsonElement serialize (String var , Type typeOfSrc , JsonSerializationContext context ) {
40+ return new JsonPrimitive (VariableFormatter .format (var ));
41+ }
42+ }
2543}
You can’t perform that action at this time.
0 commit comments