List<ATemplateTypeIR> copy = new ArrayList<ATemplateTypeIR>(node.getTemplateTypes()); for( ATemplateTypeIR e : copy) List<ATokenNameIR> copy = new ArrayList<ATokenNameIR>(node.getExtension()); for( ATokenNameIR e : copy) List<AFieldDeclIR> copy = new ArrayList<AFieldDeclIR>(node.getFields()); for( AFieldDeclIR e : copy) List<AMethodDeclIR> copy = new ArrayList<AMethodDeclIR>(node.getMethodSignatures()); for( AMethodDeclIR e : copy)
private AInterfaceDeclIR convertToInterface(SClassDeclIR c) { List<AFieldDeclIR> clonedFields = new LinkedList<>(); for (AFieldDeclIR f : c.getFields()) { clonedFields.add(f.clone()); } List<AMethodDeclIR> clonedMethods = new LinkedList<>(); for (AMethodDeclIR m : c.getMethods()) { if (!m.getIsConstructor() && !(m.getTag() instanceof IRGeneratedTag)) { clonedMethods.add(m.clone()); } } AInterfaceDeclIR inter = new AInterfaceDeclIR(); inter.setFields(clonedFields); inter.setMetaData(c.getMetaData()); inter.setMethodSignatures(clonedMethods); inter.setName(c.getName()); inter.setPackage(c.getPackage()); inter.setSourceNode(c.getSourceNode()); inter.setTag(c.getTag()); for (ATokenNameIR n : c.getSuperNames()) { inter.getExtension().add(n.clone()); } return inter; }
public String formatInterfaces(SClassDeclIR classDecl) { LinkedList<AInterfaceDeclIR> interfaces = classDecl.getInterfaces(); if (interfaces == null) { return ""; } List<String> interfaceNames = new LinkedList<>(); for(AInterfaceDeclIR i : interfaces) { interfaceNames.add(i.getName()); } return formatInterfaceNames(interfaceNames, "implements"); }
/** * Creates a new complete constructor {@code AInterfaceDeclIR} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param templateTypes_ the {@link NodeList} node for the {@code templateTypes} child of this {@link AInterfaceDeclIR} node * @param extension_ the {@link NodeList} node for the {@code extension} child of this {@link AInterfaceDeclIR} node * @param package_ the {@link String} node for the {@code package} child of this {@link AInterfaceDeclIR} node * @param name_ the {@link String} node for the {@code name} child of this {@link AInterfaceDeclIR} node * @param fields_ the {@link NodeList} node for the {@code fields} child of this {@link AInterfaceDeclIR} node * @param methodSignatures_ the {@link NodeList} node for the {@code methodSignatures} child of this {@link AInterfaceDeclIR} node */ public AInterfaceDeclIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, List<? extends ATemplateTypeIR> templateTypes_, List<? extends ATokenNameIR> extension_, String package_, String name_, List<? extends AFieldDeclIR> fields_, List<? extends AMethodDeclIR> methodSignatures_) { super(sourceNode_,tag_,metaData_); this.setTemplateTypes(templateTypes_); this.setExtension(extension_); this.setPackage(package_); this.setName(name_); this.setFields(fields_); this.setMethodSignatures(methodSignatures_); }
private AInterfaceDeclIR consInterface(AMethodTypeIR methodType, List<? extends AFormalParamLocalParamIR> params) AInterfaceDeclIR methodTypeInterface = new AInterfaceDeclIR(); methodTypeInterface.setPackage(null); methodTypeInterface.setName(transformationAssistant.getInfo().getTempVarNameGen().nextVarName(funcValPrefixes.funcInterface())); methodTypeInterface.getTemplateTypes().add(templateType.clone()); evalMethodType.getParams().add(templateType.clone()); methodTypeInterface.getMethodSignatures().add(evalMethod); methodTypeInterface.getTemplateTypes().add(templateTypeResult); evalMethodType.setResult(templateTypeResult.clone());
e.apply(this);
funcValueInterface.setPackage(getJavaSettings().getJavaRootPackage()); funcValueInterface.apply(javaFormat.getMergeVisitor(), writer); String formattedJavaCode = JavaCodeGenUtil.formatJavaCode(writer.toString()); genModules.add(new GeneratedModule(funcValueInterface.getName(), funcValueInterface, formattedJavaCode, false)); + funcValueInterface.getName() + ": " + e.getMessage()); log.error("Skipping interface.."); e.printStackTrace();
AInterfaceDeclIR interf = new AInterfaceDeclIR(); interf.setName(concPrefixes.evalPpTypeName());
classType.setName(lambdaInterface.getName()); AMethodDeclIR lambdaDecl = lambdaInterface.getMethodSignatures().get(0).clone(); lambdaDecl.setAbstract(false);
public String formatInterfaces(AInterfaceDeclIR inter) { if(inter.getExtension() == null || inter.getExtension().isEmpty()) { return ""; } List<String> interfaceNames = new LinkedList<>(); for(ATokenNameIR e : inter.getExtension()) { interfaceNames.add(e.getName()); } return formatInterfaceNames(interfaceNames, "extends"); }
public AInterfaceDeclIR findInterface(AMethodTypeIR methodType) { for (AInterfaceDeclIR functionValueInterface : funcValInterfaces) { if (1 + methodType.getParams().size() == functionValueInterface.getTemplateTypes().size()) { return functionValueInterface; } } return null; } }
AInterfaceDeclIR recInterface = new AInterfaceDeclIR(); recInterface.setPackage("org.overture.codegen.runtime"); recInterface.setName(RECORD_NAME); AExternalTypeIR recInterfaceType = new AExternalTypeIR(); recInterfaceType.setName(RECORD_NAME); copyMethod.setAbstract(true); recInterface.getMethodSignatures().add(copyMethod);
/** * Creates a new tree field only constructor {@code AInterfaceDeclIR TAG=interface} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param templateTypes_ the {@link NodeList} node for the {@code templateTypes} child of this {@link AInterfaceDeclIR} node * @param extension_ the {@link NodeList} node for the {@code extension} child of this {@link AInterfaceDeclIR} node * @param package_ the {@link String} node for the {@code package} child of this {@link AInterfaceDeclIR} node * @param name_ the {@link String} node for the {@code name} child of this {@link AInterfaceDeclIR} node * @param fields_ the {@link NodeList} node for the {@code fields} child of this {@link AInterfaceDeclIR} node * @param methodSignatures_ the {@link NodeList} node for the {@code methodSignatures} child of this {@link AInterfaceDeclIR} node */ public AInterfaceDeclIR(List<? extends ATemplateTypeIR> templateTypes_, List<? extends ATokenNameIR> extension_, String package_, String name_, List<? extends AFieldDeclIR> fields_, List<? extends AMethodDeclIR> methodSignatures_) { super(null,null,null); this.setTemplateTypes(templateTypes_); this.setExtension(extension_); this.setPackage(package_); this.setName(name_); this.setFields(fields_); this.setMethodSignatures(methodSignatures_); }
e.apply(this, question);
List<ATemplateTypeIR> copy = new ArrayList<ATemplateTypeIR>(node.getTemplateTypes()); for( ATemplateTypeIR e : copy) List<ATokenNameIR> copy = new ArrayList<ATokenNameIR>(node.getExtension()); for( ATokenNameIR e : copy) List<AFieldDeclIR> copy = new ArrayList<AFieldDeclIR>(node.getFields()); for( AFieldDeclIR e : copy) List<AMethodDeclIR> copy = new ArrayList<AMethodDeclIR>(node.getMethodSignatures()); for( AMethodDeclIR e : copy)
e.apply(this);
public String format(AMethodTypeIR methodType) throws AnalysisException { final String OBJ = "Object"; if (funcValAssist == null) { return OBJ; } AInterfaceDeclIR methodTypeInterface = funcValAssist.findInterface(methodType); if (methodTypeInterface == null) { return OBJ; // Should not happen } AInterfaceTypeIR methodClass = new AInterfaceTypeIR(); methodClass.setName(methodTypeInterface.getName()); LinkedList<STypeIR> params = methodType.getParams(); for (STypeIR param : params) { methodClass.getTypes().add(param.clone()); } methodClass.getTypes().add(methodType.getResult().clone()); return methodClass != null ? format(methodClass) : OBJ; }
List<ATemplateTypeIR> copy = new ArrayList<ATemplateTypeIR>(node.getTemplateTypes()); for( ATemplateTypeIR e : copy) List<ATokenNameIR> copy = new ArrayList<ATokenNameIR>(node.getExtension()); for( ATokenNameIR e : copy) List<AFieldDeclIR> copy = new ArrayList<AFieldDeclIR>(node.getFields()); for( AFieldDeclIR e : copy) List<AMethodDeclIR> copy = new ArrayList<AMethodDeclIR>(node.getMethodSignatures()); for( AMethodDeclIR e : copy)
e.apply(this);
List<ATemplateTypeIR> copy = new ArrayList<ATemplateTypeIR>(node.getTemplateTypes()); for( ATemplateTypeIR e : copy) List<ATokenNameIR> copy = new ArrayList<ATokenNameIR>(node.getExtension()); for( ATokenNameIR e : copy) List<AFieldDeclIR> copy = new ArrayList<AFieldDeclIR>(node.getFields()); for( AFieldDeclIR e : copy) List<AMethodDeclIR> copy = new ArrayList<AMethodDeclIR>(node.getMethodSignatures()); for( AMethodDeclIR e : copy)