コード例 #1
0
        /// <summary>
        /// Looks for external types in the current compilation
        /// </summary>
        private void FindExternalTypes()
        {
            INamedTypeSymbol exterTypeExtrAttr = Compilation.GetTypeByMetadataName(typeof(ExternalScriptObjectAttribute).FullName);

            foreach (AttributeData attrData in Compilation.Assembly.GetAttributes())
            {
                if (attrData.AttributeClass.Equals(exterTypeExtrAttr))
                {
                    TypedConstant typeParamsArg = attrData.ConstructorArguments[0];

                    foreach (TypedConstant oneTypeArg in typeParamsArg.Values)
                    {
                        INamedTypeSymbol type = oneTypeArg.Value as INamedTypeSymbol;

                        ParseContext context   = new ParseContext(Compilation, GetDocumentationProvider(type), _options);
                        INamedType   namedType = RoslynType.CreateNamedType(type, context);
                        _visitor.VisitExternalType(namedType);
                    }
                }
            }
        }