public override void OutAGenericType(AGenericType node) { if (!(node.GetBase() is ANamedType)) { errors.Add(new ErrorCollection.Error(node.GetToken(), LocRM.GetString("ErrorText44"))); return; } ANamedType Base = (ANamedType)node.GetBase(); if (!data.StructTypeLinks.ContainsKey(Base)) { errors.Add(new ErrorCollection.Error(node.GetToken(), LocRM.GetString("ErrorText44"))); return; } AStructDecl str = data.StructTypeLinks[Base]; if (str.GetGenericVars().Count != node.GetGenericTypes().Count) { errors.Add(new ErrorCollection.Error(node.GetToken(), LocRM.GetString("ErrorText45"), false, new ErrorCollection.Error(str.GetName(), LocRM.GetString("ErrorText46") + Util.GetTypeName(str)))); return; } LookForGenericVar finder = new LookForGenericVar(); foreach (PType genericType in node.GetGenericTypes()) { genericType.Apply(finder); if (finder.ContainsGenericVar || finder.ContainsNestedGenerics) { //if (finder.ContainsGenericVar) structsWithGenerics.Add(Util.GetAncestor <AStructDecl>(node)); if (finder.ContainsNestedGenerics) { if (!Util.HasAncestor <AStructDecl>(node) || Util.GetAncestor <AStructDecl>(node).GetGenericVars().Count == 0) { needAnotherPass = true; } } return; } } if (!Refferences.ContainsKey(str)) { Refferences[str] = new List <AGenericType>(); } Refferences[str].Add(node); base.OutAGenericType(node); }
public override void OutAGenericType(AGenericType node) { if (!(node.GetBase() is ANamedType)) { errors.Add(new ErrorCollection.Error(node.GetToken(), LocRM.GetString("ErrorText44"))); return; } ANamedType Base = (ANamedType) node.GetBase(); if (!data.StructTypeLinks.ContainsKey(Base)) { errors.Add(new ErrorCollection.Error(node.GetToken(), LocRM.GetString("ErrorText44"))); return; } AStructDecl str = data.StructTypeLinks[Base]; if (str.GetGenericVars().Count != node.GetGenericTypes().Count) { errors.Add(new ErrorCollection.Error(node.GetToken(), LocRM.GetString("ErrorText45"), false, new ErrorCollection.Error(str.GetName(), LocRM.GetString("ErrorText46") + Util.GetTypeName(str)))); return; } LookForGenericVar finder = new LookForGenericVar(); foreach (PType genericType in node.GetGenericTypes()) { genericType.Apply(finder); if (finder.ContainsGenericVar || finder.ContainsNestedGenerics) { //if (finder.ContainsGenericVar) structsWithGenerics.Add(Util.GetAncestor<AStructDecl>(node)); if (finder.ContainsNestedGenerics) { if (!Util.HasAncestor<AStructDecl>(node) || Util.GetAncestor<AStructDecl>(node).GetGenericVars().Count == 0) needAnotherPass = true; } return; } } if (!Refferences.ContainsKey(str)) Refferences[str] = new List<AGenericType>(); Refferences[str].Add(node); base.OutAGenericType(node); }