Microsoft.JScript.Class.GetSuperTypeMembers C# (CSharp) Method

GetSuperTypeMembers() private method

private GetSuperTypeMembers ( ) : void
return void
      private void GetSuperTypeMembers(){
        SuperTypeMembersSorter sorter = new SuperTypeMembersSorter();
        IReflect ir = this.superIR;
        //Add members on superclasses
        while (ir != null){
          sorter.Add(ir.GetMembers(BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance|BindingFlags.Static|BindingFlags.DeclaredOnly));
          if (ir is Type){
            ir = ((Type)ir).BaseType;
          }else{
            ir = ((ClassScope)ir).GetSuperType();
          }
        }
        //Add any implicit interfaces to the end of the explicit list of interfaces
        ArrayList implicitInterfaces = new ArrayList();
        int n = this.interfaces.Length;
        IReflect[] explicitInterfaces = new IReflect[n];
        for (int i = 0; i < n; i++){
          IReflect iface = explicitInterfaces[i] = this.interfaces[i].ToIReflect();
          Type t = iface as Type;
          bool isInterface;
          if (t != null) 
            isInterface = t.IsInterface;
          else{
            ClassScope csc = (ClassScope)iface;
            isInterface = csc.owner.isInterface;
          }
          if (!isInterface) this.interfaces[i].context.HandleError(JSError.NeedInterface);
        }
        foreach (IReflect iface in explicitInterfaces)
          this.AddImplicitInterfaces(iface, explicitInterfaces, implicitInterfaces);
        for (int i = 0; i < implicitInterfaces.Count; i++){
          IReflect iface = (IReflect)implicitInterfaces[i];
          this.AddImplicitInterfaces(iface, explicitInterfaces, implicitInterfaces);
        }
        int m = implicitInterfaces.Count;
        if (m > 0){
          TypeExpression[] newInterfaces = new TypeExpression[n + m];
          for (int i = 0; i < n; i++) newInterfaces[i] = this.interfaces[i];
          for (int i = 0; i < m; i++) newInterfaces[i+n] = new TypeExpression(new ConstantWrapper(implicitInterfaces[i], null));
          this.interfaces = newInterfaces;
        }
        //Add members on interfaces implemented by the class. Also check for circular definition;
        foreach (TypeExpression ifaceExpr in this.interfaces){
          ClassScope ifcsc = ifaceExpr.ToIReflect() as ClassScope;
          if (ifcsc != null && ifcsc.owner.ImplementsInterface(this.classob)){
            this.context.HandleError(JSError.CircularDefinition);
            this.interfaces = new TypeExpression[0];
            break;
          }
          sorter.Add(ifaceExpr.ToIReflect().GetMembers(BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance));
        }
        //Add unimplemented members on interfaces implemented by abstract superclasses
        ir = this.superIR;
        while (ir != null){
          Type type = ir as Type;
          if (type != null){
            if (!type.IsAbstract) break;
            Class.GetUnimplementedInferfaceMembersFor(type, sorter);
            ir = type.BaseType;
          }else{
            ClassScope csc = (ClassScope)ir;
            if (!csc.owner.isAbstract) break;
            csc.owner.GetUnimplementedInferfaceMembers(sorter);
            ir = null;
          }
        }
        this.superMembers = sorter.GetMembers();
      }