private List<PMultipleBind> getInvBinds(AStateDefinition node) { List<PMultipleBind> r = new Vector<PMultipleBind>(); for (AFieldField f : node.getFields()) { r.add(getMultipleTypeBind(f.getType().clone(), f.getTagname().clone())); } return r; }
fieldDefs.addAll(findFieldDefs(stateDef.getStateDefs(), stateDef.getFields()));
fieldNames = stateDef.getFields().stream().map(f -> f.getTagname().getName()).collect(Collectors.toList());
List<AFieldField> copy = new ArrayList<AFieldField>(node.getFields()); for( AFieldField e : copy)
List<AFieldField> copy = new ArrayList<AFieldField>(node.getFields()); for( AFieldField e : copy)
List<AFieldField> copy = new ArrayList<AFieldField>(node.getFields()); for( AFieldField e : copy)
private PExp makeInvApplyExp(AAtomicStm atom) { AStateDefinition stateDef = atom.getAssignments().get(0).getStateDefinition(); if (stateDef == null) { return extractInv(atom); } String stateName = getStateName(stateDef); List<PExp> arglist = new Vector<PExp>(); for (AFieldField f : stateDef.getFields()) { arglist.add(getVarExp(f.getTagname().clone(), stateDef.clone(),f.getType())); } PExp mkExp = AstExpressionFactory.newAMkTypeExp(new LexNameToken("", stateName, null), stateDef.getRecordType().clone(), arglist); AApplyExp invApplyExp = getApplyExp(getVarExp(stateDef.getInvdef().getName().clone(), stateDef.getInvdef().clone(), stateDef.getInvdef().getType().clone()), new ABooleanBasicType(), mkExp); invApplyExp.getRoot().setType(stateDef.getInvdef().getType().clone()); return invApplyExp; }
List<AFieldField> copy = new ArrayList<AFieldField>(node.getFields()); for( AFieldField e : copy)
List<AFieldField> copy = new ArrayList<AFieldField>(node.getFields()); for( AFieldField e : copy)
public State(AStateDefinition definition) { this.definition = definition; NameValuePairList fieldvalues = new NameValuePairList(); for (AFieldField f : definition.getFields()) { fieldvalues.add(new NameValuePair(f.getTagname(), UpdatableValue.factory(new ValueListenerList(this)))); } ARecordInvariantType rt = (ARecordInvariantType) definition.getRecordType(); this.context = new Context(Interpreter.getInstance().getAssistantFactory(), definition.getLocation(), "module state", null); this.recordValue = UpdatableValue.factory(new RecordValue(rt, fieldvalues, context), new ValueListenerList(this)); this.context.put(definition.getName(), recordValue); this.context.putList(fieldvalues); }
@Override public void caseAStateDefinition(AStateDefinition node, NewQuestion question) throws AnalysisException { for (AFieldField f : node.getFields()) { try { f.apply(THIS, new NewQuestion(question.rootVisitor, question.question)); } catch (TypeCheckException e) { question.question.assistantFactory.createPTypeAssistant().unResolve(f.getType()); throw e; } } node.setRecordType(af.createPTypeAssistant().typeResolve(node.getRecordType(), null, question.rootVisitor, question.question)); if (node.getInvPattern() != null) { node.getInvdef().apply(this, question); ARecordInvariantType rtype = (ARecordInvariantType) node.getRecordType(); rtype.setInvDef(node.getInvdef()); } if (node.getInitPattern() != null) { node.getInitdef().apply(this, question); } }
for (AFieldField f : definition.getFields())
stateDeclCg.setExecutable(node.getCanBeExecuted()); for (AFieldField field : node.getFields())
for (AFieldField field : node.getState().getFields())