[Nice-commit] Nice/src/bossa/link Alternative.java,1.44,1.45
Brought to you by:
bonniot
From: <bo...@pr...> - 2004-02-02 12:02:49
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2710/src/bossa/link Modified Files: Alternative.java Log Message: Moved optimizations to nice.lang.inline.ShortCircuitOp so that all code benefits from them and higher-level code-generation code can be kept simple. Index: Alternative.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Alternative.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Alternative.java 26 Sep 2003 23:12:36 -0000 1.44 --- Alternative.java 2 Feb 2004 12:00:47 -0000 1.45 *************** *** 154,158 **** Util.map("",", ","",parameters)+ " for " + this); ! int index = skipFirst ? 1 : 0; --- 154,158 ---- Util.map("",", ","",parameters)+ " for " + this); ! int index = skipFirst ? 1 : 0; *************** *** 160,185 **** return QuoteExp.trueExp; - if (parameters.length == index + 1) - return patterns[index].matchTest(parameters[index]); - Expression result = QuoteExp.trueExp; - //find the first non-trivial test for(; index<parameters.length; index++) ! if (!patterns[index].atAny()) ! { ! result = patterns[index].matchTest(parameters[index]); ! index++; ! break; ! } ! ! for(; index<parameters.length; index++) ! if (!patterns[index].atAny()) ! result = Gen.shortCircuitAnd(result, ! patterns[index].matchTest(parameters[index])); ! return result; } ! public String toString() { --- 160,172 ---- return QuoteExp.trueExp; Expression result = QuoteExp.trueExp; for(; index<parameters.length; index++) ! result = Gen.shortCircuitAnd ! (result, patterns[index].matchTest(parameters[index])); ! return result; } ! public String toString() { |