public AbstractRecoverableSyntaxRoot(
                AbstractSyntaxTreeFactoryService service,
                string filePath,
                ParseOptions options,
                ValueSource <TextAndVersion> text,
                TRoot root)
            {
                System.Diagnostics.Debug.Assert(service != null);
                System.Diagnostics.Debug.Assert(filePath != null);
                System.Diagnostics.Debug.Assert(options != null);
                System.Diagnostics.Debug.Assert(text != null);
                System.Diagnostics.Debug.Assert(root != null);

                this.service    = service;
                this.filePath   = filePath;
                this.options    = options;
                this.textSource = text;
                this.length     = root.FullSpan.Length;

                this.syntaxTreeCache = WorkspaceServices.GetService <ISyntaxTreeCacheService>();
                System.Diagnostics.Debug.Assert(this.syntaxTreeCache != null);

                this.evictAction = new WeakAction <AbstractRecoverableSyntaxRoot <TRoot>, SyntaxNode>(this, (r, d) => r.OnEvicted(d));

                this.rootSource = new ConstantValueSource <TRoot>(root);
            }
Example #2
0
 protected CachedRecoverableSyntaxRoot(
     AbstractSyntaxTreeFactoryService service,
     string filePath,
     ParseOptions options,
     ValueSource <TextAndVersion> textSource,
     ValueSource <TRoot> rootSource,
     int length)
     : base(service, filePath, options, textSource)
 {
     this.rootSource      = rootSource;
     this.length          = length;
     this.syntaxTreeCache = service.languageServices.WorkspaceServices.GetService <ISyntaxTreeCacheService>();
     this.evictAction     = new WeakAction <CachedRecoverableSyntaxRoot <TRoot>, SyntaxNode>(this, (r, d) => r.OnEvicted(d));
 }