/** * Creates a new tree field only constructor {@code AForAllStmIR TAG=forAll} 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 pattern_ the {@link SPatternIR} node for the {@code pattern} child of this {@link AForAllStmIR} node * @param exp_ the {@link SExpIR} node for the {@code exp} child of this {@link AForAllStmIR} node * @param body_ the {@link SStmIR} node for the {@code body} child of this {@link AForAllStmIR} node */ public AForAllStmIR(SPatternIR pattern_, SExpIR exp_, SStmIR body_) { super(null,null,null); this.setPattern(pattern_); this.setExp(exp_); this.setBody(body_); }
/** * Creates a new complete constructor {@code AForAllStmIR} 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 pattern_ the {@link SPatternIR} node for the {@code pattern} child of this {@link AForAllStmIR} node * @param exp_ the {@link SExpIR} node for the {@code exp} child of this {@link AForAllStmIR} node * @param body_ the {@link SStmIR} node for the {@code body} child of this {@link AForAllStmIR} node */ public AForAllStmIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, SPatternIR pattern_, SExpIR exp_, SStmIR body_) { super(sourceNode_,tag_,metaData_); this.setPattern(pattern_); this.setExp(exp_); this.setBody(body_); }
@Override public SStmIR caseAForAllStm(AForAllStm node, IRInfo question) throws AnalysisException { // Example: for all x in set {1,2,3} do skip; PPattern pattern = node.getPattern(); PExp set = node.getSet(); PStm body = node.getStatement(); SPatternIR patternCg = pattern.apply(question.getPatternVisitor(), question); SExpIR setExpCg = set.apply(question.getExpVisitor(), question); SStmIR bodyCg = body.apply(question.getStmVisitor(), question); AForAllStmIR forAll = new AForAllStmIR(); forAll.setPattern(patternCg); forAll.setExp(setExpCg); forAll.setBody(bodyCg); return forAll; }
forAll.setPattern(patternCg); forAll.setBody(stmCg);