/** * Called by the {@link AVariableExp} node from {@link AVariableExp#apply(IAnalysis)}. * @param node the calling {@link AVariableExp} node */ public void caseAVariableExp(AVariableExp node) throws AnalysisException { _visitedNodes.add(node); inAVariableExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getName() != null ) { node.getName().apply(this); } if(node.getVardef() != null && !_visitedNodes.contains(node.getVardef())) { node.getVardef().apply(this); } outAVariableExp(node); }
@Override public PType caseAIdentifierObjectDesignator( AIdentifierObjectDesignator node, TypeCheckInfo question) throws AnalysisException { return node.getExpression().apply(THIS, new TypeCheckInfo(question.assistantFactory, question.env, NameScope.NAMESANDSTATE, question.qualifiers)); }
/** * 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; } /**
/** * Creates a new tree field only constructor {@code AVariableExp TAG=variable} 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 name_ the {@link ILexNameToken} node for the {@code name} child of this {@link AVariableExp} node * @param original_ the {@link String} node for the {@code original} child of this {@link AVariableExp} node */ public AVariableExp(ILexLocation location_, ILexNameToken name_, String original_) { super(null,location_); this.setName(name_); this.setOriginal(original_); }
/** * Returns a deep clone of this {@link AVariableExp} node. * @return a deep clone of this {@link AVariableExp} node */ public AVariableExp clone() { return new AVariableExp( _type, _location, cloneNode(_name), _original, _vardef ); }
/** * Creates a new complete constructor {@code AVariableExp} 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 name_ the {@link ILexNameToken} node for the {@code name} child of this {@link AVariableExp} node * @param original_ the {@link String} node for the {@code original} child of this {@link AVariableExp} node * @param vardef_ the {@link PDefinition} <b>graph</a> node for the {@code vardef} child of this {@link AVariableExp} node. * <i>The parent of this {@code vardef } will not be changed by adding it to this node.</i> */ public AVariableExp(PType type_, ILexLocation location_, ILexNameToken name_, String original_, PDefinition vardef_) { super(type_,location_); this.setName(name_); this.setOriginal(original_); this.setVardef(vardef_); }
ILexNameToken name = node.getName(); node.setVardef(env.findName(name, question.scope)); PDefinition vardef = node.getVardef(); if (sd != null && node.getName().getModule().equals("")) node.setName(name.getModifiedName(sd.getName().getName())); + vardef.getClassDefinition().getName().getName(), node.getLocation(), node); node.setType(AstFactory.newAUnknownType(node.getLocation())); return node.getType(); } else if ( !question.assistantFactory.createPAccessSpecifierAssistant().isStatic(vardef.getAccess()) + " from a static context", node.getLocation(), node); node.setType(AstFactory.newAUnknownType(node.getLocation())); return node.getType(); node.setVardef(vardef); + name.getName(), node.getLocation(), node); env.listAlternatives(name); break; node.setVardef(vardef); node.setVardef(temp == null ? null : temp);
public static void beforeVariableReadDuration(AVariableExp var) { if (checker != null && checker.requiresCheck(var.getName())) { synchronized (values) { autoIncrementTime = false; } } }
@Override public Value caseAVariableExp(AVariableExp node, Context ctxt) throws AnalysisException { // Experimental hood added for DESTECS if (Settings.dialect == Dialect.VDM_RT) { SharedStateListner.beforeVariableReadDuration(node); } BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); return ctxt.lookup(node.getName()); }
throws AnalysisException PDefinition varDef = node.getVardef(); PType type = node.getType(); String name = node.getName().getName(); boolean explicit = node.getName().getExplicit(); SClassDefinition nodeParentClass = node.getAncestor(SClassDefinition.class); && question.getTcFactory().createPDefinitionAssistant().isStatic(varDef)) return consExplicitVar(node.getName().getModule(), name, isLambda, typeCg, isLocalDef); } else AModuleModules nodeModule = node.getAncestor(AModuleModules.class);
/** * Generate an AVariableExp */ protected AVariableExp getVarExp(ILexNameToken name) { AVariableExp var = new AVariableExp(); var.setName(name.clone()); var.setOriginal(name.getFullName()); return var; }
public OpBodyEndContext(List<AInstanceVariableDefinition> state, IPogAssistantFactory af) { this.af = af; subs = new LinkedList<Substitution>(); for (AInstanceVariableDefinition i : state) { AVariableExp var_exp = new AVariableExp(); ILexNameToken it = i.getName(); String safename = it.getName() + "$"; ILexNameToken safeToken = new LexNameToken(it.getModule(), safename, it.getLocation().clone()); var_exp.setName(safeToken); var_exp.setType(i.getType().clone()); var_exp.setOriginal(i.getName().getName().toString()); subs.add(new Substitution(i.getOldname(), var_exp)); } }
@Override // see [1] pg. 179 unary expressions public IProofObligationList caseAHeadUnaryExp(AHeadUnaryExp node, IPOContextStack question) throws AnalysisException { IProofObligationList obligations = defaultSUnaryExp(node, question); PExp exp = node.getExp(); // RWL This is a hack. The new ast LexNameToken's toString method // includes the module e.g. like Test`b for variables // which the old one did not. Hence proof obligations with variable // names are different as "Test`b" is just b with the old proof // obligations generator. PExp fake = exp.clone(); if (exp instanceof AVariableExp) { AVariableExp var = (AVariableExp) fake; var.setName(new LexNameToken("", var.getName().getIdentifier().clone())); } if (!aF.createPTypeAssistant().isType(exp.getType(), ASeq1SeqType.class)) { obligations.add(new NonEmptySeqObligation(fake, question, aF)); } return obligations; }
private APreExp readPreExpression(AVariableExp ve) throws ParserException, LexException { List<PExp> args = new Vector<PExp>(); PExp function = readExpression(); while (ignore(VDMToken.COMMA)) { args.add(readExpression()); } checkFor(VDMToken.KET, 2134, "Expecting pre_(function [,args])"); return AstFactory.newAPreExp(ve.getLocation(), function, args); }
public boolean containsKey(AVariableExp key) { String fullkey = makeFullKey(key.getName()); return original.equals(fullkey); }
String name = ve.getName().getName(); AIsExp exp = null; exp = AstFactory.newAIsExp(ve.getLocation(), nt.getName(), test); } else exp = AstFactory.newAIsExp(ve.getLocation(), type, test); LexNameToken typename = getMkTypeName(ve.getName()); VDMToken type = VDMToken.lookup(typename.name, Dialect.VDM_SL); exp = AstFactory.newAIsExp(ve.getLocation(), AstFactory.newABooleanBasicType(ve.getLocation()), readExpression()); break; exp = AstFactory.newAIsExp(ve.getLocation(), AstFactory.newANatNumericBasicType(ve.getLocation()), readExpression()); break; exp = AstFactory.newAIsExp(ve.getLocation(), AstFactory.newANatOneNumericBasicType(ve.getLocation()), readExpression()); break; exp = AstFactory.newAIsExp(ve.getLocation(), AstFactory.newAIntNumericBasicType(ve.getLocation()), readExpression()); break; exp = AstFactory.newAIsExp(ve.getLocation(), AstFactory.newARationalNumericBasicType(ve.getLocation()), readExpression()); break; exp = AstFactory.newAIsExp(ve.getLocation(), AstFactory.newARealNumericBasicType(ve.getLocation()), readExpression()); break;
@Override public SOperationDefinitionBase caseAVariableExp(AVariableExp node) throws AnalysisException { return node.getVardef().apply(this); }
private AVariableExp wrapName(ILexNameToken name) { AVariableExp r = new AVariableExp(); r.setName(name.clone()); r.setOriginal(name.getFullName()); return r; }
r.setType(var.getType().clone()); AVariableExp newVar = new AVariableExp(); newVar.setName(idPat.getName().clone()); newVar.setOriginal(idPat.getName().getFullName()); } else AVariableExp var_exp = new AVariableExp(); var_exp.setName(var.getName().clone()); var_exp.setType(var.getType().clone()); var_exp.setOriginal(var.getName().getName()); Substitution sub_old = new Substitution(var.getOldname().toString(), var_exp); subs.add(sub_old);