@Override public String caseATypeDefinition(ATypeDefinition node, PrettyPrinterEnv question) throws AnalysisException { StringBuilder sb = new StringBuilder(question.getIdent()); sb.append(node.getAccess().getAccess() + " "); sb.append(node.getName()); if (node.getType() instanceof ARecordInvariantType) { ARecordInvariantType record = (ARecordInvariantType) node.getType(); sb.append(" :: "); for (Iterator<AFieldField> itr = record.getFields().iterator(); itr.hasNext();) { if (itr.hasNext()) { sb.append("\n" + question.getIdent()); } sb.append(itr.next().apply(this, question)); } } else { sb.append(" = " + node.getType().apply(typePrinter, question)); } // + (node.getType() instanceof ARecordInvariantType ? " :: " // : " = ") + node.getType().apply(typePrinter, question)); return sb.toString() + ";"; }
@Override public LexNameSet caseATypeDefinition(ATypeDefinition node, FreeVarInfo info) throws AnalysisException { LexNameSet names = new LexNameSet(); if (node.getType() instanceof ANamedInvariantType) { ANamedInvariantType nt = (ANamedInvariantType)node.getType(); names.addAll(nt.getType().apply(this, info)); } if (node.getInvdef() != null) { names.addAll(node.getInvdef().apply(this, info)); } return names; }
/** * Create the context (forall x,y,z...) for a Proof Obligation for * eq and ord relations. */ protected AForAllExp makeRelContext(ATypeDefinition node, AVariableExp... exps){ AForAllExp forall_exp = new AForAllExp(); forall_exp.setType(new ABooleanBasicType()); ATypeMultipleBind tmb = new ATypeMultipleBind(); List<PPattern> pats = new LinkedList<>(); for (AVariableExp exp : exps) { pats.add(AstFactory.newAIdentifierPattern(exp.getName().clone())); } tmb.setPlist(pats); tmb.setType(node.getType().clone()); List<PMultipleBind> binds = new LinkedList<>(); binds.add(tmb); forall_exp.setBindList(binds); return forall_exp; }
PType type = typeDef.getType();
if(typeDef.getType() instanceof ARecordInvariantType)
@Override public SDeclIR caseATypeDefinition(ATypeDefinition node, IRInfo question) throws AnalysisException { String access = node.getAccess().getAccess().toString(); PType type = node.getType(); SDeclIR declCg = type.apply(question.getDeclVisitor(), question); SDeclIR invCg = question.getSettings().generateInvariants() && node.getInvdef() != null ? node.getInvdef().apply(question.getDeclVisitor(), question) : null; ATypeDeclIR typeDecl = new ATypeDeclIR(); typeDecl.setAccess(access); typeDecl.setDecl(declCg); typeDecl.setInv(invCg); return typeDecl; }
return node.getType();
if (typeDef instanceof ATypeDefinition) rec = ((ATypeDefinition) typeDef).getType(); } else if (typeDef instanceof AStateDefinition)