From 5cf18cc790d43996bfd0dc6c057c9d27a8f09ec7 Mon Sep 17 00:00:00 2001 From: Nick Battle Date: Mon, 27 Nov 2023 14:57:12 +0000 Subject: [PATCH] Correct empty maps in ExplicitValueVisitor --- .../vdmj/values/visitors/ExplicitValueVisitor.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vdmj/src/main/java/com/fujitsu/vdmj/values/visitors/ExplicitValueVisitor.java b/vdmj/src/main/java/com/fujitsu/vdmj/values/visitors/ExplicitValueVisitor.java index fffee4403..2690dd626 100644 --- a/vdmj/src/main/java/com/fujitsu/vdmj/values/visitors/ExplicitValueVisitor.java +++ b/vdmj/src/main/java/com/fujitsu/vdmj/values/visitors/ExplicitValueVisitor.java @@ -35,8 +35,8 @@ import com.fujitsu.vdmj.values.Value; /** - * This visitor produces a toString of a value, with any named types expanded - * to be explicit if they are not within the current module. + * This visitor produces a toString of a value, with any record values expanded + * to be explicit (like mk_A`R) if they are not within the "from" module. */ public class ExplicitValueVisitor extends ValueVisitor { @@ -48,6 +48,11 @@ public String caseValue(Value node, LexLocation arg) public String caseMapValue(MapValue node, LexLocation from) { + if (node.values.isEmpty()) + { + return "{|->}"; + } + StringBuilder sb = new StringBuilder(); sb.append("{"); String prefix = "";