Esempio n. 1
0
        public T GetUnwrapType <T>()
            where T : NativeXAbstractType
        {
            NativeXAbstractType type = this.AbstractType;

            return(type == null ? null : type.Unwrap() as T);
        }
Esempio n. 2
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));
        }
    }