Esempio n. 1
0
    def visit_binaryoperator(self, binaryOperator: BinaryOperator):
        from ADT.Visitors.RetrieveVariablesFromConditionVisitor import RetrieveVariablesFromConditionVisitor
        variablesUsedInCondition = RetrieveVariablesFromConditionVisitor(
            enviromentWalkerContext())
        if self.isInModifyingVariableState:
            binaryOperator.leftOperand.accept(variablesUsedInCondition)
            self.context.dataDependencies[
                self.lastAssignedVariable.
                variableName] += variablesUsedInCondition.currentArguments
            self.context.dataDependencies[
                self.lastAssignedVariable.variableName] = list(
                    set(self.context.dataDependencies[
                        self.lastAssignedVariable.variableName]))

            variablesUsedInCondition.reset()
            binaryOperator.rightOperand.accept(variablesUsedInCondition)
            self.context.dataDependencies[
                self.lastAssignedVariable.
                variableName] += variablesUsedInCondition.currentArguments
            self.context.dataDependencies[
                self.lastAssignedVariable.variableName] = list(
                    set(self.context.dataDependencies[
                        self.lastAssignedVariable.variableName]))
        binaryOperator.leftOperand.accept(self)
        binaryOperator.rightOperand.accept(self)
Esempio n. 2
0
 def return_vector(self, visitor):
     listOfChildVectors = [
         self.condition.accept(visitor),
         self.nodeBlock.accept(visitor)
     ]
     numOfTimes = int(round(sqrt(len(listOfChildVectors)))) + 1
     for x in range(numOfTimes):
         toBeAppended = deepcopy(listOfChildVectors)
         listOfChildVectors = listOfChildVectors + toBeAppended
     from ADT.Visitors.AssigmentComplexityVisitor import AssigmentComplexityVisitor
     visitorComplexity = AssigmentComplexityVisitor(
         enviromentWalkerContext())
     from ADT.Visitors.RetrieveVariablesFromConditionVisitor import RetrieveVariablesFromConditionVisitor
     variablesUsedInCondition = RetrieveVariablesFromConditionVisitor(
         enviromentWalkerContext())
     self.condition.accept(visitorComplexity)
     self.condition.accept(variablesUsedInCondition)
     visitor.currentArgumentVectorDependency = variablesUsedInCondition.currentArguments  # TODO: CONSIDER LOOPS WITHOUT VARIABLES
     listOfChildVectors += self.condition.accept(visitor)
     numOfTimes = int(visitorComplexity.complexityOfCurrExpression**
                      NUM_COPY_SUBLIST) + 1
     for x in range(numOfTimes):
         toBeAppended = deepcopy(listOfChildVectors)
         listOfChildVectors = listOfChildVectors + toBeAppended
     return listOfChildVectors
Esempio n. 3
0
 def return_vector(self, visitor):
     lists = []
     from ADT.Visitors.AssigmentComplexityVisitor import AssigmentComplexityVisitor
     visitorComplexity = AssigmentComplexityVisitor(enviromentWalkerContext())
     from ADT.Visitors.RetrieveVariablesFromConditionVisitor import RetrieveVariablesFromConditionVisitor
     variablesUsedInCondition = RetrieveVariablesFromConditionVisitor(enviromentWalkerContext())
     self.value.accept(visitorComplexity)
     if isinstance(self.variable, VariableNode):
         self.value.accept(variablesUsedInCondition)
         visitor.currentArgumentVectorDependency = variablesUsedInCondition.currentArguments + [self.variable.variableName]
         lists += self.make_vector(visitor)
         lists += self.value.accept(visitor)
         numOfTimes = int(visitorComplexity.complexityOfCurrExpression ** NUM_COPY_SUBLIST) + 1
         for x in range(numOfTimes):
             toBeAppended = deepcopy(lists)
             lists = lists + toBeAppended
     return lists