public virtual ImmutableArray <UsingDirective> GetUsingDirectives(LanguageSyntaxNode declarationSyntax) { return(ImmutableArray <UsingDirective> .Empty); }
protected virtual BoundNode CreateBoundProperty(BoundTree boundTree, ImmutableArray <object> childBoundNodes, string name, LanguageSyntaxNode syntax = null, bool hasErrors = false) { return(this.CreateBoundPropertyCore(boundTree, childBoundNodes, name, default, SymbolPropertyOwner.CurrentSymbol, null, syntax, hasErrors));
public CustomBinder(Binder next, LanguageSyntaxNode syntax) : base(next) { _syntax = syntax; }
public BoundRoot(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, LanguageSyntaxNode syntax, bool hasErrors = false) : base(kind, boundTree, childBoundNodes, syntax, hasErrors) { }
protected virtual BoundNode CreateBoundSymbolUseCore(BoundTree boundTree, ImmutableArray <object> childBoundNodes, ImmutableArray <Type> types, ImmutableArray <Type> nestingTypes, LanguageSyntaxNode syntax, bool hasErrors) { return(new BoundSymbolUse(BoundKind.SymbolUse, boundTree, childBoundNodes, types, nestingTypes, syntax, hasErrors)); }
protected BoundStatement(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, IOperation statement, LanguageSyntaxNode syntax, bool hasErrors = false) : base(kind, boundTree, childBoundNodes, syntax, hasErrors) { _statement = statement; }
public BoundAttribute(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, ImmutableArray <Type> types, ImmutableArray <Type> nestingTypes, LanguageSyntaxNode syntax, bool hasErrors = false) : base(kind, boundTree, childBoundNodes, types, nestingTypes, syntax, hasErrors) { }
protected virtual BoundNode CreateBoundSymbolDef(BoundTree boundTree, ImmutableArray <object> childBoundNodes, Type type, string nestingProperty = null, bool merge = false, LanguageSyntaxNode syntax = null, bool hasErrors = false) { return(this.CreateBoundSymbolDefCore(boundTree, childBoundNodes, type, syntax, hasErrors)); }
public MemberBoundTree(LanguageCompilation compilation, LanguageSyntaxNode root, Binder rootBinder, DiagnosticBag diagnostics) : base(compilation, (LanguageSyntaxTree)root.SyntaxTree, rootBinder, diagnostics) { _parent = null; _root = root; }
public override bool TryGetBinder(LanguageSyntaxNode node, object usage, out Binder binder) { var key = new BinderCacheKey(node, usage); return(_binderCache.TryGetValue(key, out binder)); }
public MemberBoundTree(BoundTree parent, LanguageSyntaxNode root, Binder rootBinder) : base(parent.Compilation, parent.SyntaxTree, rootBinder, parent.DiagnosticBag) { _parent = parent; _root = root; }
public AttributeBinder(Binder next, LanguageSyntaxNode syntax, ImmutableArray <Type> types, ImmutableArray <Type> nestingTypes) : base(next, syntax, types, nestingTypes) { }
public BoundOpposite(MetaBoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, LanguageSyntaxNode syntax, bool hasErrors) : base(kind, boundTree, childBoundNodes, syntax, hasErrors) { }
protected virtual BoundNode CreateBoundRoot(BoundTree boundTree, ImmutableArray <object> childBoundNodes, LanguageSyntaxNode syntax, bool hasErrors) { return(this.CreateBoundRootCore(boundTree, childBoundNodes, syntax, hasErrors)); }
private ImmutableArray <BoundNode> GetBoundNodesFromMap(LanguageSyntaxNode node) { ImmutableArray <BoundNode> result; return(_map.TryGetValue(node, out result) ? result : default(ImmutableArray <BoundNode>)); }
protected virtual BoundNode CreateBoundScopeCore(BoundTree boundTree, ImmutableArray <object> childBoundNodes, LanguageSyntaxNode syntax, bool hasErrors) { return(new BoundScope(BoundKind.Scope, boundTree, childBoundNodes, syntax, hasErrors)); }
/// <summary> /// This overload exists for callers who already have a node in hand /// and don't want to search through the tree. /// </summary> internal Binder GetEnclosingBinderInternal(LanguageSyntaxNode node, int position) { AssertPositionAdjusted(position); return(GetEnclosingBinderWithinRoot(node, position)); }
protected virtual BoundNode CreateBoundSymbolDefCore(BoundTree boundTree, ImmutableArray <object> childBoundNodes, Type type, LanguageSyntaxNode syntax, bool hasErrors) { return(new BoundSymbolDef(BoundKind.SymbolDef, boundTree, childBoundNodes, type, syntax, hasErrors)); }
/// <summary> /// Get all bounds nodes associated with a node, ordered from highest to lowest in the bound tree. /// Strictly speaking, the order is that of a pre-order traversal of the bound tree. /// </summary> public ImmutableArray <BoundNode> GetBoundNodes(LanguageSyntaxNode node) { // If this method is called with a null parameter, that implies that the Root should be // bound, but make sure that the Root is bindable. if (node == null) { node = GetBindableSyntaxNode(Root); } //Debug.Assert(node == GetBindableSyntaxNode(node)); // We have one SemanticModel for each method. // // The SemanticModel contains a lazily-built immutable map from scope-introducing // syntactic statements (such as blocks) to binders, but not from lambdas to binders. // // The SemanticModel also contains a mutable map from syntax to bound nodes; that is // declared here. Since the map is not thread-safe we ensure that it is guarded with a // reader-writer lock. // // Have we already got the desired bound node in the mutable map? If so, return it. ImmutableArray <BoundNode> results = GetBoundNodesFromMap(node); if (!results.IsDefaultOrEmpty) { return(results); } // We might not actually have been given an expression or statement even though we were // allegedly given something that is "bindable". // If we didn't find in the cached bound nodes, find a binding root and bind it. // This will cache bound nodes under the binding root. LanguageSyntaxNode nodeToBind = GetBindingRoot(node); var nodeBinder = GetEnclosingBinder(GetAdjustedNodePosition(nodeToBind)); BoundNode boundNode = nodeBinder.CreateBoundNodeForBoundTree(nodeToBind, this); results = AddBoundTreeAndGetBoundNodeFromMap(node, boundNode); if (!results.IsDefaultOrEmpty) { return(results); } // If we still didn't find it, its still possible we could bind it directly. // For example, types are usually not represented by bound nodes, and some error conditions and // not yet implemented features do not create bound nodes for everything underneath them. // // In this case, however, we only add the single bound node we found to the map, not any child bound nodes, // to avoid duplicates in the map if a parent of this node comes through this code path also. var binder = GetEnclosingBinder(GetAdjustedNodePosition(node)); results = GetBoundNodesFromMap(node); if (!results.IsDefaultOrEmpty) { return(results); } /*else * { * var directlyBoundNode = binder.CreateBoundNodeForBoundTree(node, this); * AddBoundTreeForStandaloneSyntax(node, directlyBoundNode); * results = GetBoundNodesFromMap(node); * * if (!results.IsDefaultOrEmpty) * { * return results; * } * }*/ return(ImmutableArray <BoundNode> .Empty); }
protected virtual BoundNode CreateBoundAttribute(BoundTree boundTree, ImmutableArray <object> childBoundNodes, ImmutableArray <Type> types, LanguageSyntaxNode syntax, bool hasErrors) { return(this.CreateBoundAttributeCore(boundTree, childBoundNodes, types, ImmutableArray <Type> .Empty, syntax, hasErrors)); }
/// <summary> /// Gets the containing expression that is actually a language expression (or something that /// GetSymbolInfo can be applied to) and not just typed /// as an ExpressionSyntax for convenience. For example, NameSyntax nodes on the right side /// of qualified names and member access expressions are not language expressions, yet the /// containing qualified names or member access expressions are indeed expressions. /// Similarly, if the input node is a cref part that is not independently meaningful, then /// the result will be the full cref. Besides an expression, an input that is a NameSyntax /// of a SubpatternSyntax, e.g. in `name: 3` may cause this method to return the enclosing /// SubpatternSyntax. /// </summary> public virtual LanguageSyntaxNode GetStandaloneNode(LanguageSyntaxNode node) { return(node); }
public BoundSelectedEndPoint(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, LanguageSyntaxNode syntax, bool hasErrors) : base(kind, boundTree, childBoundNodes, syntax, hasErrors) { }
public BoundProperty(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, string name, Optional <object> valueOpt, SymbolPropertyOwner owner, Type ownerType, LanguageSyntaxNode syntax, bool hasErrors = false) : base(kind, boundTree, childBoundNodes, syntax, hasErrors) { _name = name; _hasFixedValue = valueOpt.HasValue; _value = valueOpt.HasValue ? valueOpt.Value : default; _owner = owner; _ownerType = ownerType; }
protected BoundExpression(BoundKind kind, BoundTree boundTree, ImmutableArray <object> childBoundNodes, IOperation expression, LanguageSyntaxNode syntax, bool hasErrors = false) : base(kind, boundTree, childBoundNodes, syntax, hasErrors) { _expression = expression; }
// WARNING: Only use this if the node is obtainable without allocating it (even if cached later). E.g., only // if the node is stored in the constructor of the symbol. In particular, do not call this on the result of a GetSyntax() // call on a SyntaxReference. public LexicalSortKey(LanguageSyntaxNode node, LanguageCompilation compilation) : this((LanguageSyntaxTree)node.SyntaxTree, node.SpanStart, compilation) { }
public SelectedEndPointBinder(Binder next, LanguageSyntaxNode syntax) : base(next) { }
public virtual ImmutableArray <ExternAliasDirective> GetExternAliasDirectives(LanguageSyntaxNode declarationSyntax) { return(ImmutableArray <ExternAliasDirective> .Empty); }