/** * Called by the {@link ABooleanConstExp} node from {@link ABooleanConstExp#apply(IPOFAnalysis)}. * @param node the calling {@link ABooleanConstExp} node */ public void caseABooleanConstExp(ABooleanConstExp node) throws AnalysisException { _visitedNodes.add(node); inABooleanConstExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getValue() != null ) { node.getValue().apply(this); } outABooleanConstExp(node); }
public static ABooleanConstExp newABooleanConstExp(LexBooleanToken value) { ABooleanConstExp result = new ABooleanConstExp(); initExpression(result, value.location); result.setValue(value); return result; }
@Override public PType caseABooleanConstExp(ABooleanConstExp node, TypeCheckInfo question) { node.setType(AstFactory.newABooleanBasicType(node.getLocation())); return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation()); }
/** * Returns a deep clone of this {@link ABooleanConstExp} node. * @return a deep clone of this {@link ABooleanConstExp} node */ public ABooleanConstExp clone() { return new ABooleanConstExp( _type, _location, cloneNode(_value) ); }
@Override public Value caseABooleanConstExp(ABooleanConstExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); return new BooleanValue(node.getValue().getValue()); }
if (boolLiteral.getValue().getValue()) // while true do...
/** * Creates a new complete constructor {@code ABooleanConstExp} 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 value_ the {@link ILexBooleanToken} node for the {@code value} child of this {@link ABooleanConstExp} node */ public ABooleanConstExp(PType type_, ILexLocation location_, ILexBooleanToken value_) { super(type_,location_); this.setValue(value_); }
/** * Creates a deep clone of this {@link ABooleanConstExp} 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 ABooleanConstExp} node */ public ABooleanConstExp clone(Map<INode,INode> oldToNewMap) { ABooleanConstExp node = new ABooleanConstExp( _type, _location, cloneNode(_value, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Creates a new tree field only constructor {@code ABooleanConstExp TAG=booleanConst} 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 value_ the {@link ILexBooleanToken} node for the {@code value} child of this {@link ABooleanConstExp} node */ public ABooleanConstExp(ILexLocation location_, ILexBooleanToken value_) { super(null,location_); this.setValue(value_); }
/** * Called by the {@link ABooleanConstExp} node from {@link ABooleanConstExp#apply(IAnalysis)}. * @param node the calling {@link ABooleanConstExp} node */ public void caseABooleanConstExp(ABooleanConstExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inABooleanConstExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getValue() != null ) { node.getValue().apply(this, question); } outABooleanConstExp(node, question); }
/** * First, literal patterns convert to expressions easily: * * @param node * @return * @throws AnalysisException */ public PExp caseABooleanPattern(ABooleanPattern node) throws AnalysisException { ABooleanConstExp b = new ABooleanConstExp(); b.setValue(node.getValue().clone()); addPossibleType(b, node); return b; }
/** * Called by the {@link ABooleanConstExp} node from {@link ABooleanConstExp#apply(IAnalysis)}. * @param node the calling {@link ABooleanConstExp} node */ public void caseABooleanConstExp(ABooleanConstExp node) throws AnalysisException { _visitedNodes.add(node); inABooleanConstExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getValue() != null ) { node.getValue().apply(this); } outABooleanConstExp(node); }
ABooleanConstExp r = new ABooleanConstExp(); r.setValue(new LexBooleanToken(true, null)); return r; } else
/** * Called by the {@link ABooleanConstExp} node from {@link ABooleanConstExp#apply(IAnalysis)}. * @param node the calling {@link ABooleanConstExp} node */ public A caseABooleanConstExp(ABooleanConstExp node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inABooleanConstExp(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getValue() != null ) { mergeReturns(retVal,node.getValue().apply(this)); } mergeReturns(retVal,outABooleanConstExp(node)); return retVal; }
public LetBeExistsObligation(ALetBeStExp exp, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(exp, POType.LET_BE_EXISTS, ctxt, exp.getBind().getLocation(), af); /** * let <binds> be st <predicate> in <exp> produces exists <binds> & <predicate> */ AExistsExp exists = new AExistsExp(); List<PMultipleBind> bindList = new Vector<PMultipleBind>(); bindList.add(exp.getBind().clone()); exists.setBindList(bindList); if (exp.getSuchThat() != null) { exists.setPredicate(exp.getSuchThat().clone()); } else { // we just use true since we cannot have // exists by itself ABooleanConstExp replacementNothing_exp = new ABooleanConstExp(); replacementNothing_exp.setValue(new LexBooleanToken(true, null)); exists.setPredicate(replacementNothing_exp); } stitch = exists; valuetree.setPredicate(ctxt.getPredWithContext(exists)); }
/** * Called by the {@link ABooleanConstExp} node from {@link ABooleanConstExp#apply(IAnalysis)}. * @param node the calling {@link ABooleanConstExp} node */ public A caseABooleanConstExp(ABooleanConstExp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inABooleanConstExp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getValue() != null ) { mergeReturns(retVal,node.getValue().apply(this, question)); } mergeReturns(retVal,outABooleanConstExp(node, question)); return retVal; }
public LetBeExistsObligation(ALetBeStStm stmt, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(stmt, POType.LET_BE_EXISTS, ctxt, stmt.getBind().getLocation(), af); AExistsExp exists = new AExistsExp(); List<PMultipleBind> bindList = new Vector<PMultipleBind>(); bindList.add(stmt.getBind().clone()); exists.setBindList(bindList); if (stmt.getSuchThat() != null) { exists.setPredicate(stmt.getSuchThat().clone()); } else { // we just use true since we cannot have // exists by itself ABooleanConstExp replacementNothing_exp = new ABooleanConstExp(); replacementNothing_exp.setValue(new LexBooleanToken(true, null)); exists.setPredicate(replacementNothing_exp); } stitch = exists; valuetree.setPredicate(ctxt.getPredWithContext(exists)); } }
@Override public SExpIR caseABooleanConstExp(ABooleanConstExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); boolean value = node.getValue().getValue(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); ABoolLiteralExpIR boolLitCg = new ABoolLiteralExpIR(); boolLitCg.setType(typeCg); boolLitCg.setValue(value); return boolLitCg; }