Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv12309/F:/nice/src/bossa/syntax
Modified Files:
EnumDefinition.java
Log Message:
Serialization works now for enums and added a family method to enums.
Index: EnumDefinition.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/EnumDefinition.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** EnumDefinition.java 31 Jul 2003 18:45:35 -0000 1.5
--- EnumDefinition.java 27 Nov 2003 23:37:08 -0000 1.6
***************
*** 26,30 ****
public class EnumDefinition extends Definition
{
! public EnumDefinition(LocatedString name, List/*LocatedString*/ elements)
{
super(name, Node.global);
--- 26,30 ----
public class EnumDefinition extends Definition
{
! public EnumDefinition(LocatedString name, List/*LocatedString*/ elements, List globalDefs)
{
super(name, Node.global);
***************
*** 37,40 ****
--- 37,55 ----
impl.setFields(null);
impl.setOverrides(null);
+
+ if (! inInterfaceFile())
+ {
+ // create the method implementation of family()
+ List exps = new LinkedList();
+ for (Iterator it = elements.iterator(); it.hasNext(); )
+ exps.add(new IdentExp((LocatedString)it.next()));
+
+ Statement body = new ReturnStmt(new LiteralArrayExp(exps), true);
+ LocatedString mName = new LocatedString("family", bossa.util.Location.nowhere());
+ Definition mBodyDef = new MethodBodyDefinition(impl, mName, null,
+ new LinkedList(), body);
+ globalDefs.add(mBodyDef);
+ }
+
classDef.setImplementation(impl);
***************
*** 53,57 ****
}
addChildren(symbols);
!
}
--- 68,72 ----
}
addChildren(symbols);
!
}
|