示例#1
0
 public SyntaxTree(Uri fileUri, ImmutableArray <int> lineStarts, ProgramSyntax programSyntax)
 {
     FileUri       = fileUri;
     LineStarts    = lineStarts;
     ProgramSyntax = programSyntax;
     Hierarchy     = new SyntaxHierarchy();
     Hierarchy.AddRoot(ProgramSyntax);
 }
示例#2
0
        protected virtual SyntaxBase ReplaceProgramSyntax(ProgramSyntax syntax)
        {
            var hasChanges = TryRewrite(syntax.Children, out var children);

            hasChanges |= TryRewriteStrict(syntax.EndOfFile, out var endOfFile);

            if (!hasChanges)
            {
                return(syntax);
            }

            return(new ProgramSyntax(children, endOfFile, Enumerable.Empty <IDiagnostic>()));
        }
示例#3
0
 void ISyntaxVisitor.VisitProgramSyntax(ProgramSyntax syntax) => ReplaceCurrent(syntax, ReplaceProgramSyntax);
示例#4
0
 public virtual void VisitProgramSyntax(ProgramSyntax syntax)
 {
     this.VisitNodes(syntax.Children);
     this.Visit(syntax.EndOfFile);
 }
示例#5
0
 public SyntaxTree(string filePath, ImmutableArray <int> lineStarts, ProgramSyntax programSyntax)
 {
     FilePath      = filePath;
     LineStarts    = lineStarts;
     ProgramSyntax = programSyntax;
 }
示例#6
0
 public virtual void VisitProgramSyntax(ProgramSyntax syntax)
 {
     this.VisitNodes(syntax.Statements);
     this.Visit(syntax.EndOfFile);
 }
示例#7
0
 public SyntaxTree(Uri fileUri, ImmutableArray <int> lineStarts, ProgramSyntax programSyntax)
 {
     FileUri       = fileUri;
     LineStarts    = lineStarts;
     ProgramSyntax = programSyntax;
 }