Example #1
0
 internal ParsedSyntaxTree(SourceText textOpt, Encoding encodingOpt, SourceHashAlgorithm checksumAlgorithm, string path, MetaParseOptions options, MetaSyntaxNode root, DirectiveStack directives, bool cloneRoot = true)
 {
     Debug.Assert(root != null);
     Debug.Assert(options != null);
     Debug.Assert(textOpt == null || textOpt.Encoding == encodingOpt && textOpt.ChecksumAlgorithm == checksumAlgorithm);
     _lazyText          = textOpt;
     _encodingOpt       = encodingOpt ?? textOpt?.Encoding;
     _checksumAlgorithm = checksumAlgorithm;
     _options           = options;
     _path = path ?? string.Empty;
     _root = cloneRoot ? this.CloneNodeAsRoot(root) : root;
     _hasCompilationUnitRoot = root.Kind == MetaSyntaxKind.Main;
     this.SetDirectiveStack(directives);
 }
Example #2
0
 /// <summary>
 /// Creates a new syntax tree from a syntax node with text that should correspond to the syntax node.
 /// </summary>
 /// <remarks>This is used by the ExpressionEvaluator.</remarks>
 internal static MetaSyntaxTree CreateForDebugger(MetaSyntaxNode root, SourceText text, MetaParseOptions options)
 {
     Debug.Assert(root != null);
     return(new DebuggerSyntaxTree(root, text, options));
 }