SUGGESTED FIX
------- UnionGen.java -------
*** /tmp/sccs.Y8ai8o Mon Sep 29 14:53:43 2003
--- UnionGen.java Mon Sep 29 14:25:17 2003
***************
*** 736,742 ****
if (noCases) {
// There is only a default label. Since there are no cases,
// there is no need for if...else branches.
! index = readBranch (index, indent, firstBranch.typedef.name (), firstBranch.typedef, stream);
} else {
// If first branch is false, swap branches
if (!firstBranchIsTrue) {
--- 736,742 ----
if (noCases) {
// There is only a default label. Since there are no cases,
// there is no need for if...else branches.
! index = readBranch (index, indent, firstBranch.typedef.name (), "", firstBranch.typedef, stream);
} else {
// If first branch is false, swap branches
if (!firstBranchIsTrue) {
***************
*** 752,758 ****
else {
stream.println (indent + '{');
index = readBranch (index, indent + " ", firstBranch.typedef.name (),
! firstBranch.typedef, stream);
stream.println (indent + '}');
}
--- 752,758 ----
else {
stream.println (indent + '{');
index = readBranch (index, indent + " ", firstBranch.typedef.name (),
! disName, firstBranch.typedef, stream);
stream.println (indent + '}');
}
***************
*** 763,769 ****
else {
stream.println (indent + '{');
index = readBranch (index, indent + " ", secondBranch.typedef.name (),
! secondBranch.typedef, stream);
stream.println (indent + '}');
}
}
--- 763,769 ----
else {
stream.println (indent + '{');
index = readBranch (index, indent + " ", secondBranch.typedef.name (),
! disName, secondBranch.typedef, stream);
stream.println (indent + '}');
}
}
***************
*** 801,807 ****
if (!branch.typedef.equals (u.defaultBranch ())) {
index = readBranch (index, indent + " ", branch.typedef.name (),
! branch.typedef, stream);
stream.println (indent + " break;");
}
}
--- 801,807 ----
if (!branch.typedef.equals (u.defaultBranch ())) {
index = readBranch (index, indent + " ", branch.typedef.name (),
! disName, branch.typedef, stream);
stream.println (indent + " break;");
}
}
***************
*** 817,823 ****
stream.println( indent + " value._default( " + disName + " ) ;" ) ;
} else {
index = readBranch (index, indent + " ", u.defaultBranch ().name (),
! u.defaultBranch (), stream);
}
stream.println (indent + " break;");
--- 817,823 ----
stream.println( indent + " value._default( " + disName + " ) ;" ) ;
} else {
index = readBranch (index, indent + " ", u.defaultBranch ().name (),
! "", u.defaultBranch (), stream);
}
stream.println (indent + " break;");
***************
*** 828,834 ****
return index;
}
! private int readBranch (int index, String indent, String name, TypedefEntry entry, PrintWriter stream)
{
SymtabEntry type = entry.type ();
Util.writeInitializer (indent, '_' + name, "", entry, stream);
--- 828,834 ----
return index;
}
! private int readBranch (int index, String indent, String name, String disName, TypedefEntry entry, PrintWriter stream)
{
SymtabEntry type = entry.type ();
Util.writeInitializer (indent, '_' + name, "", entry, stream);
***************
*** 842,849 ****
stream.println (indent + '_' + name + " = " + Util.helperName (type, true) + ".read (istream);");
}
! stream.println (indent + "value." + name + " (_" + name + ");");
!
return index;
}
--- 842,852 ----
stream.println (indent + '_' + name + " = " + Util.helperName (type, true) + ".read (istream);");
}
! stream.print (indent + "value." + name + " (");
! if( disName == "" )
! stream.println("_" + name + ");");
! else
! stream.println(disName + ", " + "_" + name + ");");
return index;
}
###@###.### 2003-09-29
The above fix caused default setter without setting value with corresponding discriminator.
new fix URL:
http://jpsesvr.sfbay.sun.com:8080/ctetools/html/ViewDetail.jsp?index=821
###@###.### 2003-10-08
|