//generated by abstract-syntax-gen package de.peeeq.wurstscript.ast; import java.util.*; @SuppressWarnings({"cast", "unused", "rawtypes"}) class GlobalVarDefImpl implements GlobalVarDef{ GlobalVarDefImpl(de.peeeq.wurstscript.parser.WPos source, Modifiers modifiers, OptTypeExpr optTyp, Identifier nameId, VarInitialization initialExpr) { if (source == null) throw new IllegalArgumentException("Element source must not be null."); if (modifiers == null) throw new IllegalArgumentException("Element modifiers must not be null."); if (optTyp == null) throw new IllegalArgumentException("Element optTyp must not be null."); if (nameId == null) throw new IllegalArgumentException("Element nameId must not be null."); if (initialExpr == null) throw new IllegalArgumentException("Element initialExpr must not be null."); this.source = source; this.modifiers = modifiers; this.optTyp = optTyp; this.nameId = nameId; this.initialExpr = initialExpr; modifiers.setParent(this); optTyp.setParent(this); nameId.setParent(this); initialExpr.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.modifiers); action.accept(this.optTyp); action.accept(this.nameId); action.accept(this.initialExpr); } public int size() { return 4; } @Override public GlobalVarDef copy() { GlobalVarDef result = new GlobalVarDefImpl(source, (Modifiers) this.modifiers.copy(), (OptTypeExpr) this.optTyp.copy(), (Identifier) this.nameId.copy(), (VarInitialization) this.initialExpr.copy()); return result; } @Override public GlobalVarDef copyWithRefs() { GlobalVarDef res = copy(); return res; } @Override public void clearAttributes() { modifiers.clearAttributes(); optTyp.clearAttributes(); nameId.clearAttributes(); initialExpr.clearAttributes(); clearAttributesLocal(); } @Override public void clearAttributesLocal() { zzattr_attrTyp_state = 0; zzattr_attrConfigActualNameDef_state = 0; } @Override public void accept(Visitor v) { v.visit(this); } @Override public T match(ClassMember.Matcher matcher) { return matcher.case_GlobalVarDef(this); } @Override public void match(ClassMember.MatcherVoid matcher) { matcher.case_GlobalVarDef(this); } @Override public T match(ClassSlot.Matcher matcher) { return matcher.case_GlobalVarDef(this); } @Override public void match(ClassSlot.MatcherVoid matcher) { matcher.case_GlobalVarDef(this); } @Override public T match(GlobalOrLocalVarDef.Matcher matcher) { return matcher.case_GlobalVarDef(this); } @Override public void match(GlobalOrLocalVarDef.MatcherVoid matcher) { matcher.case_GlobalVarDef(this); } @Override public T match(VarDef.Matcher matcher) { return matcher.case_GlobalVarDef(this); } @Override public void match(VarDef.MatcherVoid matcher) { matcher.case_GlobalVarDef(this); } @Override public T match(HasModifier.Matcher matcher) { return matcher.case_GlobalVarDef(this); } @Override public void match(HasModifier.MatcherVoid matcher) { matcher.case_GlobalVarDef(this); } @Override public T match(Documentable.Matcher matcher) { return matcher.case_GlobalVarDef(this); } @Override public void match(Documentable.MatcherVoid matcher) { matcher.case_GlobalVarDef(this); } @Override public T match(Element.Matcher matcher) { return matcher.case_GlobalVarDef(this); } @Override public void match(Element.MatcherVoid matcher) { matcher.case_GlobalVarDef(this); } @Override public T match(NameDef.Matcher matcher) { return matcher.case_GlobalVarDef(this); } @Override public void match(NameDef.MatcherVoid matcher) { matcher.case_GlobalVarDef(this); } @Override public T match(AstElementWithSource.Matcher matcher) { return matcher.case_GlobalVarDef(this); } @Override public void match(AstElementWithSource.MatcherVoid matcher) { matcher.case_GlobalVarDef(this); } @Override public T match(WEntity.Matcher matcher) { return matcher.case_GlobalVarDef(this); } @Override public void match(WEntity.MatcherVoid matcher) { matcher.case_GlobalVarDef(this); } @Override public T match(AstElementWithNameId.Matcher matcher) { return matcher.case_GlobalVarDef(this); } @Override public void match(AstElementWithNameId.MatcherVoid matcher) { matcher.case_GlobalVarDef(this); } @Override public String toString() { return "GlobalVarDef(" + source + ", " +modifiers + ", " +optTyp + ", " +nameId + ", " +initialExpr+")"; } public boolean structuralEquals(Element e) { if (e instanceof GlobalVarDef) { GlobalVarDef o = (GlobalVarDef) e; return this.modifiers.structuralEquals(o.getModifiers()) && this.optTyp.structuralEquals(o.getOptTyp()) && this.nameId.structuralEquals(o.getNameId()) && this.initialExpr.structuralEquals(o.getInitialExpr()); } else { return false; } } // circular = null private int zzattr_attrTyp_state = 0; private de.peeeq.wurstscript.types.WurstType zzattr_attrTyp_cache; /** */ public de.peeeq.wurstscript.types.WurstType attrTyp() { if (zzattr_attrTyp_state == 0) { try { zzattr_attrTyp_state = 1; zzattr_attrTyp_cache = de.peeeq.wurstscript.attributes.AttrVarDefType.calculate((GlobalVarDef)this); } finally { zzattr_attrTyp_state = 0; } zzattr_attrTyp_state = 2; } else if (zzattr_attrTyp_state == 1) { throw new CyclicDependencyError(this, "attrTyp"); } return zzattr_attrTyp_cache; } /** */ public boolean attrIsDynamicClassMember() { return de.peeeq.wurstscript.attributes.AttrIsClassMember.calculate((GlobalVarDef)this); } /** */ public boolean attrIsDynamicContext() { return de.peeeq.wurstscript.attributes.IsDynamicContext.calculate((GlobalVarDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable PackageOrGlobal attrNearestPackage() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestPackage((GlobalVarDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable NamedScope attrNearestNamedScope() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestNamedScope((GlobalVarDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable WScope attrNearestScope() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestScope((GlobalVarDef)this); } /** */ public String attrPathDescription() { return de.peeeq.wurstscript.attributes.PathDescription.get((GlobalVarDef)this); } /** */ public CompilationUnit attrCompilationUnit() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestCompilationUnit((GlobalVarDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable ClassDef attrNearestClassDef() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestClassDef((GlobalVarDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable ClassOrInterface attrNearestClassOrInterface() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestClassOrInterface((GlobalVarDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable ClassOrModule attrNearestClassOrModule() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestClassOrModule((GlobalVarDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable StructureDef attrNearestStructureDef() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestStructureDef((GlobalVarDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable FunctionImplementation attrNearestFuncDef() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestFuncDef((GlobalVarDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable ExprClosure attrNearestExprClosure() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestExprClosure((GlobalVarDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable ExprStatementsBlock attrNearestExprStatementsBlock() { return de.peeeq.wurstscript.attributes.AttrNearest.nearestExprStatementsBlock((GlobalVarDef)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((GlobalVarDef)this); } /** */ public boolean attrIsCompiletime() { return de.peeeq.wurstscript.attributes.ModifiersHelper.isCompiletime((GlobalVarDef)this); } /** */ public boolean attrHasAnnotation(String name) { return de.peeeq.wurstscript.attributes.ModifiersHelper.hasAnnotation((GlobalVarDef)this, name); } /** */ public Annotation attrGetAnnotation(String name) { return de.peeeq.wurstscript.attributes.ModifiersHelper.getAnnotation((GlobalVarDef)this, name); } /** */ public boolean attrIsPublic() { return de.peeeq.wurstscript.attributes.ModifiersHelper.isPublic((GlobalVarDef)this); } /** */ public boolean attrIsPublicRead() { return de.peeeq.wurstscript.attributes.ModifiersHelper.isPublicRead((GlobalVarDef)this); } /** */ public boolean attrIsPrivate() { return de.peeeq.wurstscript.attributes.ModifiersHelper.isPrivate((GlobalVarDef)this); } /** */ public boolean attrIsProtected() { return de.peeeq.wurstscript.attributes.ModifiersHelper.isProtected((GlobalVarDef)this); } /** */ public boolean attrIsStatic() { return de.peeeq.wurstscript.attributes.ModifiersHelper.isStatic((GlobalVarDef)this); } /** */ public boolean attrIsOverride() { return de.peeeq.wurstscript.attributes.ModifiersHelper.isOverride((GlobalVarDef)this); } /** */ public boolean attrIsAbstract() { return de.peeeq.wurstscript.attributes.ModifiersHelper.isAbstract((GlobalVarDef)this); } /** */ public boolean attrIsConstant() { return de.peeeq.wurstscript.attributes.ModifiersHelper.isConstant((GlobalVarDef)this); } /** */ public boolean attrIsVararg() { return de.peeeq.wurstscript.attributes.ModifiersHelper.isVararg((GlobalVarDef)this); } /** */ public de.peeeq.wurstscript.parser.WPos attrSource() { return de.peeeq.wurstscript.attributes.AttrPos.getPos((GlobalVarDef)this); } /** "returns the position where errors are marked"*/ public de.peeeq.wurstscript.parser.WPos attrErrorPos() { return de.peeeq.wurstscript.attributes.AttrPos.getErrorPos((GlobalVarDef)this); } /** */ public WurstModel getModel() { return de.peeeq.wurstscript.attributes.AttrImportedPackage.getModel((GlobalVarDef)this); } // circular = null private int zzattr_attrConfigActualNameDef_state = 0; private NameDef zzattr_attrConfigActualNameDef_cache; /** */ public NameDef attrConfigActualNameDef() { if (zzattr_attrConfigActualNameDef_state == 0) { try { zzattr_attrConfigActualNameDef_state = 1; zzattr_attrConfigActualNameDef_cache = de.peeeq.wurstscript.attributes.CofigActualDef.calculate((GlobalVarDef)this); } finally { zzattr_attrConfigActualNameDef_state = 0; } zzattr_attrConfigActualNameDef_state = 2; } else if (zzattr_attrConfigActualNameDef_state == 1) { throw new CyclicDependencyError(this, "attrConfigActualNameDef"); } return zzattr_attrConfigActualNameDef_cache; } /** */ public boolean hasAnnotation(String annotation) { return de.peeeq.wurstscript.attributes.HasAnnotation.hasAnnotation((GlobalVarDef)this, annotation); } /** */ public Annotation getAnnotation(String annotation) { return de.peeeq.wurstscript.attributes.HasAnnotation.getAnnotation((GlobalVarDef)this, annotation); } /** */ public void imTranslateEntity(de.peeeq.wurstscript.translation.imtranslation.ImTranslator translator) { de.peeeq.wurstscript.translation.imtranslation.TLDTranslation.translate((GlobalVarDef)this, translator); } /** */ public void addError(String msg) { de.peeeq.wurstscript.attributes.ErrorHandling.addError((GlobalVarDef)this, msg); } /** */ public void addWarning(String msg) { de.peeeq.wurstscript.attributes.ErrorHandling.addWarning((GlobalVarDef)this, msg); } /** */ public de.peeeq.wurstscript.attributes.ErrorHandler getErrorHandler() { return de.peeeq.wurstscript.attributes.ErrorHandling.getErrorHandler((GlobalVarDef)this); } /** "returns a VarLink pointing to this NameDef"*/ public de.peeeq.wurstscript.attributes.names.VarLink createVarLink(WScope definedIn) { return de.peeeq.wurstscript.attributes.names.VarLink.create((GlobalVarDef)this, definedIn); } /** */ public OptTypeExpr attrOptTypeExpr() { return de.peeeq.wurstscript.attributes.names.VarLink.getTypeExpr((GlobalVarDef)this); } /** */ public @org.eclipse.jdt.annotation.Nullable TypeDef lookupType(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupType((GlobalVarDef)this, name, showErrors); } /** */ public de.peeeq.wurstscript.attributes.names.PackageLink lookupPackage(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupPackage((GlobalVarDef)this, name, showErrors); } /** */ public de.peeeq.wurstscript.attributes.names.NameLink lookupVar(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupVar((GlobalVarDef)this, name, showErrors); } /** */ public de.peeeq.wurstscript.attributes.names.NameLink lookupVarNoConfig(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupVarNoConfig((GlobalVarDef)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((GlobalVarDef)this, receiverType, name, showErrors); } /** */ public com.google.common.collect.ImmutableCollection lookupFuncs(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupFuncs((GlobalVarDef)this, name, showErrors); } /** */ public com.google.common.collect.ImmutableCollection lookupFuncsNoConfig(String name, boolean showErrors) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupFuncsNoConfig((GlobalVarDef)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((GlobalVarDef)this, receiverType, name, showErrors); } /** */ public @org.eclipse.jdt.annotation.Nullable TypeDef lookupType(String name) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupTypeShort((GlobalVarDef)this, name); } /** */ public de.peeeq.wurstscript.attributes.names.PackageLink lookupPackage(String name) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupPackageShort((GlobalVarDef)this, name); } /** */ public de.peeeq.wurstscript.attributes.names.NameLink lookupVar(String name) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupVarShort((GlobalVarDef)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((GlobalVarDef)this, receiverType, name); } /** */ public com.google.common.collect.ImmutableCollection lookupFuncs(String name) { return de.peeeq.wurstscript.attributes.names.NameResolution.lookupFuncsShort((GlobalVarDef)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((GlobalVarDef)this, receiverType, name); } /** */ public String attrComment() { return de.peeeq.wurstscript.attributes.AttrWurstDoc.getComment((GlobalVarDef)this); } /** */ public com.google.common.collect.ImmutableCollection attrUsedPackages() { return de.peeeq.wurstscript.attributes.UsedPackages.usedPackages((GlobalVarDef)this); } /** */ public String description() { return de.peeeq.wurstscript.attributes.Description.description((GlobalVarDef)this); } /** */ public String descriptionHtml() { return de.peeeq.wurstscript.attributes.DescriptionHtml.description((GlobalVarDef)this); } /** */ public boolean isSubtreeOf(Element other) { return de.peeeq.wurstscript.attributes.SmallHelpers.isSubtreeOf((GlobalVarDef)this, other); } /** */ public void prettyPrint(de.peeeq.wurstscript.attributes.prettyPrint.Spacer spacer, StringBuilder sb, int indent) { de.peeeq.wurstscript.attributes.prettyPrint.PrettyPrinter.prettyPrint((GlobalVarDef)this, spacer, sb, indent); } /** */ public String getName() { return de.peeeq.wurstscript.attributes.SmallHelpers.getName((GlobalVarDef)this); } }