Exemple #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()}";
            }
        }
Exemple #2
0
        public bool add(COOPType type)
        {
            if (type is COOPAbstract)
            {
                return(add(type as COOPAbstract));
            }

            return(false);
        }
Exemple #3
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);
        }
Exemple #4
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);
        }
Exemple #5
0
        public void processDeclaration(IDeclaration declaration, out bool cGenerated, out string str)
        {
            string varName = declaration.getVarName();

            if (types.ContainsKey(varName))
            {
                throw new VariableAlreadyDeclaredException(varName);
            }
            COOPType coopType = declaration.getVarType();

            types.Add(varName, coopType);

            cGenerated = false;
            str        = "";
            if (coopType.isStrictlyClass())
            {
                cGenerated = true;
                str        = $"{(coopType as COOPClass)?.toUsableToC()} {varName}";
            }
        }
Exemple #6
0
        /*public bool contains(COOPInterface @interface) {
         *      if (@interface == null) return false;
         *      return interfaceNodes.ContainsKey(@interface);
         * }*/

        public bool contains(COOPType type)
        {
            return(contains(type as COOPAbstract));
        }
Exemple #7
0
 public bool addClass(COOPType coopClass)
 {
     return(hierarchy.add(coopClass));
 }
 public VarDeclaration(Ownership <COOPFunction> ownership, COOPType type, string name) : base(ownership)
 {
     this.type = type;
     this.name = name;
 }
 public COOPObject(COOPType type, COOPClass actualType)
 {
     this.type       = type;
     this.actualType = actualType;
 }
Exemple #10
0
 public VarDefinition(COOPType type, string name)
 {
     this.type = type;
     this.name = name;
 }
 public InstanceParameterDeclaration(COOPType type, string name)
 {
     this.type = type;
     this.name = name;
 }