/** * 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_); }
/** * 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_); }
@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; }
@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; }