コード例 #1
0
 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);
 }
コード例 #2
0
 public override void CaseAGenericType(AGenericType node)
 {
     InAGenericType(node);
     {
         Object[] temp = new Object[node.GetGenericTypes().Count];
         node.GetGenericTypes().CopyTo(temp, 0);
         for (int i = temp.Length - 1; i >= 0; i--)
         {
             ((PType)temp[i]).Apply(this);
         }
     }
     if (node.GetBase() != null)
     {
         node.GetBase().Apply(this);
     }
     if (node.GetToken() != null)
     {
         node.GetToken().Apply(this);
     }
     OutAGenericType(node);
 }