Beispiel #1
0
        public void processAssignment(IAssignment assignment, out bool cGenerated, out string str)
        {
            string varName = assignment.getVarName();

            if (!types.ContainsKey(varName))
            {
                throw new VariableDoesNotExistException(varName);
            }
            COOPType coopType = assignment.getCOOPObject().actualType, varType = types[varName];


            cGenerated = false;
            str        = "";
            if (coopType.Equals(varType))
            {
                cGenerated = true;
                str        = $"{varName} = {assignment.getCOOPObjectString()}";
            }
            else if (varType.isParent(coopType) && !varType.isStrictlyClass() && coopType.isStrictlyClass())
            {
                types[varName] = coopType;
                cGenerated     = true;
                str            = $"{(coopType as COOPClass).toUsableToC()} {varName} = {assignment.getCOOPObjectString()}";
            }
        }
Beispiel #2
0
        public bool couldExecuteOn(List <COOPObject> objects)
        {
            for (var i = 0; i < objects.Count; i++)
            {
                COOPType coopType = parameters[i].type;
                if (!coopType.isParent(objects[i].actualType))
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #3
0
        public bool couldDirectlyExecuteOn(List <COOPObject> objects)
        {
            bool allClasses = true;

            for (var i = 0; i < objects.Count; i++)
            {
                COOPType coopType = parameters[i].type;
                if (!coopType.isParent(objects[i].actualType))
                {
                    return(false);
                }
                if (!coopType.isStrictlyClass())
                {
                    allClasses = false;
                }
            }

            return(allClasses);
        }