public static AMkTypeExp newAMkTypeExp(ILexNameToken typeName, PType type, List<PExp> arglist) { AMkTypeExp mktype = new AMkTypeExp(); mktype.setType(type); if (type instanceof ARecordInvariantType) { mktype.setRecordType((ARecordInvariantType) type.clone()); } mktype.setTypeName(typeName); mktype.setArgs(arglist); return mktype; }
/** * Creates a new complete constructor {@code AMkTypeExp} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param typeName_ the {@link ILexNameToken} node for the {@code typeName} child of this {@link AMkTypeExp} node * @param args_ the {@link NodeList} node for the {@code args} child of this {@link AMkTypeExp} node * @param recordType_ the {@link ARecordInvariantType} <b>graph</a> node for the {@code recordType} child of this {@link AMkTypeExp} node. * <i>The parent of this {@code recordType } will not be changed by adding it to this node.</i> * @param argTypes_ the {@link GraphNodeList} <b>graph</a> node for the {@code argTypes} child of this {@link AMkTypeExp} node. * <i>The parent of this {@code argTypes } will not be changed by adding it to this node.</i> */ public AMkTypeExp(PType type_, ILexLocation location_, ILexNameToken typeName_, List<? extends PExp> args_, ARecordInvariantType recordType_, List<? extends PType> argTypes_) { super(type_,location_); this.setTypeName(typeName_); this.setArgs(args_); this.setRecordType(recordType_); this.setArgTypes(argTypes_); }
/** * Creates a new tree field only constructor {@code AMkTypeExp TAG=mkType} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param typeName_ the {@link ILexNameToken} node for the {@code typeName} child of this {@link AMkTypeExp} node * @param args_ the {@link NodeList} node for the {@code args} child of this {@link AMkTypeExp} node */ public AMkTypeExp(ILexLocation location_, ILexNameToken typeName_, List<? extends PExp> args_) { super(null,location_); this.setTypeName(typeName_); this.setArgs(args_); }
/** * Returns a deep clone of this {@link AMkTypeExp} node. * @return a deep clone of this {@link AMkTypeExp} node */ public AMkTypeExp clone() { return new AMkTypeExp( _type, _location, cloneNode(_typeName), cloneList(_args), _recordType, _argTypes ); }
inAMkTypeExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this); if(node.getTypeName() != null ) node.getTypeName().apply(this); List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for( PExp e : copy) if(node.getRecordType() != null && !_visitedNodes.contains(node.getRecordType())) node.getRecordType().apply(this); List<PType> copy = new ArrayList<PType>(node.getArgTypes()); for( PType e : copy)
PDefinition typeDef = question.env.findType(node.getTypeName(), node.getLocation().getModule()); TypeCheckerErrors.report(3126, "Unknown type '" + node.getTypeName() + "' in constructor", node.getLocation(), node); node.setType(AstFactory.newAUnknownType(node.getLocation())); return node.getType(); TypeCheckerErrors.report(3127, "Type '" + node.getTypeName() + "' is not a record type", node.getLocation(), node); node.setType(rec); return rec; node.setRecordType((ARecordInvariantType) rec); if (node.getRecordType().getOpaque()) TypeCheckerErrors.report(3127, "Type '" + node.getTypeName() + "' is not a record type", node.getLocation(), node); node.setType(rec); return rec; if (node.getTypeName().getExplicit()) ARecordInvariantType recordType = node.getRecordType(); AExplicitFunctionDefinition eq = recordType.getEqDef(); AExplicitFunctionDefinition ord = recordType.getOrdDef(); recordType.setEqDef(eq); recordType.setOrdDef(ord);
Queue<PExp> args = (Queue<PExp>) node.getArgs().clone(); for (PExp arg : args) Queue<PType> argTypes = (Queue<PType>) node.getArgTypes().clone(); ARecordInvariantType recordType = node.getRecordType(); for (AFieldField f : recordType.getFields())
@Override public Value caseAMkTypeExp(AMkTypeExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); ValueList argvals = new ValueList(); for (PExp e : node.getArgs()) { argvals.add(e.apply(VdmRuntime.getExpressionEvaluator(), ctxt)); } try { return new RecordValue(node.getRecordType(), argvals, ctxt); } catch (ValueException e) { return VdmRuntimeError.abort(node.getLocation(), e); } }
throws AnalysisException ARecordInvariantType recType = node.getRecordType(); LinkedList<PExp> nodeArgs = node.getArgs();
@Override public LexNameSet caseAMkTypeExp(AMkTypeExp node, FreeVarInfo info) throws AnalysisException { LexNameSet names = new LexNameSet(node.getTypeName()); for (PExp arg: node.getArgs()) { names.addAll(arg.apply(this, info)); } return names; }
public LexNameList caseAMkTypeExp(AMkTypeExp expression) throws org.overture.ast.analysis.AnalysisException { return af.createPExpAssistant().getOldNames(expression.getArgs()); }
public static AMkTypeExp newAMkTypeExp(ILexNameToken typename, List<PExp> args) { AMkTypeExp result = new AMkTypeExp(); initExpression(result, typename.getLocation()); result.setTypeName(typename); result.setArgs(args); return result; }
AMkTypeExp mk = (AMkTypeExp) exp; if (rt.getFields().size() == mk.getArgs().size()) Iterator<PType> ait = mk.getArgTypes().iterator(); for (PExp e : mk.getArgs())
inAMkTypeExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this); if(node.getTypeName() != null ) node.getTypeName().apply(this); List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for( PExp e : copy) if(node.getRecordType() != null && !_visitedNodes.contains(node.getRecordType())) node.getRecordType().apply(this); List<PType> copy = new ArrayList<PType>(node.getArgTypes()); for( PType e : copy)
@Override public ValueList caseAMkTypeExp(AMkTypeExp exp, ObjectContext ctxt) throws AnalysisException { return af.createPExpAssistant().getValues(exp.getArgs(), ctxt); }
/** * Now, compound patterns involve recursive calls to expand their pattern components to expressions. * * @param node * @return * @throws AnalysisException */ public PExp caseARecordPattern(ARecordPattern node) throws AnalysisException { AMkTypeExp mkExp = new AMkTypeExp(); mkExp.setTypeName(node.getTypename().clone()); List<PExp> args = new Vector<PExp>(); for (PPattern p : node.getPlist()) { args.add(p.apply(this).clone()); } addPossibleType(mkExp, node); mkExp.setArgs(args); return mkExp; }
/** * Creates a deep clone of this {@link AMkTypeExp} 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 AMkTypeExp} node */ public AMkTypeExp clone(Map<INode,INode> oldToNewMap) { AMkTypeExp node = new AMkTypeExp( _type, _location, cloneNode(_typeName, oldToNewMap), cloneList(_args, oldToNewMap), _recordType, _argTypes ); oldToNewMap.put(this, node); return node; }
inAMkTypeExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this, question); if(node.getTypeName() != null ) node.getTypeName().apply(this, question); List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for( PExp e : copy) if(node.getRecordType() != null && !_visitedNodes.contains(node.getRecordType())) node.getRecordType().apply(this, question); List<PType> copy = new ArrayList<PType>(node.getArgTypes()); for( PType e : copy)
@Override public PExp caseAMkTypeExp(AMkTypeExp exp, Integer lineno) throws AnalysisException { PExp found = findExpressionBaseCase(exp, lineno); if (found != null) { return found; } return af.createPExpAssistant().findExpression(exp.getArgs(), lineno); }