diff options
author | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
commit | 95408b1a41b31b645f3a8c3323ab7d3ca4bff26b (patch) | |
tree | f8f137cddcb9a40499d303be95722fd2c6081bce /main/src/addins/CBinding/Parser/CDocumentParser.cs | |
parent | b70e4e04b4e41b8ec28d7e4b220b401ecf467e7a (diff) | |
parent | de043d330a8bf5855d4d983c804cd36727cb2406 (diff) |
Merge remote-tracking branch 'origin/roslyn' into new-project-model
Diffstat (limited to 'main/src/addins/CBinding/Parser/CDocumentParser.cs')
-rwxr-xr-x | main/src/addins/CBinding/Parser/CDocumentParser.cs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/main/src/addins/CBinding/Parser/CDocumentParser.cs b/main/src/addins/CBinding/Parser/CDocumentParser.cs index 0d13cfbbe7..82cea2c6a8 100755 --- a/main/src/addins/CBinding/Parser/CDocumentParser.cs +++ b/main/src/addins/CBinding/Parser/CDocumentParser.cs @@ -35,6 +35,7 @@ using MonoDevelop.Ide; using MonoDevelop.Ide.TypeSystem; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem.Implementation; +using MonoDevelop.Core.Text; namespace CBinding.Parser { @@ -43,13 +44,15 @@ namespace CBinding.Parser /// </summary> public class CDocumentParser: TypeSystemParser { - public override ParsedDocument Parse (bool storeAst, string fileName, TextReader reader, Project project = null) + public override System.Threading.Tasks.Task<ParsedDocument> Parse (ParseOptions options, System.Threading.CancellationToken cancellationToken) { + var fileName = options.FileName; + var project = options.Project; var doc = new DefaultParsedDocument (fileName); doc.Flags |= ParsedDocumentFlags.NonSerializable; ProjectInformation pi = ProjectInformationManager.Instance.Get (project); - string content = reader.ReadToEnd (); + string content = options.Content.Text; string[] contentLines = content.Split (new string[]{Environment.NewLine}, StringSplitOptions.None); var globals = new DefaultUnresolvedTypeDefinition ("", GettextCatalog.GetString ("(Global Scope)")); @@ -58,7 +61,7 @@ namespace CBinding.Parser foreach (LanguageItem li in pi.Containers ()) { if (null == li.Parent && FilePath.Equals (li.File, fileName)) { var tmp = AddLanguageItem (pi, globals, li, contentLines) as IUnresolvedTypeDefinition; - if (null != tmp){ doc.TopLevelTypeDefinitions.Add (tmp); } + if (null != tmp){ /*doc.TopLevelTypeDefinitions.Add (tmp);*/ } } } @@ -70,8 +73,8 @@ namespace CBinding.Parser } } - doc.TopLevelTypeDefinitions.Add (globals); - return doc; + //doc.TopLevelTypeDefinitions.Add (globals); + return System.Threading.Tasks.Task.FromResult((ParsedDocument)doc); } /// <summary> |