public static int GetGlyph(TopDeclaration decl) { if (decl == null) { return(-1); } NemerleAttributes attrs = decl.Attributes; GlyphType kind = decl is TopDeclaration.Delegate ? GlyphType.Delegate : decl is TopDeclaration.Enum ? GlyphType.Enum : decl is TopDeclaration.Interface ? GlyphType.Interface : decl is TopDeclaration.Macro ? GlyphType.Macro : decl is TopDeclaration.Variant ? GlyphType.Variant : decl is TopDeclaration.VariantOption ? GlyphType.VariantOption : Has(attrs, NemerleAttributes.Struct) ? GlyphType.Struct : GlyphType.Class; GlyphSubtype modifier = Has(attrs, NemerleAttributes.Internal | NemerleAttributes.Protected) ? GlyphSubtype.ProtectedInternal : Has(attrs, NemerleAttributes.Internal) ? GlyphSubtype.Internal : Has(attrs, NemerleAttributes.Protected) ? GlyphSubtype.Protected : Has(attrs, NemerleAttributes.Public) ? GlyphSubtype.Public : Has(attrs, NemerleAttributes.Private) ? GlyphSubtype.Private : decl is TopDeclaration.VariantOption ? GlyphSubtype.Public : GlyphSubtype.Private; return((int)kind + (int)modifier); }
public static ClassMember[] GetMembers(this TopDeclaration decl) { var members = Nemerle.Compiler.Utils.AstUtils.GetMembers(decl).ToArray(); // Sort by name (like in C#). Array.Sort(members, (m1, m2) => string.Compare(m1.Name, m2.Name)); return(members); }
private string GetLable(TopDeclaration topDeclaration) { if (topDeclaration == null) { return(""); } return(topDeclaration.Name + " (" + topDeclaration.GetLabel() + ")"); }
internal void AddMethod( TopDeclaration topDeclaration, CodeMemberMethod codeMemberMethod, CodeTypeDeclaration declaration) { string text = FormCodeDomGenerator.ToString(codeMemberMethod, declaration); var loc = topDeclaration.BodyCloseTokenLocation.FromStart(); codeMemberMethod.UserData[typeof(Point)] = new Point(loc.Column, loc.Line + 3 /*+ _identInfo.Length*/); Add(topDeclaration.Location, loc, text); }
public static string GetLabel(this TopDeclaration decl) { if (decl.DefinedIn != null) { var name = GetLabel(decl.DefinedIn) + "." + decl.Name; return(name); } else { var ns = decl.name.GetName().context.CurrentNamespace.FullName.Join("."); return(ns.IsNullOrEmpty() ? decl.Name : ns + "." + decl.Name); } }
int GetSelectedTypeIndex(int line, int col) { int idx = -1; TopDeclaration lastMember = null; for (int i = 0; i < _dropDownTypes.Length; i++) { var member = _dropDownTypes[i]; if (member.Location.Contains(line, col)) { if (lastMember == null || member.Location.IsNestedIn(lastMember.Location)) { idx = i; lastMember = member; } } } return(idx); }
private uint GetAttributes(TopDeclaration topDeclaration) { uint attr = (uint)DROPDOWNFONTATTR.FONTATTR_PLAIN; //TODO: Implement it if (topDeclaration == null) { return(attr); } if ((topDeclaration.Attributes & NemerleModifiers.Static) != 0) { attr |= (uint)DROPDOWNFONTATTR.FONTATTR_ITALIC; } if (topDeclaration is TopDeclaration.VariantOption) { attr |= (uint)DROPDOWNFONTATTR.FONTATTR_BOLD; } return(attr); }
private string GetLable(TopDeclaration topDeclaration) { if (topDeclaration == null) return ""; return topDeclaration.Name + " (" + topDeclaration.GetLabel() + ")"; }
private uint GetAttributes(TopDeclaration topDeclaration) { uint attr = (uint)DROPDOWNFONTATTR.FONTATTR_PLAIN; //TODO: Implement it if (topDeclaration == null) return attr; if ((topDeclaration.Attributes & NemerleModifiers.Static) != 0) attr |= (uint)DROPDOWNFONTATTR.FONTATTR_ITALIC; if (topDeclaration is TopDeclaration.VariantOption) attr |= (uint)DROPDOWNFONTATTR.FONTATTR_BOLD; return attr; }
internal void AddMethod( TopDeclaration topDeclaration, CodeMemberMethod codeMemberMethod, CodeTypeDeclaration declaration) { string text = FormCodeDomGenerator.ToString(codeMemberMethod, declaration); var loc = topDeclaration.BodyCloseTokenLocation.FromStart(); codeMemberMethod.UserData[typeof(Point)] = new Point(loc.Column, loc.Line + 3/*+ _identInfo.Length*/); Add(topDeclaration.Location, loc, text); }
internal void AddField(TopDeclaration topDeclaration, CodeMemberField codeMemberField) { string text = FormCodeDomGenerator.ToString(codeMemberField); Add(topDeclaration.Location, topDeclaration.BodyCloseTokenLocation.FromStart(), text); }
internal void AddField(TopDeclaration topDeclaration, CodeMemberField codeMemberField) { string text = FormCodeDomGenerator.ToString(codeMemberField); Add(topDeclaration.Location, topDeclaration.BodyCloseTokenLocation.FromStart(), text); }