/** * Creates a new complete constructor {@code ALetDefExp} 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 localDefs_ the {@link NodeList} node for the {@code localDefs} child of this {@link ALetDefExp} node * @param expression_ the {@link PExp} node for the {@code expression} child of this {@link ALetDefExp} node */ public ALetDefExp(PType type_, ILexLocation location_, List<? extends PDefinition> localDefs_, PExp expression_) { super(type_,location_); this.setLocalDefs(localDefs_); this.setExpression(expression_); }
/** * Creates a new tree field only constructor {@code ALetDefExp TAG=letDef} 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 localDefs_ the {@link NodeList} node for the {@code localDefs} child of this {@link ALetDefExp} node * @param expression_ the {@link PExp} node for the {@code expression} child of this {@link ALetDefExp} node */ public ALetDefExp(ILexLocation location_, List<? extends PDefinition> localDefs_, PExp expression_) { super(null,location_); this.setLocalDefs(localDefs_); this.setExpression(expression_); }
public static ALetDefExp newALetDefExp(ILexLocation start, List<PDefinition> localDefs, PExp readConnectiveExpression) { ALetDefExp result = new ALetDefExp(); initExpression(result, start); result.setLocalDefs(localDefs); result.setExpression(readConnectiveExpression); return result; }
@Override public PExp getContextNode(PExp stitch) { if (!exp.getLocalDefs().isEmpty()) { ALetDefExp letDefExp = new ALetDefExp(); letDefExp.setLocalDefs(exp.clone().getLocalDefs()); letDefExp.setExpression(stitch); return letDefExp; } else { return stitch; } }
private PExp buildStructuralComparison(PExp left_exp, PExp right_exp, int measureLexical) { if (measureLexical == 0) // what about 1 measures? same as 0? { return AstExpressionFactory.newAGreaterNumericBinaryExp(left_exp, right_exp); } ALetDefExp let_exp = new ALetDefExp(); AValueDefinition left_def = buildValueDef(left_exp, LEFT_MEASURE_NAME); AValueDefinition right_def = buildValueDef(right_exp, RIGHT_MEASURE_NAME); List<PDefinition> localDefs = new LinkedList<PDefinition>(); localDefs.add(left_def); localDefs.add(right_def); let_exp.setLocalDefs(localDefs); // let left = [left expression], right=[right expression] // in ... // we don't strictly need the let in AVariableExp leftName_exp = wrapName(new LexNameToken(null, LEFT_MEASURE_NAME, null)); AVariableExp rightName_exp = wrapName(new LexNameToken(null, RIGHT_MEASURE_NAME, null)); // build the left < right structural comparison expression let_exp.setExpression(buildStructuralLessThan(leftName_exp, rightName_exp, 1, measureLexical).clone()); return let_exp; }
List<PDefinition> defs = new LinkedList<PDefinition>(); defs.add(localDef); letDefExp.setLocalDefs(defs); letDefExp.setExpression(stitch); return letDefExp;
List<PDefinition> lDefs = new Vector<PDefinition>(); lDefs.add(local); letDefExp.setLocalDefs(lDefs); letDefExp.setExpression(stitch);
local.setTest(varExp); invDefs.add(local); letExp.setLocalDefs(invDefs); letExp.setExpression(def.getInvExpression().clone());