[Nice-commit] Nice/src/bossa/link Dispatch.java,1.69,1.70
Brought to you by:
bonniot
From: Arjan B. <ar...@us...> - 2004-08-05 19:01:29
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv389/F:/nice/src/bossa/link Modified Files: Dispatch.java Log Message: Don't use special tc's for testing boolean patterns. Index: Dispatch.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Dispatch.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** Dispatch.java 3 Aug 2004 10:16:14 -0000 1.69 --- Dispatch.java 5 Aug 2004 19:01:19 -0000 1.70 *************** *** 450,455 **** List res = mlsub.typing.Enumeration.enumerate(cst, types, used); ! res = mergeNullCases(res, domains.length); ! return enumerateBooleans(res, domains.length); } --- 450,454 ---- List res = mlsub.typing.Enumeration.enumerate(cst, types, used); ! return mergeNullCases(res, domains.length); } *************** *** 527,560 **** } - /** Expand the 'boolean' case into 'true' and 'false'. - */ - private static List enumerateBooleans(List tags, int length) - { - if (tags.size() < 1) return tags; - - List res; - for (int pos = 0; pos < length; pos++) - { - res = new ArrayList(); - for (Iterator i = tags.iterator(); i.hasNext(); ) - { - TypeConstructor[] tc = (TypeConstructor[]) i.next(); - if (tc[pos] == PrimitiveType.boolTC) - { - // Create two copies of this case, one for true and one for false. - TypeConstructor[] tc2 = new TypeConstructor[tc.length]; - System.arraycopy(tc, 0, tc2, 0, tc.length); - tc[pos] = PrimitiveType.trueBoolTC; - res.add(tc); - tc2[pos] = PrimitiveType.falseBoolTC; - res.add(tc2); - } - else res.add(tc); - } - tags = res; - } - return tags; - } - /** Generate all combinations of non boolean values from the alternatives * @return List<ConstantExp> --- 526,529 ---- *************** *** 571,583 **** { Pattern pat = ((Alternative)i.next()).getPatterns()[pos]; ! if (pat.atNonBoolValue()) { isValue[pos] = true; ! if (pat.atEnum()) ! for (Iterator it = pat.getEnumValues().iterator(); it.hasNext(); ) ! valuesAtPos.add(it.next()); ! else ! valuesAtPos.add(pat.atValue); } } --- 540,554 ---- { Pattern pat = ((Alternative)i.next()).getPatterns()[pos]; ! if (pat.atEnumerableValue()) { isValue[pos] = true; ! for (Iterator it = pat.getEnumValues().iterator(); it.hasNext(); ) ! valuesAtPos.add(it.next()); ! } ! else if (pat.atSimpleValue()) ! { ! isValue[pos] = true; ! valuesAtPos.add(pat.atValue); } } |