public static ATypeImport newATypeImport(ILexNameToken defname, ILexNameToken renamed) { ATypeImport result = new ATypeImport(); result.setLocation(defname.getLocation()); result.setName(defname); result.setRenamed(renamed); result.setDef(null); return result; }
/** * Returns a deep clone of this {@link ATypeImport} node. * @return a deep clone of this {@link ATypeImport} node */ public ATypeImport clone() { return new ATypeImport( _location, cloneNode(_name), cloneNode(_renamed), _from, cloneNode(_def) ); }
/** * Called by the {@link ATypeImport} node from {@link ATypeImport#apply(IPOFAnalysis)}. * @param node the calling {@link ATypeImport} node */ public void caseATypeImport(ATypeImport node) throws AnalysisException { _visitedNodes.add(node); inATypeImport(node); if(node.getName() != null ) { node.getName().apply(this); } if(node.getRenamed() != null ) { node.getRenamed().apply(this); } if(node.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { node.getFrom().apply(this); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { node.getDef().apply(this); } outATypeImport(node); }
@Override public List<PDefinition> caseATypeImport(ATypeImport imp, AModuleModules module) throws AnalysisException { List<PDefinition> list = new Vector<PDefinition>(); imp.setFrom(module); PDefinition expdef = af.createPDefinitionListAssistant().findType(imp.getFrom().getExportdefs(), imp.getName(), null); if (expdef == null) { TypeCheckerErrors.report(3191, "No export declared for import of type " + imp.getName() + " from " + imp.getFrom().getName(), imp.getLocation(), imp); } else { if (imp.getRenamed() != null) { expdef = AstFactory.newARenamedDefinition(imp.getRenamed(), expdef); } else { expdef = AstFactory.newAImportedDefinition(imp.getName().getLocation(), expdef); } list.add(expdef); } return list; }
if (node.getFrom() != null) expdef = question.assistantFactory.createPDefinitionListAssistant().findType(node.getFrom().getExportdefs(), node.getName(), null); if (node.getDef() != null && node.getFrom() != null) PDefinition def = node.getDef(); ILexNameToken name = node.getName(); AModuleModules from = node.getFrom(); def.setType((SInvariantType) question.assistantFactory.createPTypeAssistant().typeResolve(question.assistantFactory.createPDefinitionAssistant().getType(def), null, THIS, question)); + " does not match export from " + from.getName(), node.getLocation(), node); TypeCheckerErrors.detail2("Import", def.getType().toString() // TODO: .toDetailedString() , "Export", exptype.toString()); // TODO:
@Override public SImportIR caseATypeImport(ATypeImport node, IRInfo question) throws AnalysisException { ATypeImportIR typeImportCg = new ATypeImportIR(); initImport(node, typeImportCg); SDeclIR typeDeclCg = node.getDef() != null ? node.getDef().apply(question.getDeclVisitor(), question) : null; if (typeDeclCg instanceof ATypeDeclIR) { typeImportCg.setDecl((ATypeDeclIR) typeDeclCg); } return typeImportCg; }
/** * Called by the {@link ATypeImport} node from {@link ATypeImport#apply(IAnalysis)}. * @param node the calling {@link ATypeImport} node */ public void caseATypeImport(ATypeImport node, Q question) throws AnalysisException { _visitedNodes.add(node); inATypeImport(node, question); if(node.getName() != null ) { node.getName().apply(this, question); } if(node.getRenamed() != null ) { node.getRenamed().apply(this, question); } if(node.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { node.getFrom().apply(this, question); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { node.getDef().apply(this, question); } outATypeImport(node, question); }
/** * Called by the {@link ATypeImport} node from {@link ATypeImport#apply(IAnalysis)}. * @param node the calling {@link ATypeImport} node */ public void caseATypeImport(ATypeImport node) throws AnalysisException { _visitedNodes.add(node); inATypeImport(node); if(node.getName() != null ) { node.getName().apply(this); } if(node.getRenamed() != null ) { node.getRenamed().apply(this); } if(node.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { node.getFrom().apply(this); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { node.getDef().apply(this); } outATypeImport(node); }
public static ATypeImport newATypeImport(ATypeDefinition def, ILexNameToken renamed) { ATypeImport result = new ATypeImport(); result.setLocation(def.getName().getLocation()); result.setName(def.getName()); result.setRenamed(renamed); result.setDef(def); return result; }
/** * Creates a deep clone of this {@link ATypeImport} 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 ATypeImport} node */ public ATypeImport clone(Map<INode,INode> oldToNewMap) { ATypeImport node = new ATypeImport( _location, cloneNode(_name, oldToNewMap), cloneNode(_renamed, oldToNewMap), _from, cloneNode(_def, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link ATypeImport} node from {@link ATypeImport#apply(IAnalysis)}. * @param node the calling {@link ATypeImport} node */ public A caseATypeImport(ATypeImport node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inATypeImport(node, question)); if(node.getName() != null ) { mergeReturns(retVal,node.getName().apply(this, question)); } if(node.getRenamed() != null ) { mergeReturns(retVal,node.getRenamed().apply(this, question)); } if(node.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { mergeReturns(retVal,node.getFrom().apply(this, question)); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { mergeReturns(retVal,node.getDef().apply(this, question)); } mergeReturns(retVal,outATypeImport(node, question)); return retVal; }
/** * Called by the {@link ATypeImport} node from {@link ATypeImport#apply(IAnalysis)}. * @param node the calling {@link ATypeImport} node */ public A caseATypeImport(ATypeImport node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inATypeImport(node)); if(node.getName() != null ) { mergeReturns(retVal,node.getName().apply(this)); } if(node.getRenamed() != null ) { mergeReturns(retVal,node.getRenamed().apply(this)); } if(node.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { mergeReturns(retVal,node.getFrom().apply(this)); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { mergeReturns(retVal,node.getDef().apply(this)); } mergeReturns(retVal,outATypeImport(node)); return retVal; }