internal SyntaxTreeSemanticModel(LanguageCompilation compilation, LanguageSyntaxTree syntaxTree, bool ignoreAccessibility = false)
        {
            _compilation          = compilation;
            _ignoresAccessibility = ignoreAccessibility;

            if (!this.Compilation.SyntaxTrees.Contains(syntaxTree))
            {
                throw new ArgumentOutOfRangeException(nameof(syntaxTree), CSharpResources.TreeNotPartOfCompilation);
            }

            _boundTree = new BoundTree(compilation, syntaxTree, compilation.GetBinder(syntaxTree.GetRootNode()), _ignoredDiagnostics);

            _binderFactory = compilation.GetBinderFactory(SyntaxTree);
        }
Beispiel #2
0
 internal SyntaxTreeDiagnosticEnumerator(LanguageSyntaxTree syntaxTree, GreenNode node, int position)
 {
     _syntaxTree = null;
     _current    = null;
     _position   = position;
     if (node != null && node.ContainsDiagnostics)
     {
         _syntaxTree = syntaxTree;
         _stack      = new NodeIterationStack(DefaultStackCapacity);
         _stack.PushNodeOrToken(node);
     }
     else
     {
         _stack = new NodeIterationStack();
     }
 }
 public abstract RootSingleDeclaration CreateDeclarationTree(LanguageSyntaxTree syntaxTree, string scriptClassName, bool isSubmission);
 internal SyntaxTreeSemanticModel(LanguageCompilation parentCompilation, LanguageSyntaxTree parentSyntaxTree, LanguageSyntaxTree speculatedSyntaxTree)
 {
     _compilation   = parentCompilation;
     _boundTree     = new BoundTree(parentCompilation, speculatedSyntaxTree, parentCompilation.GetBinder(speculatedSyntaxTree.GetRootNode()), _ignoredDiagnostics);
     _binderFactory = _compilation.GetBinderFactory(parentSyntaxTree);
 }
 /// <summary>
 /// Used by structured trivia which has "parent == null", and therefore must know its
 /// SyntaxTree explicitly when created.
 /// </summary>
 protected LanguageSyntaxNode(GreenNode green, LanguageSyntaxTree syntaxTree, int position)
     : base(green, position, syntaxTree)
 {
 }