コード例 #1
0
        public T GetUnwrapType <T>()
            where T : NativeXAbstractType
        {
            NativeXAbstractType type = this.AbstractType;

            return(type == null ? null : type.Unwrap() as T);
        }
コード例 #2
0
        public override NativeXAbstractType Instanciate(List <Tuple <string, NativeXAbstractType> > arguments)
        {
            NativeXAbstractType type = this.Unwrap();

            if (type == null || type == this)
            {
                return(this);
            }
            else
            {
                return(type.Instanciate(arguments));
            }
        }
コード例 #3
0
        public override NativeXAbstractType Unwrap(List <string> unwrappedReferences)
        {
            CodeScope scope = this.Scope;
            string    name  = this.ReferenceName;

            while (true)
            {
                if (scope == null || name == null || unwrappedReferences.Contains(name))
                {
                    break;
                }
                unwrappedReferences.Add(name);
                CodeNode node = this.Scope.Find(name);

                NativeXTypeRenameDeclaration typeRenameDeclaration = node as NativeXTypeRenameDeclaration;
                if (typeRenameDeclaration != null)
                {
                    NativeXAbstractReferenceType reference = typeRenameDeclaration.AbstractType as NativeXAbstractReferenceType;
                    if (reference != null)
                    {
                        scope = reference.Scope;
                        name  = reference.ReferenceName;
                    }
                }

                NativeXDeclaration declaration = node as NativeXDeclaration;
                if (declaration != null)
                {
                    NativeXAbstractType type = declaration.AbstractType;
                    return(type == null ? null : type.Unwrap(unwrappedReferences));
                }

                NativeXGenericParameter genericParameter = node as NativeXGenericParameter;
                if (genericParameter != null && genericParameter.ParameterName != null)
                {
                    return new NativeXAbstractGenericParameterType()
                           {
                               ParameterName = genericParameter.ParameterName
                           }
                }
                ;
            }
            return(base.Unwrap(unwrappedReferences));
        }
    }
コード例 #4
0
 protected virtual NativeXAbstractType WrapGeneric(NativeXAbstractType type)
 {
     if (type == null)
     {
         return(null);
     }
     else if (this.GenericParameters == null)
     {
         return(type);
     }
     else
     {
         NativeXAbstractGenericType generic = new NativeXAbstractGenericType();
         generic.ElementType = type;
         foreach (var p in this.GenericParameters)
         {
             if (p.ParameterName != null)
             {
                 generic.GenericParameters.Add(p.ParameterName);
             }
         }
         return(generic);
     }
 }