protected void stateInPre(List<PExp> args, PDefinition stateDefinition) { AVariableExp varExp; if (stateDefinition instanceof AStateDefinition) { varExp = getVarExp(OLD_STATE_ARG,stateDefinition.clone()); varExp.setType(((AStateDefinition) stateDefinition).getRecordType().clone()); } else { varExp = getVarExp(OLD_SELF_ARG,stateDefinition.clone()); varExp.setType(stateDefinition.getType().clone()); } args.add(varExp); }
protected void stateInPost(List<PMultipleBind> exists_binds, List<PExp> postArglist, PDefinition stateDefinition) { AVariableExp varExp; // replace with super call if (stateDefinition instanceof AStateDefinition) { varExp = getVarExp(NEW_STATE_ARG,stateDefinition.clone()); AStateDefinition aStateDefinition = (AStateDefinition) stateDefinition; varExp.setType(aStateDefinition.getRecordType().clone()); exists_binds.addAll(getMultipleTypeBindList(aStateDefinition.getRecordType().clone(), NEW_STATE_ARG)); } else { varExp = getVarExp(NEW_SELF_ARG,stateDefinition.clone()); varExp.setType(stateDefinition.getType().clone()); exists_binds.addAll(getMultipleTypeBindList(stateDefinition.getType().clone(), NEW_SELF_ARG)); } postArglist.add(varExp); }
/** * Generate AVariableExp with corresponding definition */ protected AVariableExp getVarExp(ILexNameToken name, PDefinition vardef) { AVariableExp var = new AVariableExp(); var.setName(name.clone()); var.setOriginal(name.getFullName()); var.setVardef(vardef.clone()); return var; } /**
node.setTypedef(typedef.clone());
PDefinition copy = d.clone(); copy.setNameScope(NameScope.LOCAL); qualified.add(copy);
AVariableExp varExp = getVarExp(OLD_STATE_ARG,stateDefinition.clone()); varExp.setType(((AStateDefinition) stateDefinition).getRecordType().clone()); postArglist.add(varExp); AVariableExp varExp2 = getVarExp(NEW_STATE_ARG,stateDefinition.clone()); varExp2.setType(((AStateDefinition) stateDefinition).getRecordType().clone()); postArglist.add(varExp2); } else AVariableExp varExp = getVarExp(OLD_SELF_ARG,stateDefinition.clone()); postArglist.add(varExp); varExp.setType(stateDefinition.getType().clone()); AVariableExp varExp2 = getVarExp(NEW_SELF_ARG,stateDefinition.clone()); postArglist.add(varExp2); varExp2.setType(stateDefinition.getType().clone());
@Override public PType caseAIsExp(AIsExp node, TypeCheckInfo question) throws AnalysisException { question.qualifiers = null; node.getTest().apply(THIS, question.newConstraint(null)); PType basictype = node.getBasicType(); if (basictype != null) { basictype = question.assistantFactory.createPTypeAssistant().typeResolve(basictype, null, THIS, question); question.assistantFactory.getTypeComparator().checkComposeTypes(basictype, question.env, false); } ILexNameToken typename = node.getTypeName(); if (typename != null) { PDefinition typeFound = question.env.findType(typename, node.getLocation().getModule()); if (typeFound == null) { TypeCheckerErrors.report(3113, "Unknown type name '" + typename + "'", node.getLocation(), node); } else { node.setTypedef(typeFound.clone()); } } node.setType(AstFactory.newABooleanBasicType(node.getLocation())); return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation()); }