Beispiel #1
0
        public static void insertReturnExpectation(CodeLine currentLine, int lineNumber, Logic targetLogic)
        {
            if (currentLine.returnCalculations == null)
            {
                currentLine.returnCalculations = (Logic[])currentLine.logicOrder.Clone();
            }

            Logic[] tempOrder = (Logic[])currentLine.getLatestOrder();

            searchInLogicOrderExpect(tempOrder, lineNumber, targetLogic);
        }
Beispiel #2
0
        private static bool insertReturnValueIntoPackageExpect(Package thePackage, int lineNumber, Logic targetLogic)
        {
            if (thePackage.returnCalculations == null)
            {
                thePackage.returnCalculations = (Logic[])thePackage.logicOrder.Clone();
            }

            Logic[] tempOrder = thePackage.getLatestOrder();
            return(searchInLogicOrderExpect(tempOrder, lineNumber, targetLogic));
        }
Beispiel #3
0
        private static bool insertReturnValueIntoFuncCallExpect(FunctionCall theFuncCall, int lineNumber, Logic targetLogic)
        {
            if (theFuncCall.returnCalculations == null)
            {
                return(false);
            }


            foreach (Logic[] l in theFuncCall.returnCalculations)
            {
                if (searchInLogicOrderExpect(l, lineNumber, targetLogic))
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #4
0
        private static bool searchInLogicOrderExpect(Logic[] logicOrder, int lineNumber, Logic targetLogic)
        {
            for (int i = 0; i < logicOrder.Length; i++)
            {
                if (logicOrder [i] == targetLogic)
                {
                    logicOrder [i] = new ReturnValue();

                    return(true);
                }
                else if (logicOrder [i].currentType == WordTypes.package)
                {
                    if (insertReturnValueIntoPackageExpect(logicOrder[i] as Package, lineNumber, targetLogic))
                    {
                        return(true);
                    }
                }
                else if (logicOrder [i].currentType == WordTypes.functionCall)
                {
                    if (insertReturnValueIntoFuncCallExpect(logicOrder[i] as FunctionCall, lineNumber, targetLogic))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }