Exemplo n.º 1
0
 void StartKeywordBlock(ITextOutput output, string keyword, IMemberDef member)
 {
     output.Write(keyword, TextTokenKind.Keyword);
     output.WriteSpace();
     output.WriteDefinition(IdentifierEscaper.Escape(member.Name), member, TextTokenKindUtils.GetTextTokenType(member), false);
     output.WriteSpace();
     output.WriteLeftBrace();
     output.WriteLine();
     output.Indent();
 }
Exemplo n.º 2
0
 public void OpenBrace(BraceStyle style, out TextPosition?start, out TextPosition?end)
 {
     if (braceLevelWithinType >= 0 || nodeStack.Peek() is TypeDeclaration)
     {
         braceLevelWithinType++;
     }
     output.WriteLine();
     start = output.Location;
     output.WriteLeftBrace();
     end = output.Location;
     output.WriteLine();
     output.Indent();
 }
Exemplo n.º 3
0
        protected void WriteHiddenStart(ITextOutput output, MemberMapping memberMapping, IEnumerable <ILRange> extraIlRanges = null)
        {
            var location = output.Location;

            output.WriteLeftBrace();
            var ilr = new List <ILRange>(ILRanges);

            if (extraIlRanges != null)
            {
                ilr.AddRange(extraIlRanges);
            }
            UpdateMemberMapping(memberMapping, location, output.Location, ilr);
            output.WriteLine();
            output.Indent();
        }
Exemplo n.º 4
0
 public void OpenBrace(BraceStyle style, out TextLocation?start, out TextLocation?end)
 {
     if (braceLevelWithinType >= 0 || nodeStack.Peek() is TypeDeclaration)
     {
         braceLevelWithinType++;
     }
     if (nodeStack.OfType <BlockStatement>().Count() <= 1)
     {
         output.MarkFoldStart(defaultCollapsed: braceLevelWithinType == 1);
     }
     output.WriteLine();
     start = output.Location;
     output.WriteLeftBrace();
     end = output.Location;
     output.WriteLine();
     output.Indent();
 }
Exemplo n.º 5
0
		void StartKeywordBlock(ITextOutput output, string keyword, IMemberDef member)
		{
			output.Write(keyword, TextTokenType.Keyword);
			output.WriteSpace();
			output.WriteDefinition(IdentifierEscaper.Escape(member.Name), member, TextTokenHelper.GetTextTokenType(member), false);
			output.WriteSpace();
			output.WriteLeftBrace();
			output.WriteLine();
			output.Indent();
		}
Exemplo n.º 6
0
        void WriteToolTip(ITextOutput output, PropertyDef prop)
        {
            var sig = prop.PropertySig;
            var md = prop.GetMethods.FirstOrDefault() ??
                    prop.SetMethods.FirstOrDefault() ??
                    prop.OtherMethods.FirstOrDefault();

            var writer = new MethodWriter(this, output, md);
            writer.WriteReturnType();
            WriteToolTip(output, prop.DeclaringType);
            output.Write('.', TextTokenType.Operator);
            var ovrMeth = md == null || md.Overrides.Count == 0 ? null : md.Overrides[0].MethodDeclaration;
            if (prop.IsIndexer()) {
                if (ovrMeth != null) {
                    WriteToolTipType(output, ovrMeth.DeclaringType, false);
                    output.Write('.', TextTokenType.Operator);
                }
                output.Write("this", TextTokenType.Keyword);
                writer.WriteGenericArguments();
                writer.WriteMethodParameterList('[', ']');
            }
            else if (ovrMeth != null && GetPropName(ovrMeth) != null) {
                WriteToolTipType(output, ovrMeth.DeclaringType, false);
                output.Write('.', TextTokenType.Operator);
                output.Write(IdentifierEscaper.Escape(GetPropName(ovrMeth)), TextTokenHelper.GetTextTokenType(prop));
            }
            else
                output.Write(IdentifierEscaper.Escape(prop.Name), TextTokenHelper.GetTextTokenType(prop));

            output.WriteSpace();
            output.WriteLeftBrace();
            if (prop.GetMethods.Count > 0) {
                output.WriteSpace();
                output.Write("get", TextTokenType.Keyword);
                output.Write(';', TextTokenType.Operator);
            }
            if (prop.SetMethods.Count > 0) {
                output.WriteSpace();
                output.Write("set", TextTokenType.Keyword);
                output.Write(';', TextTokenType.Operator);
            }
            output.WriteSpace();
            output.WriteRightBrace();
        }