public static CodeBlockNode Block(ScopeKind scopeKind, params NodeBase[] stmts) { return(new CodeBlockNode(scopeKind) { Statements = stmts.ToList() }); }
public ScopeStatement(uint start, uint end, ScopeKind kind, Token op, Token[] names, Token[] commas) : base(start, end) { Scope = kind; Operator = op; Names = names; Separators = commas; }
public NameSuggestionPostfixLookupItem( [NotNull] PostfixTemplateAcceptanceContext context, [NotNull] string shortcut, [NotNull] string replaceTemplate, [NotNull] ICSharpExpression expression, PluralityKinds pluralityKinds = PluralityKinds.Single, ScopeKind scopeKind = ScopeKind.Common) : base(context, shortcut, replaceTemplate) { mySolution = expression.GetSolution(); myNames = SuggestNamesFromExpression(expression, pluralityKinds, scopeKind); }
public Scope(ScopeKind kind, SyntaxNode?node, IScopeInternal?parent) { Kind = kind; Node = node; Parent = parent; DeclaredVariables = SpecializedCollections.ReadOnlyEnumerable(_declaredVariables); ReferencedVariables = SpecializedCollections.ReadOnlyEnumerable(_referencedVariables); GotoLabels = SpecializedCollections.ReadOnlyEnumerable(_labels.Values); }
public List<InstrumentHistory> FindInstrumentHistoriesBy(DateTime startDate, DateTime endDate, ScopeKind scope) { using (var session = NHibernateHelper.OpenSession()) { return (List<InstrumentHistory>)session .CreateCriteria(typeof(InstrumentHistory)) .Add(Restrictions.Between("DateStamp", startDate, endDate)) .Add(Restrictions.Eq("Scope", scope)) .SetFetchMode("Instrument", FetchMode.Eager) .List<InstrumentHistory>(); } }
public ScopeDesc(string name, AIMood mood) { this.Name = name; this.ScopeKind = ScopeKind.Global; this.UnitRole = UnitRole.Undefined; this.AIPersonality = AIPersonality.Undefined; this.AISkillID = AISkillID.Undefined; this.Mood = mood; privateFactionValue = FactionEnumeration.GetInvalidUnsetFactionValue(); FactionID = privateFactionValue.Name; }
public ScopeDesc(string name, AIMood mood, FactionValue faction) : this(name, mood) { if (faction == null) { faction = FactionEnumeration.GetInvalidUnsetFactionValue(); } privateFactionValue = faction; FactionID = privateFactionValue.Name; this.ScopeKind = ScopeKind.Faction; }
public List<InstrumentHistory> FindInstrumentHistoriesBy(Guid instrumentId, DateTime startDate, DateTime endDate, ScopeKind scope) { using (var session = NHibernateHelper.OpenSession()) { return (List<InstrumentHistory>) session .CreateCriteria(typeof(InstrumentHistory)) .CreateAlias("Instrument", "Instrument") .Add(Restrictions.Between("DateStamp", startDate, endDate)) .Add(Restrictions.Eq("Scope", scope)) .Add(Restrictions.Eq("Instrument.Id", instrumentId)) .List<InstrumentHistory>(); } }
/// <summary> /// Attempts to find the outermost scope of the provided kind (or a more generic one). /// </summary> /// <param name="node">The node to search from.</param> /// <param name="kind">The kind to search for.</param> /// <returns></returns> /// <remarks> /// <para> /// If the tree that contains the provided node does not have a <see cref="Syntax.CompilationUnitSyntax"/>, statements on the file /// root <b>will not have a scope</b>. /// </para> /// <para>The kind parameter searches for a scope of the provided kind or a more generic one as in the following list:</para> /// <list type="bullet"> /// <item> /// <description> /// <see cref="ScopeKind.Block"/> searches for: <see cref="ScopeKind.Block"/>, /// <see cref="ScopeKind.Function"/>, <see cref="ScopeKind.File"/>, <see cref="ScopeKind.Global"/>. /// </description> /// </item> /// <item> /// <description> /// <see cref="ScopeKind.Function"/> searches for: <see cref="ScopeKind.Function"/>, /// <see cref="ScopeKind.File"/>, <see cref="ScopeKind.Global"/>. /// </description> /// </item> /// <item> /// <description> /// <see cref="ScopeKind.File"/> searches for: <see cref="ScopeKind.File"/>, <see cref="ScopeKind.Global"/>. /// </description> /// </item> /// <item> /// <description><see cref="ScopeKind.Global"/> searches for itself.</description> /// </item> /// </list> /// </remarks> public IScope?FindScope(SyntaxNode node, ScopeKind kind = ScopeKind.Block) { var scopes = _scopeAndVariableManager.GetLazyState().Scopes; foreach (var ancestor in node.AncestorsAndSelf()) { if (scopes.TryGetValue(ancestor, out var scope) && scope.Kind <= kind) { return(scope); } } return(null); }
/// <summary> /// Get a sortable numeric value corresponding to a scope. Lower /// numbers cause the binding to be considered first /// </summary> private int GetScopeOrder(ScopeKind scope) { switch (scope) { case ScopeKind.TextEditor: return(1); case ScopeKind.Global: return(2); default: throw new InvalidOperationException("Unexpected ScopeKind"); } }
public static IList<string> SuggestNamesFromExpression([NotNull] ICSharpExpression expression, PluralityKinds kind = PluralityKinds.Single, ScopeKind scopeKind = ScopeKind.Common) { var suggestionManager = expression.GetPsiServices().Naming.Suggestion; var sourceFile = expression.GetSourceFile(); if (sourceFile == null) return new[] {"foo"}; var collection = suggestionManager.CreateEmptyCollection( PluralityKinds.Single, CSharpLanguage.Instance, false, sourceFile); collection.Add(expression, new EntryOptions { SubrootPolicy = SubrootPolicy.Decompose, PluralityKind = kind }); collection.Prepare(NamedElementKinds.Locals, scopeKind, new SuggestionOptions { DefaultName = "x", UniqueNameContext = expression }); return collection.AllNames(); }
private void VisitInScope(SyntaxNode node, ScopeKind kind) { if (node == null) { return; } var oldScopeKind = _binder._scopeKind; _binder._scopeKind = kind; try { node.Accept(this); } finally { _binder._scopeKind = oldScopeKind; } }
public Scope(Scope parent, Log log, ScopeKind kind) { this.parent = parent; this.kind = kind; this.log = log; }
public void setTargetScope(ScopeKind newValue) { throw new NotImplementedException(); }
public List <InstrumentHistory> FindInstrumentHistoriesBy(DateTime startDate, DateTime endDate, ScopeKind scope) { using (var session = NHibernateHelper.OpenSession()) { return((List <InstrumentHistory>)session .CreateCriteria(typeof(InstrumentHistory)) .Add(Restrictions.Between("DateStamp", startDate, endDate)) .Add(Restrictions.Eq("Scope", scope)) .SetFetchMode("Instrument", FetchMode.Eager) .List <InstrumentHistory>()); } }
public void Script_FindVariable_ReturnsVariableWhenVariableIsAvailable(ScopeKind scopeKind, string name) { SetupScript(out var innerMostScope); Assert.NotNull(innerMostScope.FindVariable(name, scopeKind)); }
public List <InstrumentHistory> FindInstrumentHistoriesBy(Guid instrumentId, DateTime startDate, DateTime endDate, ScopeKind scope) { using (var session = NHibernateHelper.OpenSession()) { return((List <InstrumentHistory>)session .CreateCriteria(typeof(InstrumentHistory)) .CreateAlias("Instrument", "Instrument") .Add(Restrictions.Between("DateStamp", startDate, endDate)) .Add(Restrictions.Eq("Scope", scope)) .Add(Restrictions.Eq("Instrument.Id", instrumentId)) .List <InstrumentHistory>()); } }
internal FallbackCommand(ScopeKind scopeKind, KeyBinding keyBinding, CommandId command) { _scopeKind = scopeKind; _keyBinding = keyBinding.KeyStrokes.Select(KeyCharModifier.Create).ToList(); _command = command; }
public Scope(Scope parent, ScopeKind kind) : this(parent, parent.GlobalScope, kind) { }
public Scope(ScopeKind kind, Scope parent = null) { Kind = kind; Parent = parent; }
public ScopeDesc(string name, AIMood mood, AISkillID aiSkillID) : this(name, mood) { this.AISkillID = aiSkillID; this.ScopeKind = ScopeKind.SkillBased; }
public ScopeDesc(string name, AIMood mood, AIPersonality aiPersonality) : this(name, mood) { this.AIPersonality = aiPersonality; this.ScopeKind = ScopeKind.Personality; }
/// <summary> /// Pushes a new <see cref="Scope"/> to be the current <see cref="Scope"/>. /// </summary> /// <param name="scopeTag">The <see cref="ScopeKind"/> of the new <see cref="Scope"/>.</param> public void PushScope(ScopeKind scopeKind) => CurrentScope = new Scope(scopeKind, CurrentScope);
public ScopeDesc(string name, AIMood mood, UnitRole unitRole) : this(name, mood) { this.UnitRole = unitRole; this.ScopeKind = ScopeKind.UnitRole; }
public Scope(ScopeKind kind, Scope?parent) => (Kind, Parent, Locals, Autos) = (kind, parent, new(), new());
public Scope(ScopeKind kind) { this.kind = kind; symbols = new LinkedList <SymbolEntry>(); tags = new LinkedList <TagEntry>(); }
public ScopeEntry(string name, ScopeKind kind) { Name = name; Kind = kind; ChildCount = 0; }
/// <summary> /// Get a sortable numeric value corresponding to a scope. Lower /// numbers cause the binding to be considered first /// </summary> private int GetScopeOrder(ScopeKind scope) { switch (scope) { case ScopeKind.TextEditor: return 1; case ScopeKind.Global: return 2; default: throw new InvalidOperationException("Unexpected ScopeKind"); } }
public CoreFeatureImpl() { ownerScope = ScopeKindEnum.SK_INSTANCE; }
public Scope(Scope?parent, GlobalScope globalScope, ScopeKind kind) : this() { Kind = kind; Parent = parent; GlobalScope = globalScope; }
public CodeBlockNode(ScopeKind scopeKind = ScopeKind.Unclosured) { Statements = new List <NodeBase>(); Scope = new Scope(scopeKind); }
public Scope CreateChild(ScopeKind kind, bool independent = false) { return(independent ? new Scope(GlobalScope, kind) : new Scope(this, kind)); }
private void GetScopeParameter(XmlNode scopeNode, ScopeKind kind) { XmlNodeList scopes = scopeNode.SelectNodes("tc:Scope", this.manager); foreach (XmlNode scope in scopes) { XmlAttribute value = scope.Attributes["value"]; if (kind == ScopeKind.In) { if (string.IsNullOrEmpty(inScope)) { inScope = value.Value; } else { inScope += "+" + value.Value; } } else if (kind == ScopeKind.Out) { if (string.IsNullOrEmpty(outScope)) { outScope = value.Value; } else { outScope += "+" + value.Value; } } } }
/// <summary> /// Initializes a new <see cref="Scope"/>. /// </summary> /// <param name="kind">The <see cref="ScopeKind"/> for this scope.</param> /// <param name="parent">The parent scope of this scope.</param> public Scope(ScopeKind kind, Scope?parent) { Kind = kind; Parent = parent; }
private static void AddToCollector(CSharpCodeCompletionContext context, IItemsCollector collector, IReferenceName referenceName, NamedElementKinds elementKinds, ScopeKind localSelfScoped) { var referenceNameResolveResult = referenceName.Reference.Resolve(); var referencedElementAsString = referenceNameResolveResult.DeclaredElement.ConvertToString(); if (referencedElementAsString == "Class:Moq.Mock`1") { var typeArgumentList = referenceName.TypeArgumentList; var typeArguments = typeArgumentList.TypeArguments; if (typeArguments.Count == 1) { var typeArgument = typeArguments[0]; var scalarType = typeArgument.GetScalarType(); if (scalarType == null) { return; } var genericTypeResolveResult = scalarType.Resolve(); var namingManager = typeArgument.GetPsiServices().Naming; var suggestionOptions = new SuggestionOptions(); string proposedName; if (genericTypeResolveResult.IsEmpty) { proposedName = namingManager.Suggestion.GetDerivedName(typeArgument.GetPresentableName(CSharpLanguage.Instance), elementKinds, localSelfScoped, CSharpLanguage.Instance, suggestionOptions, referenceName.GetSourceFile()); } else { proposedName = namingManager.Suggestion.GetDerivedName(genericTypeResolveResult.DeclaredElement, elementKinds, localSelfScoped, CSharpLanguage.Instance, suggestionOptions, referenceName.GetSourceFile()); } var textLookupItem = new TextLookupItem(proposedName); textLookupItem.InitializeRanges(context.CompletionRanges, context.BasicContext); textLookupItem.SetTopPriority(); collector.Add(textLookupItem); var textLookupItem2 = new TextLookupItem(proposedName + "Mock"); textLookupItem2.InitializeRanges(context.CompletionRanges, context.BasicContext); textLookupItem2.SetTopPriority(); collector.Add(textLookupItem2); } } }
public void setOwnerScope(ScopeKind newValue) { getJmiOperation().setOwnerScope(newValue); }
public void setOwnerScope(ScopeKind newValue) { ownerScope = newValue; }