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()}"; } }
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); }
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}"; } }