コード例 #1
0
 private static void __Execute(atom.Trace context, int level, EnumDeclarationSyntax data, string file, bool isShowPrivate)
 {
     if (__IsEnabled(data, isShowPrivate))
     {
         context.
         SetComment(__GetType(data, "enum"), HINT.DATA_TYPE).
         SetUrl(file, __GetLine(data.GetLocation()), __GetPosition(data.GetLocation())).
         Send(NAME.SOURCE.PREVIEW, NAME.TYPE.CLASS, level, __GetName(data, true));
         foreach (var a_Context in data.Members.OfType <EnumMemberDeclarationSyntax>())
         {
             __Execute(context, level + 1, a_Context, file, isShowPrivate);
         }
     }
 }
コード例 #2
0
        public override void VisitEnumDeclaration(EnumDeclarationSyntax node)
        {
            var enumSymbol = GetDeclaredSymbol(node) as INamedTypeSymbol;

            var intType = FindType(typeof(int));
            // Load the underlying type of the enum
            var baseType = mFrontEnd.mCurrentLibrary.FindType(new TypeKey(enumSymbol.EnumUnderlyingType));

            // Currently only integers are supported for enums. @JoshD: To do
            if (intType != baseType)
            {
                var msg = string.Format("Enum {0} has a base type of {1}. Enums currently only support a base type of integer.", enumSymbol.Name, enumSymbol.EnumUnderlyingType.Name);
                mFrontEnd.CurrentProject.SendTranslationError(new ShaderCodeLocation(node.GetLocation()), msg);
                baseType = intType;
            }

            var attributes = mFrontEnd.ParseAttributes(enumSymbol);
            // Clone the integer's type data (width and signedness)
            var shaderType = CreateShaderType(enumSymbol, attributes);

            shaderType.mBaseType = baseType.mBaseType;
            shaderType.mParameters.Add(baseType.mParameters[0]);
            shaderType.mParameters.Add(baseType.mParameters[1]);

            shaderType.mMeta.mAttributes = attributes;
            ExtractDebugInfo(shaderType, enumSymbol, node);
        }
コード例 #3
0
        public override void VisitEnumDeclaration(EnumDeclarationSyntax node)
        {
            AddEntry(node.Identifier.Text, node.GetLocation());

            base.VisitEnumDeclaration(node);;
        }