示例#1
0
        protected virtual object GetParent()
        {
            var symbol = LookupSymbol();

            if (symbol.Kind == SymbolKind.Namespace && ((INamespaceSymbol)symbol).IsGlobalNamespace)
            {
                // TODO: We should be returning the RootCodeModel object here.
                throw new NotImplementedException();
            }

            if (symbol.ContainingType != null)
            {
                return(CodeModelService.CreateCodeType(
                           this.State,
                           this.ProjectId,
                           symbol.ContainingType
                           ));
            }
            else if (symbol.ContainingNamespace != null)
            {
                return(CodeModelService.CreateExternalCodeElement(
                           this.State,
                           this.ProjectId,
                           symbol.ContainingNamespace
                           ));
            }

            throw Exceptions.ThrowEFail();
        }