GetTypeIfAttributeHasToBeUnique() private method

private GetTypeIfAttributeHasToBeUnique ( ) : Object
return Object
Beispiel #1
0
 internal override AST PartiallyEvaluate()
 {
     if (this.alreadyPartiallyEvaluated)
     {
         return(this);
     }
     this.alreadyPartiallyEvaluated = true;
     for (int i = 0, n = this.list.Count; i < n; i++)
     {
         this.list[i] = ((CustomAttribute)this.list[i]).PartiallyEvaluate();
     }
     for (int i = 0, n = this.list.Count; i < n; i++)
     {
         CustomAttribute ca = (CustomAttribute)this.list[i];
         if (ca == null)
         {
             continue;     //Already found to be invalid
         }
         Object caType = ca.GetTypeIfAttributeHasToBeUnique();
         if (caType == null)
         {
             continue;
         }
         for (int j = i + 1; j < n; j++)
         {
             CustomAttribute caj = (CustomAttribute)this.list[j];
             if (caj == null)
             {
                 continue;
             }
             if (caType == caj.type)
             {
                 caj.context.HandleError(JSError.CustomAttributeUsedMoreThanOnce);
                 this.list[j] = null; //Remove duplicate
             }
         }
     }
     return(this);
 }
 internal override AST PartiallyEvaluate()
 {
     if (!this.alreadyPartiallyEvaluated)
     {
         this.alreadyPartiallyEvaluated = true;
         int num   = 0;
         int count = this.list.Count;
         while (num < count)
         {
             this.list[num] = ((CustomAttribute)this.list[num]).PartiallyEvaluate();
             num++;
         }
         int num3 = 0;
         int num4 = this.list.Count;
         while (num3 < num4)
         {
             CustomAttribute attribute = (CustomAttribute)this.list[num3];
             if (attribute != null)
             {
                 object typeIfAttributeHasToBeUnique = attribute.GetTypeIfAttributeHasToBeUnique();
                 if (typeIfAttributeHasToBeUnique != null)
                 {
                     for (int i = num3 + 1; i < num4; i++)
                     {
                         CustomAttribute attribute2 = (CustomAttribute)this.list[i];
                         if ((attribute2 != null) && (typeIfAttributeHasToBeUnique == attribute2.type))
                         {
                             attribute2.context.HandleError(JSError.CustomAttributeUsedMoreThanOnce);
                             this.list[i] = null;
                         }
                     }
                 }
             }
             num3++;
         }
     }
     return(this);
 }