public List<List<PPattern>> getListParamPatternList( AImplicitOperationDefinition func) { List<List<PPattern>> parameters = new ArrayList<List<PPattern>>(); List<PPattern> plist = new ArrayList<PPattern>(); for (APatternListTypePair pl : func.getParameterPatterns()) { plist.addAll(pl.getPatterns()); } parameters.add(plist); return parameters; }
public List<PPattern> getParamPatternList( AImplicitOperationDefinition definition) { List<PPattern> plist = new ArrayList<PPattern>(); for (APatternListTypePair pl : definition.getParameterPatterns()) { plist.addAll(pl.getPatterns()); } return plist; }
private OperationValue(AImplicitOperationDefinition def, FunctionValue precondition, FunctionValue postcondition, AStateDefinition state, boolean async) { this.impldef = def; this.expldef = null; this.name = def.getName(); this.type = (AOperationType) def.getType(); this.paramPatterns = new Vector<PPattern>(); for (APatternListTypePair ptp : def.getParameterPatterns()) { paramPatterns.addAll(ptp.getPatterns()); } this.body = def.getBody(); this.precondition = precondition; this.postcondition = postcondition; this.state = state; this.classdef = def.getClassDefinition(); this.isAsync = async; traceRT = Settings.dialect == Dialect.VDM_RT && classdef != null && !(classdef instanceof ASystemClassDefinition) && !classdef.getName().getName().equals("CPU") && !classdef.getName().getName().equals("BUS") && !name.getName().equals("thread"); }
public static String getImplicitOperationString( AImplicitOperationDefinition d) { return d.getName() + Utils.listToString("(", d.getParameterPatterns(), ", ", ")") + (d.getResult() == null ? "" : " " + d.getResult()) + (d.getExternals().isEmpty() ? "" : "\n\text " + d.getExternals()) + (d.getPrecondition() == null ? "" : "\n\tpre " + d.getPrecondition()) + (d.getPostcondition() == null ? "" : "\n\tpost " + d.getPostcondition()) + (d.getErrors().isEmpty() ? "" : "\n\terrs " + d.getErrors()); }
@Override public LexNameSet caseAImplicitOperationDefinition(AImplicitOperationDefinition node, FreeVarInfo info) throws AnalysisException { List<PDefinition> defs = new Vector<PDefinition>(); for (APatternListTypePair pltp : node.getParameterPatterns()) { defs.addAll(getDefinitions(pltp, NameScope.LOCAL)); } FreeVarInfo local = info.set(new FlatEnvironment(af, defs, info.env)); LexNameSet names = new LexNameSet(); if (node.getBody() != null) { names.addAll(node.getBody().apply(this, local)); } if (node.getPredef() != null) { names.addAll(node.getPredef().apply(this, local)); } if (node.getPostdef() != null) { names.addAll(node.getPostdef().apply(this, local)); } return names; }
List<APatternListTypePair> copy = new ArrayList<APatternListTypePair>(node.getParameterPatterns()); for( APatternListTypePair e : copy)
List<APatternListTypePair> copy = new ArrayList<APatternListTypePair>(node.getParameterPatterns()); for( APatternListTypePair e : copy)
List<APatternListTypePair> copy = new ArrayList<APatternListTypePair>(node.getParameterPatterns()); for( APatternListTypePair e : copy)
@SuppressWarnings("unchecked") public AExplicitFunctionDefinition getPreDefinition( AImplicitOperationDefinition d, Environment base) { List<List<PPattern>> parameters = new Vector<List<PPattern>>(); List<PPattern> plist = new Vector<PPattern>(); for (APatternListTypePair pl : (LinkedList<APatternListTypePair>) d.getParameterPatterns()) { plist.addAll((Collection<PPattern>) pl.getPatterns().clone()); } AStateDefinition state = d.getState(); if (state != null) { plist.add(AstFactory.newAIdentifierPattern(state.getName().clone())); } else if (base.isVDMPP() && !af.createPAccessSpecifierAssistant().isStatic(d.getAccess())) { plist.add(AstFactory.newAIdentifierPattern(d.getName().getSelfName())); } parameters.add(plist); PExp preop = AstFactory.newAPreOpExp(d.getName().clone(), d.getPrecondition(), d.getErrors(), d.getState()); AExplicitFunctionDefinition def = AstFactory.newAExplicitFunctionDefinition(d.getName().getPreName(d.getPrecondition().getLocation()), NameScope.GLOBAL, null, af.createAOperationTypeAssistant().getPreType((AOperationType) d.getType(), state, d.getClassDefinition(), af.createPAccessSpecifierAssistant().isStatic(d.getAccess())), parameters, preop, null, null, false, null); // Operation precondition functions are effectively not static as // their expression can directly refer to instance variables, even // though at runtime these are passed via a "self" parameter. def.setAccess(af.createPAccessSpecifierAssistant().getStatic(d, false)); def.setClassDefinition(d.getClassDefinition()); return def; }
@Override public SDeclIR caseAImplicitOperationDefinition( AImplicitOperationDefinition node, IRInfo question) throws AnalysisException { AMethodDeclIR method = question.getDeclAssistant().initMethod(node, question); if (method == null) { question.addUnsupportedNode(node, "Expected method type for explicit operation. Got: " + node.getType()); return null; } // The curent IR construction does not include: // // Name of result and its type: // APatternTypePair res = node.getResult(); // Ext clauses (read and write): // LinkedList<AExternalClause> externals = node.getExternals(); // Exceptions thrown: // LinkedList<AErrorCase> errors = node.getErrors(); if(method.getBody() == null) { method.setBody(new ANotImplementedStmIR()); } method.setFormalParams(question.getDeclAssistant().consFormalParams(node.getParameterPatterns(), question)); return method; }
List<PPattern> plist = new Vector<PPattern>(); for (APatternListTypePair pl : (LinkedList<APatternListTypePair>) d.getParameterPatterns())
List<APatternListTypePair> copy = new ArrayList<APatternListTypePair>(node.getParameterPatterns()); for( APatternListTypePair e : copy)
List<APatternListTypePair> copy = new ArrayList<APatternListTypePair>(node.getParameterPatterns()); for( APatternListTypePair e : copy)
for (APatternListTypePair pltp : op.getParameterPatterns())
for (APatternListTypePair ptp : node.getParameterPatterns())
PatternAlwaysMatchesVisitor amVisitor = new PatternAlwaysMatchesVisitor(); for (APatternListTypePair tp : node.getParameterPatterns())
for (APatternListTypePair ptp : node.getParameterPatterns())