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 add(COOPType type) { if (type is COOPAbstract) { return(add(type as COOPAbstract)); } return(false); }
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); }
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}"; } }
/*public bool contains(COOPInterface @interface) { * if (@interface == null) return false; * return interfaceNodes.ContainsKey(@interface); * }*/ public bool contains(COOPType type) { return(contains(type as COOPAbstract)); }
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; }
public VarDefinition(COOPType type, string name) { this.type = type; this.name = name; }
public InstanceParameterDeclaration(COOPType type, string name) { this.type = type; this.name = name; }