//generated by abstract-syntax-gen package de.peeeq.wurstscript.ast; import java.util.*; @SuppressWarnings({"cast", "unused", "rawtypes"}) class OnDestroyDefImpl implements OnDestroyDef{ OnDestroyDefImpl(de.peeeq.wurstscript.parser.WPos source, WStatements body) { if (source == null) throw new IllegalArgumentException("Element source must not be null."); if (body == null) throw new IllegalArgumentException("Element body must not be null."); this.source = source; this.body = body; body.setParent(this); } private Element parent; public Element getParent() { return parent; } public void setParent(Element parent) { if (parent != null && this.parent != null) { throw new Error("Cannot change parent of element " + this.getClass().getSimpleName() + ", as it is already used in another tree." + "Use the copy method to create a new tree or remove the tree from its old parent or set the parent to null before moving the tree. "); } this.parent = parent; } public void replaceBy(Element other) { if (parent == null) throw new RuntimeException("Node not attached to tree."); for (int i=0; i action) { action.accept(this.body); } public int size() { return 1; } @Override public OnDestroyDef copy() { OnDestroyDef result = new OnDestroyDefImpl(source, (WStatements) this.body.copy()); return result; } @Override public OnDestroyDef copyWithRefs() { OnDestroyDef res = copy(); return res; } @Override public void clearAttributes() { body.clearAttributes(); clearAttributesLocal(); } @Override public void clearAttributesLocal() { zzattr_attrReadVariables_state = 0; zzattr_attrReturnType_state = 0; zzattr_attrNextScope_state = 0; zzattr_attrNameLinks_state = 0; zzattr_attrTypeNameLinks_state = 0; } @Override public void accept(Visitor v) { v.visit(this); } @Override public T match(ClassSlot.Matcher matcher) { return matcher.case_OnDestroyDef(this); } @Override public void match(ClassSlot.MatcherVoid matcher) { matcher.case_OnDestroyDef(this); } @Override public T match(TranslatedToImFunction.Matcher matcher) { return matcher.case_OnDestroyDef(this); } @Override public void match(TranslatedToImFunction.MatcherVoid matcher) { matcher.case_OnDestroyDef(this); } @Override public T match(HasReadVariables.Matcher matcher) { return matcher.case_OnDestroyDef(this); } @Override public void match(HasReadVariables.MatcherVoid matcher) { matcher.case_OnDestroyDef(this); } @Override public T match(WScope.Matcher matcher) { return matcher.case_OnDestroyDef(this); } @Override public void match(WScope.MatcherVoid matcher) { matcher.case_OnDestroyDef(this); } @Override public T match(Element.Matcher matcher) { return matcher.case_OnDestroyDef(this); } @Override public void match(Element.MatcherVoid matcher) { matcher.case_OnDestroyDef(this); } @Override public T match(FunctionLike.Matcher matcher) { return matcher.case_OnDestroyDef(this); } @Override public void match(FunctionLike.MatcherVoid matcher) { matcher.case_OnDestroyDef(this); } @Override public T match(AstElementWithBody.Matcher matcher) { return matcher.case_OnDestroyDef(this); } @Override public void match(AstElementWithBody.MatcherVoid matcher) { matcher.case_OnDestroyDef(this); } @Override public T match(AstElementWithSource.Matcher matcher) { return matcher.case_OnDestroyDef(this); } @Override public void match(AstElementWithSource.MatcherVoid matcher) { matcher.case_OnDestroyDef(this); } @Override public String toString() { return "OnDestroyDef(" + source + ", " +body+")"; } public boolean structuralEquals(Element e) { if (e instanceof OnDestroyDef) { OnDestroyDef o = (OnDestroyDef) e; return this.body.structuralEquals(o.getBody()); } else { return false; } } // circular = null private int zzattr_attrReadVariables_state = 0; private de.peeeq.immutablecollections.ImmutableList zzattr_attrReadVariables_cache; /** */ public de.peeeq.immutablecollections.ImmutableList attrReadVariables() { if (zzattr_attrReadVariables_state == 0) { try { zzattr_attrReadVariables_state = 1; zzattr_attrReadVariables_cache = de.peeeq.wurstscript.attributes.ReadVariables.calculate((OnDestroyDef)this); } finally { zzattr_attrReadVariables_state = 0; } zzattr_attrReadVariables_state = 2; } else if (zzattr_attrReadVariables_state == 1) { throw new CyclicDependencyError(this, "attrReadVariables"); } return zzattr_attrReadVariables_cache; } // circular = null private int zzattr_attrReturnType_state = 0; private de.peeeq.wurstscript.types.WurstType zzattr_attrReturnType_cache; /** */ public de.peeeq.wurstscript.types.WurstType attrReturnType() { if (zzattr_attrReturnType_state == 0) { try { zzattr_attrReturnType_state = 1; zzattr_attrReturnType_cache = de.peeeq.wurstscript.attributes.AttrVarDefType.calculate((OnDestroyDef)this); } finally { zzattr_attrReturnType_state = 0; } zzattr_attrReturnType_state = 2; } else if (zzattr_attrReturnType_state == 1) { throw new CyclicDependencyError(this, "attrReturnType"); } return zzattr_attrReturnType_cache; } /** */ public boolean attrIsDynamicContext() { return de.peeeq.wurstscript.attributes.IsDynamicContext.calculate((OnDestroyDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable PackageOrGlobal attrNearestPackage() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestPackage((OnDestroyDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable NamedScope attrNearestNamedScope() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestNamedScope((OnDestroyDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable WScope attrNearestScope() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestScope((OnDestroyDef)this); } // circular = null private int zzattr_attrNextScope_state = 0; private @org.eclipse.jdt.annotation.Nullable WScope zzattr_attrNextScope_cache; /** "returns the scope surrounding this scope"*/ public @org.eclipse.jdt.annotation.Nullable WScope attrNextScope() { if (zzattr_attrNextScope_state == 0) { try { zzattr_attrNextScope_state = 1; zzattr_attrNextScope_cache = de.peeeq.wurstscript.attributes.AttrNearest.nextScope((OnDestroyDef)this); } finally { zzattr_attrNextScope_state = 0; } zzattr_attrNextScope_state = 2; } else if (zzattr_attrNextScope_state == 1) { throw new CyclicDependencyError(this, "attrNextScope"); } return zzattr_attrNextScope_cache; } /** */ public String attrPathDescription() { return de.peeeq.wurstscript.attributes.PathDescription.get((OnDestroyDef)this); } /** */ public CompilationUnit attrCompilationUnit() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestCompilationUnit((OnDestroyDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable ClassDef attrNearestClassDef() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestClassDef((OnDestroyDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable ClassOrInterface attrNearestClassOrInterface() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestClassOrInterface((OnDestroyDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable ClassOrModule attrNearestClassOrModule() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestClassOrModule((OnDestroyDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable StructureDef attrNearestStructureDef() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestStructureDef((OnDestroyDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable FunctionImplementation attrNearestFuncDef() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestFuncDef((OnDestroyDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable ExprClosure attrNearestExprClosure() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestExprClosure((OnDestroyDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable ExprStatementsBlock attrNearestExprStatementsBlock() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestExprStatementsBlock((OnDestroyDef)this); } /** "returns the element itself if it is a NameDef or returns the referenced NameDef if the elem is a reference or returns null otherwise "*/ public @org.eclipse.jdt.annotation.Nullable NameDef tryGetNameDef() { return de.peeeq.wurstscript.attributes.AttrNameDef.tryGetNameDef((OnDestroyDef)this); } /** */ public de.peeeq.wurstscript.parser.WPos attrSource() { return de.peeeq.wurstscript.attributes.AttrPos.getPos((OnDestroyDef)this); } /** "returns the position where errors are marked"*/ public de.peeeq.wurstscript.parser.WPos attrErrorPos() { return de.peeeq.wurstscript.attributes.AttrPos.getErrorPos((OnDestroyDef)this); } /** */ public WurstModel getModel() { return de.peeeq.wurstscript.attributes.AttrImportedPackage.getModel((OnDestroyDef)this); } /** */ public void imCreateFuncSkeleton(de.peeeq.wurstscript.translation.imtranslation.ImTranslator translator, de.peeeq.wurstscript.jassIm.ImFunction f) { de.peeeq.wurstscript.translation.imtranslation.FuncSkeleton.create((OnDestroyDef)this, translator, f); } /** */ public void addError(String msg) { de.peeeq.wurstscript.attributes.ErrorHandling.addError((OnDestroyDef)this, msg); } /** */ public void addWarning(String msg) { de.peeeq.wurstscript.attributes.ErrorHandling.addWarning((OnDestroyDef)this, msg); } /** */ public de.peeeq.wurstscript.attributes.ErrorHandler getErrorHandler() { return de.peeeq.wurstscript.attributes.ErrorHandling.getErrorHandler((OnDestroyDef)this); } /** */ public boolean attrHasEmptyBody() { return de.peeeq.wurstscript.attributes.SmallHelpers.hasEmptyBody((OnDestroyDef)this); } // circular = null private int zzattr_attrNameLinks_state = 0; private com.google.common.collect.ImmutableMultimap zzattr_attrNameLinks_cache; /** "returns a map of all the names visible in this scope."*/ public com.google.common.collect.ImmutableMultimap attrNameLinks() { if (zzattr_attrNameLinks_state == 0) { try { zzattr_attrNameLinks_state = 1; zzattr_attrNameLinks_cache = de.peeeq.wurstscript.attributes.names.NameLinks.calculate((OnDestroyDef)this); } finally { zzattr_attrNameLinks_state = 0; } zzattr_attrNameLinks_state = 2; } else if (zzattr_attrNameLinks_state == 1) { throw new CyclicDependencyError(this, "attrNameLinks"); } return zzattr_attrNameLinks_cache; } // circular = null private int zzattr_attrTypeNameLinks_state = 0; private com.google.common.collect.ImmutableMultimap zzattr_attrTypeNameLinks_cache; /** "returns a map of all the names visible in this scope."*/ public com.google.common.collect.ImmutableMultimap attrTypeNameLinks() { if (zzattr_attrTypeNameLinks_state == 0) { try { zzattr_attrTypeNameLinks_state = 1; zzattr_attrTypeNameLinks_cache = de.peeeq.wurstscript.attributes.names.TypeNameLinks.calculate((OnDestroyDef)this); } finally { zzattr_attrTypeNameLinks_state = 0; } zzattr_attrTypeNameLinks_state = 2; } else if (zzattr_attrTypeNameLinks_state == 1) { throw new CyclicDependencyError(this, "attrTypeNameLinks"); } return zzattr_attrTypeNameLinks_cache; } /** */ public @org.eclipse.jdt.annotation.Nullable TypeDef lookupType(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupType((OnDestroyDef)this, name, showErrors); } /** */ public de.peeeq.wurstscript.attributes.names.PackageLink lookupPackage(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupPackage((OnDestroyDef)this, name, showErrors); } /** */ public de.peeeq.wurstscript.attributes.names.NameLink lookupVar(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupVar((OnDestroyDef)this, name, showErrors); } /** */ public de.peeeq.wurstscript.attributes.names.NameLink lookupVarNoConfig(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupVarNoConfig((OnDestroyDef)this, name, showErrors); } /** */ public de.peeeq.wurstscript.attributes.names.NameLink lookupMemberVar(de.peeeq.wurstscript.types.WurstType receiverType, String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupMemberVar((OnDestroyDef)this, receiverType, name, showErrors); } /** */ public com.google.common.collect.ImmutableCollection lookupFuncs(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupFuncs((OnDestroyDef)this, name, showErrors); } /** */ public com.google.common.collect.ImmutableCollection lookupFuncsNoConfig(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupFuncsNoConfig((OnDestroyDef)this, name, showErrors); } /** */ public com.google.common.collect.ImmutableCollection lookupMemberFuncs(de.peeeq.wurstscript.types.WurstType receiverType, String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupMemberFuncs((OnDestroyDef)this, receiverType, name, showErrors); } /** */ public @org.eclipse.jdt.annotation.Nullable TypeDef lookupType(String name) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupTypeShort((OnDestroyDef)this, name); } /** */ public de.peeeq.wurstscript.attributes.names.PackageLink lookupPackage(String name) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupPackageShort((OnDestroyDef)this, name); } /** */ public de.peeeq.wurstscript.attributes.names.NameLink lookupVar(String name) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupVarShort((OnDestroyDef)this, name); } /** */ public de.peeeq.wurstscript.attributes.names.NameLink lookupMemberVar(de.peeeq.wurstscript.types.WurstType receiverType, String name) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupMemberVarShort((OnDestroyDef)this, receiverType, name); } /** */ public com.google.common.collect.ImmutableCollection lookupFuncs(String name) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupFuncsShort((OnDestroyDef)this, name); } /** */ public com.google.common.collect.ImmutableCollection lookupMemberFuncs(de.peeeq.wurstscript.types.WurstType receiverType, String name) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupMemberFuncsShort((OnDestroyDef)this, receiverType, name); } /** */ public com.google.common.collect.ImmutableCollection attrUsedPackages() { return de.peeeq.wurstscript.attributes.UsedPackages.usedPackages((OnDestroyDef)this); } /** */ public String description() { return de.peeeq.wurstscript.attributes.Description.description((OnDestroyDef)this); } /** */ public String descriptionHtml() { return de.peeeq.wurstscript.attributes.DescriptionHtml.description((OnDestroyDef)this); } /** */ public boolean isSubtreeOf(Element other) { return de.peeeq.wurstscript.attributes.SmallHelpers.isSubtreeOf((OnDestroyDef)this, other); } /** */ public void prettyPrint(de.peeeq.wurstscript.attributes.prettyPrint.Spacer spacer, StringBuilder sb, int indent) { de.peeeq.wurstscript.attributes.prettyPrint.PrettyPrinter.prettyPrint((OnDestroyDef)this, spacer, sb, indent); } }