/** * Called by the {@link ANamedTypeDeclIR} node from {@link ANamedTypeDeclIR#apply(IAnalysis)}. * @param node the calling {@link ANamedTypeDeclIR} node */ public void caseANamedTypeDeclIR(ANamedTypeDeclIR node) throws AnalysisException { _visitedNodes.add(node); inANamedTypeDeclIR(node); if(node.getName() != null && !_visitedNodes.contains(node.getName())) { node.getName().apply(this); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } outANamedTypeDeclIR(node); }
/** * Returns a deep clone of this {@link ANamedTypeDeclIR} node. * @return a deep clone of this {@link ANamedTypeDeclIR} node */ public ANamedTypeDeclIR clone() { return new ANamedTypeDeclIR( _sourceNode, _tag, _metaData, cloneNode(_name), cloneNode(_type) ); }
/** * Sets the {@code _namedInvType} child of this {@link STypeIRBase} node. * @param value the new {@code _namedInvType} child of this {@link STypeIRBase} node */ public void setNamedInvType(ANamedTypeDeclIR value) { if (this._namedInvType != null) { this._namedInvType.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._namedInvType = value; }
/** * Creates a new tree field only constructor {@code ANamedTypeDeclIR TAG=namedType} 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 name_ the {@link ATypeNameIR} node for the {@code name} child of this {@link ANamedTypeDeclIR} node * @param type_ the {@link STypeIR} node for the {@code type} child of this {@link ANamedTypeDeclIR} node */ public ANamedTypeDeclIR(ATypeNameIR name_, STypeIR type_) { super(null,null,null); this.setName(name_); this.setType(type_); }
/** * Called by the {@link ARealBasicTypeWrappersTypeIR} node from {@link ARealBasicTypeWrappersTypeIR#apply(IAnalysis)}. * @param node the calling {@link ARealBasicTypeWrappersTypeIR} node */ public void caseARealBasicTypeWrappersTypeIR(ARealBasicTypeWrappersTypeIR node) throws AnalysisException { _visitedNodes.add(node); inARealBasicTypeWrappersTypeIR(node); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this); } outARealBasicTypeWrappersTypeIR(node); }
@Override public SDeclIR caseANamedInvariantType(ANamedInvariantType node, IRInfo question) throws AnalysisException { PType type = node.getType(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); ATypeNameIR typeName = new ATypeNameIR(); typeName.setDefiningClass(node.getName().getModule()); typeName.setName(node.getName().getName()); ANamedTypeDeclIR namedTypeDecl = new ANamedTypeDeclIR(); namedTypeDecl.setName(typeName); namedTypeDecl.setType(typeCg); return namedTypeDecl; }
/** * Essentially this.toString().equals(o.toString()). **/ @Override public boolean equals(Object o) { if (o != null && o instanceof ANamedTypeDeclIR) { return toString().equals(o.toString()); } return false; }
/** * Called by the {@link ACharBasicTypeWrappersTypeIR} node from {@link ACharBasicTypeWrappersTypeIR#apply(IAnalysis)}. * @param node the calling {@link ACharBasicTypeWrappersTypeIR} node */ public void caseACharBasicTypeWrappersTypeIR(ACharBasicTypeWrappersTypeIR node) throws AnalysisException { _visitedNodes.add(node); inACharBasicTypeWrappersTypeIR(node); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this); } outACharBasicTypeWrappersTypeIR(node); }
@Override public STypeIR caseANamedInvariantType(ANamedInvariantType node, IRInfo question) throws AnalysisException { PType type = node.getType(); STypeIR underlyingType = type.apply(question.getTypeVisitor(), question); // TODO: Morten initially requested some way of knowing whether a type originates // from a named invariant type. With the NamedInvTypeInfo being introduced, using // IR tags for this is redundant. Check if the IR tagging can be removed. underlyingType.setTag(new IRNamedTypeInvariantTag(node.getName().getName())); ATypeNameIR typeName = new ATypeNameIR(); typeName.setDefiningClass(node.getName().getModule()); typeName.setName(node.getName().getName()); ANamedTypeDeclIR typeDecl = new ANamedTypeDeclIR(); typeDecl.setName(typeName); if (underlyingType != null) { typeDecl.setType(underlyingType.clone()); } underlyingType.setNamedInvType(typeDecl); return underlyingType; }
/** * Creates a new complete constructor {@code ANamedTypeDeclIR} 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 name_ the {@link ATypeNameIR} node for the {@code name} child of this {@link ANamedTypeDeclIR} node * @param type_ the {@link STypeIR} node for the {@code type} child of this {@link ANamedTypeDeclIR} node */ public ANamedTypeDeclIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, ATypeNameIR name_, STypeIR type_) { super(sourceNode_,tag_,metaData_); this.setName(name_); this.setType(type_); }
/** * Called by the {@link ABoolBasicTypeWrappersTypeIR} node from {@link ABoolBasicTypeWrappersTypeIR#apply(IAnalysis)}. * @param node the calling {@link ABoolBasicTypeWrappersTypeIR} node */ public void caseABoolBasicTypeWrappersTypeIR(ABoolBasicTypeWrappersTypeIR node) throws AnalysisException { _visitedNodes.add(node); inABoolBasicTypeWrappersTypeIR(node); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this); } outABoolBasicTypeWrappersTypeIR(node); }
/** * Called by the {@link ANamedTypeDeclIR} node from {@link ANamedTypeDeclIR#apply(IIsaAnalysis)}. * @param node the calling {@link ANamedTypeDeclIR} node */ public void caseANamedTypeDeclIR(ANamedTypeDeclIR node) throws AnalysisException { _visitedNodes.add(node); inANamedTypeDeclIR(node); if(node.getName() != null && !_visitedNodes.contains(node.getName())) { node.getName().apply(this); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } outANamedTypeDeclIR(node); }
/** * Creates a deep clone of this {@link ANamedTypeDeclIR} 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 ANamedTypeDeclIR} node */ public ANamedTypeDeclIR clone(Map<INode,INode> oldToNewMap) { ANamedTypeDeclIR node = new ANamedTypeDeclIR( _sourceNode, _tag, _metaData, cloneNode(_name, oldToNewMap), cloneNode(_type, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
public String hackInv(ANamedTypeDeclIR type) { ATypeDeclIR tDecl = (ATypeDeclIR) type.parent(); if (tDecl.getInv() != null) { AFuncDeclIR invFunc = (AFuncDeclIR) tDecl.getInv(); StringBuilder sb = new StringBuilder(); sb.append("inv "); sb.append(invFunc.getFormalParams().get(0).getPattern().toString()); sb.append(" == "); sb.append(invFunc.getName()); sb.append("("); sb.append("&"); sb.append(invFunc.getFormalParams().get(0).getPattern().toString()); sb.append(")"); return sb.toString(); } return ""; }
/** * Called by the {@link AObjectTypeIR} node from {@link AObjectTypeIR#apply(IIsaAnalysis)}. * @param node the calling {@link AObjectTypeIR} node */ public void caseAObjectTypeIR(AObjectTypeIR node) throws AnalysisException { _visitedNodes.add(node); inAObjectTypeIR(node); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this); } outAObjectTypeIR(node); }
/** * Called by the {@link ANamedTypeDeclIR} node from {@link ANamedTypeDeclIR#apply(IAnalysis)}. * @param node the calling {@link ANamedTypeDeclIR} node */ public void caseANamedTypeDeclIR(ANamedTypeDeclIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inANamedTypeDeclIR(node, question); if(node.getName() != null && !_visitedNodes.contains(node.getName())) { node.getName().apply(this, question); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } outANamedTypeDeclIR(node, question); }
/** * Called by the {@link AUnknownTypeIR} node from {@link AUnknownTypeIR#apply(IIsaAnalysis)}. * @param node the calling {@link AUnknownTypeIR} node */ public void caseAUnknownTypeIR(AUnknownTypeIR node) throws AnalysisException { _visitedNodes.add(node); inAUnknownTypeIR(node); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this); } outAUnknownTypeIR(node); }
/** * Called by the {@link ANamedTypeDeclIR} node from {@link ANamedTypeDeclIR#apply(IAnalysis)}. * @param node the calling {@link ANamedTypeDeclIR} node */ public A caseANamedTypeDeclIR(ANamedTypeDeclIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inANamedTypeDeclIR(node)); if(node.getName() != null && !_visitedNodes.contains(node.getName())) { mergeReturns(retVal,node.getName().apply(this)); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } mergeReturns(retVal,outANamedTypeDeclIR(node)); return retVal; }