示例#1
0
        /// <summary>
        /// Returns binder that binds usings and aliases
        /// </summary>
        /// <param name="unit">
        /// Specify <see cref="NamespaceDeclarationSyntax"/> imports in the corresponding namespace, or
        /// <see cref="CompilationUnitSyntax"/> for top-level imports.
        /// </param>
        /// <param name="inUsing">True if the binder will be used to bind a using directive.</param>
        public virtual Binder GetImportsBinder(LanguageSyntaxNode unit, bool inUsing = false)
        {
            BinderFactoryVisitor visitor = _binderFactoryVisitorPool.Allocate();

            visitor.Initialize(0, false);
            Binder result = visitor.GetImportsBinder(unit, inUsing: inUsing);

            _binderFactoryVisitorPool.Free(visitor);
            return(result);
        }
示例#2
0
        public Binder GetBinder(SyntaxNode node, int position, bool forChild)
        {
            Debug.Assert(node != null);

            BinderFactoryVisitor visitor = _binderFactoryVisitorPool.Allocate();

            visitor.Initialize(position, forChild);
            Binder result = visitor.Visit(node);

            _binderFactoryVisitorPool.Free(visitor);

            return(result);
        }