public static XamlUnresolvedFile Create(FileName fileName, ITextSource fileContent, AXmlDocument document) { XamlUnresolvedFile file = new XamlUnresolvedFile(fileName); ReadOnlyDocument textDocument = new ReadOnlyDocument(fileContent, fileName); file.errors.AddRange(document.SyntaxErrors.Select(err => new Error(ErrorType.Error, err.Description, textDocument.GetLocation(err.StartOffset)))); var visitor = new XamlDocumentVisitor(file, textDocument); visitor.VisitDocument(document); if (visitor.TypeDefinition != null) file.topLevel = new[] { visitor.TypeDefinition }; else file.topLevel = new IUnresolvedTypeDefinition[0]; return file; }
public static XamlUnresolvedFile Create(FileName fileName, ITextSource fileContent, AXmlDocument document) { XamlUnresolvedFile file = new XamlUnresolvedFile(fileName); ReadOnlyDocument textDocument = new ReadOnlyDocument(fileContent, fileName); file.errors.AddRange(document.SyntaxErrors.Select(err => new Error(ErrorType.Error, err.Description, textDocument.GetLocation(err.StartOffset)))); var visitor = new XamlDocumentVisitor(file, textDocument); visitor.VisitDocument(document); if (visitor.TypeDefinition != null) { file.topLevel = new[] { visitor.TypeDefinition } } ; else { file.topLevel = new IUnresolvedTypeDefinition[0]; } return(file); }