/** * Creates a new complete constructor {@code AObjectPattern} 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 classname_ the {@link ILexNameToken} node for the {@code classname} child of this {@link AObjectPattern} node * @param fields_ the {@link NodeList} node for the {@code fields} child of this {@link AObjectPattern} node * @param type_ the {@link PType} <b>graph</a> node for the {@code type} child of this {@link AObjectPattern} node. * <i>The parent of this {@code type } will not be changed by adding it to this node.</i> */ public AObjectPattern(ILexLocation location_, List<? extends PDefinition> definitions_, Boolean resolved_, ILexNameToken classname_, List<? extends ANamePatternPair> fields_, PType type_) { super(location_,definitions_,resolved_); this.setClassname(classname_); this.setFields(fields_); this.setType(type_); }
public static AObjectPattern newAObjectPattern(ILexNameToken classname, List<ANamePatternPair> list) { AObjectPattern result = new AObjectPattern(); initPattern(result, classname.getLocation()); result.setFields(list); result.setClassname(classname); result.setType(AstFactory.getAUnresolvedType(classname)); return result; }
@Override public void caseAObjectPattern(AObjectPattern pattern, NewQuestion question) throws AnalysisException { if (pattern.getResolved()) { return; } else { pattern.setResolved(true); } try { af.createPPatternListAssistant().typeResolvePairs(pattern.getFields(), question.rootVisitor, question.question); pattern.setType(af.createPTypeAssistant().typeResolve(pattern.getType(), null, question.rootVisitor, question.question)); } catch (TypeCheckException e) { af.createPPatternAssistant().unResolve(pattern); throw e; } }