public CSharpFile(CSharpProject project, FilePath fileName, string sourceCode) { Ensure.ArgumentNotNull(project, "project"); Project = project; FileName = fileName; OriginalText = sourceCode; var parser = new CSharpParser(Project.CompilerSettings); SyntaxTree = parser.Parse(sourceCode, fileName.FullPath); Errors = parser.HasErrors ? parser.ErrorsAndWarnings : new List <Error>(0); UnresolvedTypeSystemForFile = SyntaxTree.ToTypeSystem(); }
public CSharpFile(CSharpProject project, FilePath fileName, string sourceCode) { Ensure.ArgumentNotNull(project, "project"); Project = project; FileName = fileName; OriginalText = sourceCode; var parser = new CSharpParser(Project.CompilerSettings); SyntaxTree = parser.Parse(sourceCode, fileName.FullPath); Errors = parser.HasErrors ? parser.ErrorsAndWarnings : new List<Error>(0); UnresolvedTypeSystemForFile = SyntaxTree.ToTypeSystem(); }
public CSharpFile BuildCSharpFile(CSharpProject p, FilePath filename) { if (_openDocumentManager.IsDocumentOpen(filename)) { _log.DebugFormat("Class file is open and will not be cached: [{0}]", filename); return new CSharpFile(p, filename, _fileReader.ReadAllText(filename)); } return _fileCache.GetOrAdd(filename, f => { _log.DebugFormat("Build CSharpFile [{0}]", filename); _fileByProjectIndex.Add(p.FileName, f); return new CSharpFile(p, f, _fileReader.ReadAllText(f)); }); }