コード例 #1
0
        protected override void AddLiteralValue(SpecialType type, object value)
        {
            Debug.Assert(value.GetType().GetTypeInfo().IsPrimitive || value is string || value is decimal);
            var valueString = SymbolDisplay.FormatPrimitive(value, quoteStrings: true, useHexadecimalNumbers: false);

            Debug.Assert(valueString != null);

            var kind = SymbolDisplayPartKind.NumericLiteral;

            switch (type)
            {
            case SpecialType.System_Boolean:
                kind = SymbolDisplayPartKind.Keyword;
                break;

            case SpecialType.System_String:
            case SpecialType.System_Rune:
                kind = SymbolDisplayPartKind.StringLiteral;
                break;
            }

            this.builder.Add(CreatePart(kind, null, valueString));
        }