예제 #1
0
 private static void AppendMethodSymbolInfo(this ICollection<SymbolMarkupToken> markup, MethodSymbol symbol)
 {
     markup.AppendType(symbol.AssociatedType);
     markup.AppendSpace();
     markup.AppendName(SymbolMarkupKind.MethodName, symbol.Name);
     markup.AppendParameters(symbol.Parameters);
 }
예제 #2
0
 private static void AppendFunctionSymbolInfo(this ICollection<SymbolMarkupToken> markup, FunctionSymbol symbol)
 {
     markup.AppendType(symbol.ValueType);
     markup.AppendSpace();
     markup.AppendName(SymbolMarkupKind.FunctionName, symbol.Name);
     markup.AppendParameters(symbol.Parameters);
 }
예제 #3
0
        private static void AppendFunctionSymbolInfo(this ICollection<SymbolMarkupToken> markup, FunctionSymbol symbol)
        {
            markup.AppendType(symbol.ReturnType, false);
            markup.AppendSpace();

            if (symbol.Parent is TypeSymbol)
            {
                markup.AppendTypeName((TypeSymbol) symbol.Parent);
                markup.AppendPunctuation(".");
            }

            if (symbol.IsNumericConstructor)
                markup.AppendKeyword(symbol.Name);
            else
                markup.AppendName(SymbolMarkupKind.FunctionName, symbol.Name);

            markup.AppendParameters(symbol.Parameters);
        }
예제 #4
0
        private static void AppendParameters(this ICollection<SymbolMarkupToken> markup, ImmutableArray<ParameterSymbol> parameters)
        {
            markup.AppendPunctuation("(");

            var isFirst = true;
            foreach (var parameterSymbol in parameters)
            {
                if (isFirst)
                    isFirst = false;
                else
                {
                    markup.AppendPunctuation(",");
                    markup.AppendSpace();
                }

                markup.AppendParameterSymbolInfo(parameterSymbol);               
            }

            markup.AppendPunctuation(")");
        }
예제 #5
0
 private static void AppendParameterSymbolInfo(this ICollection<SymbolMarkupToken> markup, ParameterSymbol symbol)
 {
     markup.AppendType(symbol.ValueType);
     markup.AppendSpace();
     markup.AppendParameterName(symbol.Name);
 }
예제 #6
0
        private static void AppendNamespace(this ICollection<SymbolMarkupToken> markup, NamespaceSymbol symbol)
        {
            markup.AppendKeyword("namespace");
            markup.AppendSpace();

            if (symbol.Parent != null)
                markup.AppendParentScope(symbol.Parent);

            markup.AppendName(SymbolMarkupKind.NamespaceName, symbol.Name);
        }
예제 #7
0
        private static void AppendTypeAlias(this ICollection<SymbolMarkupToken> markup, TypeAliasSymbol symbol)
        {
            markup.AppendKeyword("typedef");
            markup.AppendSpace();

            markup.AppendType(symbol.ValueType, true);
            markup.AppendSpace();

            markup.AppendName(SymbolMarkupKind.GlobalVariableName, symbol.Name);
        }
예제 #8
0
        private static void AppendTechnique(this ICollection<SymbolMarkupToken> markup, TechniqueSymbol symbol)
        {
            markup.AppendKeyword("technique");
            markup.AppendSpace();

            markup.AppendName(SymbolMarkupKind.TechniqueName, symbol.Name);
        }
예제 #9
0
        private static void AppendConstantBuffer(this ICollection<SymbolMarkupToken> markup, ConstantBufferSymbol symbol)
        {
            markup.AppendPlainText("(constant buffer)");
            markup.AppendSpace();

            markup.AppendName(SymbolMarkupKind.ConstantBufferVariableName, symbol.Name);
        }
예제 #10
0
        private static void AppendSemantic(this ICollection<SymbolMarkupToken> markup, SemanticSymbol symbol)
        {
            markup.AppendPlainText("(semantic)");
            markup.AppendSpace();

            markup.AppendName(SymbolMarkupKind.SemanticName, symbol.Name);
        }
예제 #11
0
        private static void AppendTypeDeclaration(this ICollection<SymbolMarkupToken> markup, TypeSymbol symbol)
        {
            switch (symbol.Kind)
            {
                case SymbolKind.Class:
                    markup.AppendKeyword("class");
                    markup.AppendSpace();
                    break;
                case SymbolKind.Interface:
                    markup.AppendKeyword("interface");
                    markup.AppendSpace();
                    break;
                case SymbolKind.Struct:
                    markup.AppendKeyword("struct");
                    markup.AppendSpace();
                    break;
            }

            if (symbol.Parent != null)
                markup.AppendParentScope(symbol.Parent);

            markup.AppendTypeName(symbol);
        }
예제 #12
0
        private static void AppendVariableSymbolInfo(this ICollection<SymbolMarkupToken> markup, VariableSymbol symbol)
        {
            VariableType variableType;
            if (symbol.Parent == null)
                variableType = VariableType.Global;
            else if (symbol.Parent.Kind == SymbolKind.ConstantBuffer)
                variableType = VariableType.ConstantBuffer;
            else
                variableType = VariableType.Local;

            switch (variableType)
            {
                case VariableType.Local:
                    markup.AppendPlainText("(local variable)");
                    break;
                case VariableType.ConstantBuffer:
                    markup.AppendPlainText("(constant buffer variable)");
                    break;
                case VariableType.Global:
                    markup.AppendPlainText("(global variable)");
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            markup.AppendSpace();
            markup.AppendType(symbol.ValueType, true);
            markup.AppendSpace();

            switch (variableType)
            {
                case VariableType.Local:
                    markup.AppendName(SymbolMarkupKind.LocalVariableName, symbol.Name);
                    break;
                case VariableType.ConstantBuffer:
                    markup.AppendName(SymbolMarkupKind.ConstantBufferVariableName, symbol.Name);
                    break;
                case VariableType.Global:
                    markup.AppendName(SymbolMarkupKind.GlobalVariableName, symbol.Name);
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
예제 #13
0
 private static void AppendFieldSymbolInfo(this ICollection<SymbolMarkupToken> markup, FieldSymbol symbol)
 {
     markup.AppendPlainText("(field)");
     markup.AppendSpace();
     markup.AppendType(symbol.ValueType, true);
     markup.AppendSpace();
     markup.AppendType((TypeSymbol) symbol.Parent, false);
     markup.AppendPunctuation(".");
     markup.AppendName(SymbolMarkupKind.FieldName, symbol.Name);
 }
예제 #14
0
        private static void AppendParameterSymbolInfo(this ICollection<SymbolMarkupToken> markup, ParameterSymbol symbol, bool includeInfo)
        {
            if (includeInfo)
            {
                markup.AppendPlainText("(parameter)");
                markup.AppendSpace();
            }

            if (symbol.Direction == ParameterDirection.Inout)
            {
                markup.AppendKeyword("inout");
                markup.AppendSpace();
            }
            else if (symbol.Direction == ParameterDirection.Out)
            {
                markup.AppendKeyword("out");
                markup.AppendSpace();
            }

            markup.AppendType(symbol.ValueType, false);
            markup.AppendSpace();
            markup.AppendParameterName(symbol.Name);
        }