/** * Creates a new tree field only constructor {@code AValueDefinition TAG=value} 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 PPattern} node for the {@code pattern} child of this {@link AValueDefinition} node * @param expression_ the {@link PExp} node for the {@code expression} child of this {@link AValueDefinition} node * @param defs_ the {@link NodeList} node for the {@code defs} child of this {@link AValueDefinition} node */ public AValueDefinition(ILexLocation location_, NameScope nameScope_, Boolean used_, AAccessSpecifierAccessSpecifier access_, Pass pass_, PPattern pattern_, PExp expression_, List<? extends PDefinition> defs_) { super(location_,null,nameScope_,used_,null,access_,null,pass_); this.setPattern(pattern_); this.setExpression(expression_); this.setDefs(defs_); }
/** * Creates a new complete constructor {@code AValueDefinition} 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 PPattern} node for the {@code pattern} child of this {@link AValueDefinition} node * @param expression_ the {@link PExp} node for the {@code expression} child of this {@link AValueDefinition} node * @param defs_ the {@link NodeList} node for the {@code defs} child of this {@link AValueDefinition} node * @param expType_ the {@link PType} <b>graph</a> node for the {@code expType} child of this {@link AValueDefinition} node. * <i>The parent of this {@code expType } will not be changed by adding it to this node.</i> */ public AValueDefinition(ILexLocation location_, ILexNameToken name_, NameScope nameScope_, Boolean used_, SClassDefinition classDefinition_, AAccessSpecifierAccessSpecifier access_, PType type_, Pass pass_, PPattern pattern_, PExp expression_, List<? extends PDefinition> defs_, PType expType_) { super(location_,name_,nameScope_,used_,classDefinition_,access_,type_,pass_); this.setPattern(pattern_); this.setExpression(expression_); this.setDefs(defs_); this.setExpType(expType_); }
public static AValueDefinition newAValueDefinition(PPattern p, NameScope scope, PType type, PExp readExpression) { AValueDefinition result = new AValueDefinition(); // Definition initialization initDefinition(result, Pass.VALUES, p.getLocation(), null, scope); result.setPattern(p); result.setType(type); result.setExpression(readExpression); List<PDefinition> defs = new Vector<PDefinition>(); for (ILexNameToken var : af.createPPatternAssistant().getVariableNames(p)) { defs.add(AstFactory.newAUntypedDefinition(result.getLocation(), var, scope)); } result.setDefs(defs); return result; }
private AValueDefinition buildValueDef(PExp exp, String name) { AValueDefinition valDef = new AValueDefinition(); valDef.setType(exp.getType().clone()); valDef.setExpression(exp.clone()); AIdentifierPattern pattern = new AIdentifierPattern(); pattern.setName(new LexNameToken(null, name, null)); valDef.setPattern(pattern); return valDef; }