/** * Returns a deep clone of this {@link AApplyObjectDesignatorIR} node. * @return a deep clone of this {@link AApplyObjectDesignatorIR} node */ public AApplyObjectDesignatorIR clone() { return new AApplyObjectDesignatorIR( _sourceNode, _tag, _metaData, cloneNode(_object), cloneList(_args) ); }
/** * Creates a new complete constructor {@code AApplyObjectDesignatorIR} 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 object_ the {@link SObjectDesignatorIR} node for the {@code object} child of this {@link AApplyObjectDesignatorIR} node * @param args_ the {@link NodeList} node for the {@code args} child of this {@link AApplyObjectDesignatorIR} node */ public AApplyObjectDesignatorIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, SObjectDesignatorIR object_, List<? extends SExpIR> args_) { super(sourceNode_,tag_,metaData_); this.setObject(object_); this.setArgs(args_); }
/** * Essentially this.toString().equals(o.toString()). **/ @Override public boolean equals(Object o) { if (o != null && o instanceof AApplyObjectDesignatorIR) { return toString().equals(o.toString()); } return false; }
/** * Called by the {@link AApplyObjectDesignatorIR} node from {@link AApplyObjectDesignatorIR#apply(IAnalysis)}. * @param node the calling {@link AApplyObjectDesignatorIR} node */ public void caseAApplyObjectDesignatorIR(AApplyObjectDesignatorIR node) throws AnalysisException { _visitedNodes.add(node); inAApplyObjectDesignatorIR(node); if(node.getObject() != null && !_visitedNodes.contains(node.getObject())) { node.getObject().apply(this); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getArgs()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAApplyObjectDesignatorIR(node); }
@Override public SObjectDesignatorIR caseAApplyObjectDesignator( AApplyObjectDesignator node, IRInfo question) throws AnalysisException { PObjectDesignator obj = node.getObject(); SObjectDesignatorIR objCg = obj.apply(question.getObjectDesignatorVisitor(), question); AApplyObjectDesignatorIR applyObjDesignator = new AApplyObjectDesignatorIR(); applyObjDesignator.setObject(objCg); LinkedList<SExpIR> newExpArgs = applyObjDesignator.getArgs(); for (PExp arg : node.getArgs()) { SExpIR argCg = arg.apply(question.getExpVisitor(), question); if (argCg != null) { newExpArgs.add(argCg); } else { return null; } } return applyObjDesignator; }
@SuppressWarnings("unchecked") @Override public SExpIR caseAApplyObjectDesignatorIR(AApplyObjectDesignatorIR node) throws AnalysisException { SObjectDesignatorIR object = node.getObject(); SourceNode sourceNode = node.getSourceNode(); LinkedList<SExpIR> args = node.getArgs(); SExpIR root = object.apply(this); STypeIR rootType = root.getType(); STypeIR applyType = null; if (rootType instanceof SSeqTypeIR) { applyType = ((SSeqTypeIR) rootType).getSeqOf(); } else if (rootType instanceof SMapTypeIR) { applyType = ((SMapTypeIR) rootType).getTo(); } else if (rootType instanceof AMethodTypeIR) { applyType = ((AMethodTypeIR) rootType).getResult(); } applyType = applyType.clone(); AApplyExpIR applyExp = new AApplyExpIR(); applyExp.setArgs((List<? extends SExpIR>) args.clone()); applyExp.setRoot(root); applyExp.setType(applyType); applyExp.setSourceNode(sourceNode); return applyExp; }
public STypeIR getFieldExpType(IRInfo info, String fieldName, String fieldModule, SObjectDesignatorIR obj, INode parent) throws AnalysisException, org.overture.codegen.ir.analysis.AnalysisException { if (parent instanceof AApplyObjectDesignatorIR) { AApplyObjectDesignatorIR apply = (AApplyObjectDesignatorIR) parent; LinkedList<SExpIR> args = apply.getArgs(); if (fieldModule != null) { // It is a class SClassDeclIR clazz = info.getDeclAssistant().findClass(info.getClasses(), fieldModule); AFieldDeclIR field = info.getDeclAssistant().getFieldDecl(clazz, fieldModule); if (field != null) { return field.getType().clone(); } else { // It must be a method return info.getTypeAssistant().getMethodType(info, fieldModule, fieldName, args); } } } return getFieldType(info, fieldName, fieldModule, obj); }
/** * Called by the {@link AApplyObjectDesignatorIR} node from {@link AApplyObjectDesignatorIR#apply(IAnalysis)}. * @param node the calling {@link AApplyObjectDesignatorIR} node */ public void caseAApplyObjectDesignatorIR(AApplyObjectDesignatorIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inAApplyObjectDesignatorIR(node, question); if(node.getObject() != null && !_visitedNodes.contains(node.getObject())) { node.getObject().apply(this, question); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getArgs()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } outAApplyObjectDesignatorIR(node, question); }
/** * Called by the {@link AApplyObjectDesignatorIR} node from {@link AApplyObjectDesignatorIR#apply(IIsaAnalysis)}. * @param node the calling {@link AApplyObjectDesignatorIR} node */ public void caseAApplyObjectDesignatorIR(AApplyObjectDesignatorIR node) throws AnalysisException { _visitedNodes.add(node); inAApplyObjectDesignatorIR(node); if(node.getObject() != null && !_visitedNodes.contains(node.getObject())) { node.getObject().apply(this); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getArgs()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAApplyObjectDesignatorIR(node); }
/** * Creates a deep clone of this {@link AApplyObjectDesignatorIR} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link AApplyObjectDesignatorIR} node */ public AApplyObjectDesignatorIR clone(Map<INode,INode> oldToNewMap) { AApplyObjectDesignatorIR node = new AApplyObjectDesignatorIR( _sourceNode, _tag, _metaData, cloneNode(_object, oldToNewMap), cloneList(_args, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Creates a new tree field only constructor {@code AApplyObjectDesignatorIR TAG=apply} 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 object_ the {@link SObjectDesignatorIR} node for the {@code object} child of this {@link AApplyObjectDesignatorIR} node * @param args_ the {@link NodeList} node for the {@code args} child of this {@link AApplyObjectDesignatorIR} node */ public AApplyObjectDesignatorIR(SObjectDesignatorIR object_, List<? extends SExpIR> args_) { super(null,null,null); this.setObject(object_); this.setArgs(args_); }
/** * Called by the {@link AApplyObjectDesignatorIR} node from {@link AApplyObjectDesignatorIR#apply(IAnalysis)}. * @param node the calling {@link AApplyObjectDesignatorIR} node */ public A caseAApplyObjectDesignatorIR(AApplyObjectDesignatorIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAApplyObjectDesignatorIR(node)); if(node.getObject() != null && !_visitedNodes.contains(node.getObject())) { mergeReturns(retVal,node.getObject().apply(this)); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getArgs()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } mergeReturns(retVal,outAApplyObjectDesignatorIR(node)); return retVal; }
/** * Called by the {@link AApplyObjectDesignatorIR} node from {@link AApplyObjectDesignatorIR#apply(IAnalysis)}. * @param node the calling {@link AApplyObjectDesignatorIR} node */ public A caseAApplyObjectDesignatorIR(AApplyObjectDesignatorIR node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAApplyObjectDesignatorIR(node, question)); if(node.getObject() != null && !_visitedNodes.contains(node.getObject())) { mergeReturns(retVal,node.getObject().apply(this, question)); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getArgs()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } mergeReturns(retVal,outAApplyObjectDesignatorIR(node, question)); return retVal; }