Browse Source

XamlBinding: bugfixes

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4728 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 16 years ago
parent
commit
de1a7da0be
  1. 34
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompilationUnitCreatorVisitor.cs
  2. 1
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlParser.cs

34
src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompilationUnitCreatorVisitor.cs

@ -12,6 +12,7 @@ using System.Linq; @@ -12,6 +12,7 @@ using System.Linq;
using ICSharpCode.AvalonEdit.Xml;
using ICSharpCode.SharpDevelop.Dom;
using System.Text;
namespace ICSharpCode.XamlBinding
{
@ -51,17 +52,19 @@ namespace ICSharpCode.XamlBinding @@ -51,17 +52,19 @@ namespace ICSharpCode.XamlBinding
{
Debug.Assert(document != null);
if (attribute.ParentElement.Parent == document && attribute.LocalName == "Class" &&
attribute.Namespace == CompletionDataHelper.XamlNamespace) {
this.generatedClass = AddClass(attribute.Value, attribute.ParentElement);
} else if (generatedClass != null && attribute.LocalName == "Name") {
string name = attribute.Value;
if (attribute.ParentElement != null) {
if (attribute.ParentElement.Parent == document && attribute.LocalName == "Class" &&
attribute.Namespace == CompletionDataHelper.XamlNamespace) {
this.generatedClass = AddClass(attribute.Value, attribute.ParentElement);
} else if (generatedClass != null && attribute.LocalName == "Name") {
string name = attribute.Value;
if (!string.IsNullOrEmpty(name)) {
IReturnType type = TypeFromXmlNode(CompilationUnit, attribute.ParentElement);
DomRegion position = CreateRegion(attribute.ParentElement.StartOffset, attribute.ParentElement.StartOffset + attribute.ParentElement.Name.Length);
generatedClass.Fields.Add(new DefaultField(type, name, ModifierEnum.Internal, position, generatedClass));
if (!string.IsNullOrEmpty(name)) {
IReturnType type = TypeFromXmlNode(CompilationUnit, attribute.ParentElement);
DomRegion position = CreateRegion(attribute.ParentElement.StartOffset, attribute.ParentElement.StartOffset + attribute.ParentElement.Name.Length);
generatedClass.Fields.Add(new DefaultField(type, name, ModifierEnum.Internal, position, generatedClass));
}
}
}
@ -71,10 +74,13 @@ namespace ICSharpCode.XamlBinding @@ -71,10 +74,13 @@ namespace ICSharpCode.XamlBinding
public override void VisitTag(AXmlTag tag)
{
if (tag.IsComment) {
string value = tag.Children
.OfType<AXmlText>()
.Select(xmlText => xmlText.Value)
.Aggregate((allText, text) => allText += text);
StringBuilder sb = new StringBuilder();
foreach(AXmlText text in tag.Children.OfType<AXmlText>()) {
sb.Append(text.Value);
}
string value = sb.ToString();
foreach (string commentTag in lexerTags) {
if (value.Contains(commentTag)) {

1
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlParser.cs

@ -95,6 +95,7 @@ namespace ICSharpCode.XamlBinding @@ -95,6 +95,7 @@ namespace ICSharpCode.XamlBinding
public ICompilationUnit Parse(IProjectContent projectContent, string fileName, ITextBuffer fileContent)
{
using (new DebugTimerObject("background parser")) {
Core.LoggingService.Info("file: " + fileName);
using (ParseAndLock(fileContent)) {
var document = parser.LastDocument;

Loading…
Cancel
Save