/// <summary> /// The following constructor is suitable for recognized attributes. /// </summary> private IdRegion(Bpl.IToken from, Bpl.IToken thru, OccurrenceKind occurrenceKind) { this.Start = from.pos; this.Length = thru.pos + thru.val.Length - from.pos; this.Kind = occurrenceKind; this.HoverText = null; }
private IdRegion(Bpl.IToken tok, OccurrenceKind occurrenceKind, string info, int length) { this.Start = tok.pos; this.Length = length; this.Kind = occurrenceKind; this.HoverText = info; }
private IdRegion(Bpl.IToken tok, IVariable v, bool isDefinition, string kind, ICallable callableContext, ModuleDefinition context) { Contract.Requires(tok != null); Contract.Requires(v != null); Start = tok.pos; Length = v.DisplayName.Length; if (kind == null) { // use default if (v is LocalVariable) { kind = "local variable"; } else if (v is BoundVar) { kind = "bound variable"; } else { var formal = (Formal)v; kind = formal.InParam ? "in-parameter" : "out-parameter"; if (callableContext is TwoStateLemma && !formal.IsOld) { kind = "new " + kind; } if (formal is ImplicitFormal) { kind = "implicit " + kind; } } } Variable = v; HoverText = string.Format("({2}{3}) {0}: {1}", v.DisplayName, v.Type.TypeName(context), v.IsGhost ? "ghost " : "", kind); Kind = !isDefinition ? OccurrenceKind.Use : LocalVariable.HasWildcardName(v) ? OccurrenceKind.WildDefinition : OccurrenceKind.Definition; }
public int GetPriority(OccurrenceKind occurrenceKind) { if (occurrenceKind == UnityYamlSpecificOccurrenceKinds.EventHandler) { return(-10); } return(0); }
public IconId GetImageId(OccurrenceKind declaredElement) { // TODO: Better icon? if (declaredElement == UnityAssetSpecificOccurrenceKinds.EventHandler) { return(ServicesNavigationThemedIcons.UsageEventDeclaration.Id); } return(null); }
public int GetPriority(OccurrenceKind occurrenceKind) { if (occurrenceKind == UnityAssetSpecificOccurrenceKinds.EventHandler || occurrenceKind == UnityAssetSpecificOccurrenceKinds.ComponentUsage || occurrenceKind == UnityAssetSpecificOccurrenceKinds.InspectorUsage) { return(-10); } return(0); }
private IdRegion(Bpl.IToken tok, Field decl, Microsoft.Dafny.Type showType, string kind, bool isDefinition, ModuleDefinition context) { Contract.Requires(tok != null); Contract.Requires(decl != null); Contract.Requires(kind != null); if (showType == null) { showType = decl.Type; } Start = tok.pos; Length = decl.Name.Length; HoverText = string.Format("({4}{2}{3}) {0}: {1}", decl.FullNameInContext(context), showType.TypeName(context), decl.IsGhost ? "ghost " : "", kind, decl.IsUserMutable || decl is DatatypeDestructor ? "" : decl.IsMutable ? " non-assignable " : "immutable "); Kind = !isDefinition ? OccurrenceKind.Use : OccurrenceKind.Definition; }
private IdRegion(Bpl.IToken tok, Field decl, Microsoft.Dafny.Type showType, string kind, bool isDefinition, ModuleDefinition context) { Contract.Requires(tok != null); Contract.Requires(decl != null); Contract.Requires(kind != null); if (showType == null) { showType = decl.Type; } Start = tok.pos; Length = decl.Name.Length; var name = decl.EnclosingClass != null && !(decl.EnclosingClass is DefaultClassDecl) ? decl.FullNameInContext(context) : decl.Name; // some built-in members like "Keys" may not have an .EnclosingClass HoverText = string.Format("({4}{2}{3}) {0}: {1}", name, showType.TypeName(context), decl.IsGhost ? "ghost " : "", kind, decl.IsUserMutable || decl is ConstantField || decl is DatatypeDestructor ? "" : decl.IsMutable ? " non-assignable " : "immutable "); Kind = !isDefinition ? OccurrenceKind.Use : OccurrenceKind.Definition; }