Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

<ItemGroup>
<Compile Include="SR.cs" />
<Compile Include="$(WpfCommonDir)src\System\SR.cs" >
<Compile Include="$(WpfCommonDir)src\System\SR.cs">
<Link>Common\System\SR.cs</Link>
</Compile>

Expand Down Expand Up @@ -207,9 +207,6 @@
<Compile Include="$(WpfSourceDir)\PresentationFramework\System\Windows\Markup\TemplateXamlParser.cs">
<Link>PresentationFramework\System\Windows\Markup\TemplateXamlParser.cs</Link>
</Compile>
<Compile Include="$(WpfSourceDir)\PresentationFramework\System\Windows\Markup\TreeBuilder.cs">
<Link>PresentationFramework\System\Windows\Markup\TreeBuilder.cs</Link>
</Compile>
<Compile Include="$(WpfSourceDir)\PresentationFramework\System\Windows\Markup\TypeContext.cs">
<Link>PresentationFramework\System\Windows\Markup\TypeContext.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -45,27 +45,6 @@ namespace System.Windows.Markup
/// </summary>
internal class StyleXamlParser : XamlParser
{

#region Constructors

#if !PBTCOMPILER
/// <summary>
/// Constructor.
/// </summary>
/// <remarks>
/// Note that we are re-using the token reader, so we'll swap out the XamlParser that
/// the token reader uses with ourself. Then restore it when we're done parsing.
/// </remarks>
internal StyleXamlParser(
XamlTreeBuilder treeBuilder,
XamlReaderHelper tokenReader,
ParserContext parserContext) : this(tokenReader, parserContext)
{
_treeBuilder = treeBuilder;
}

#endif

/// <summary>
/// Constructor.
/// </summary>
Expand All @@ -82,14 +61,10 @@ internal StyleXamlParser(

_previousXamlParser = TokenReader.ControllingXamlParser;
TokenReader.ControllingXamlParser = this;
_startingDepth = TokenReader.XmlReader.Depth;
}

#endregion Constructors

#region Overrides


/// <summary>
/// Override of the main switch statement that processes the xaml nodes.
/// </summary>
Expand Down Expand Up @@ -1452,15 +1427,7 @@ public override void WritePropertyWithType(XamlPropertyWithTypeNode xamlProperty
internal override void ParseError(XamlParseException e)
{
CloseWriterStream();
#if !PBTCOMPILER
// If there is an associated treebuilder, tell it about the error. There may not
// be a treebuilder, if this parser was built from a serializer for the purpose of
// converting directly to baml, rather than converting to an object tree.
if (TreeBuilder != null)
{
TreeBuilder.XamlTreeBuildError(e);
}
#endif

throw e;
}

Expand Down Expand Up @@ -1513,17 +1480,6 @@ internal void CloseWriterStream()

#endregion Methods

#region Properties

#if !PBTCOMPILER
/// <summary>
/// TreeBuilder associated with this class
/// </summary>
XamlTreeBuilder TreeBuilder
{
get { return _treeBuilder; }
}
#else
/// <summary>
/// Return true if we are not in pass one of a compile and we are parsing a
/// defer load section of markup.
Expand All @@ -1540,24 +1496,13 @@ private bool IsLocalPass1
{
get { return BamlRecordWriter == null; }
}
#endif

#endregion Properties

#region Data

#if !PBTCOMPILER
// TreeBuilder that created this parser
XamlTreeBuilder _treeBuilder;
#endif
// The XamlParser that the TokenReader was using when this instance of
// the StyleXamlParser was created. This must be restored on exit
private XamlParser _previousXamlParser;

// Depth in the Xaml file when parsing of this style block started.
// This is used to determine when to stop parsing
private int _startingDepth;

private StyleModeStack _styleModeStack = new StyleModeStack();

// Depth in the element tree where a <Setter .../> element has begun.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,6 @@ namespace System.Windows.Markup
internal class TemplateXamlParser : XamlParser
{

#region Constructors

#if !PBTCOMPILER
/// <summary>
/// Constructor.
/// </summary>
/// <remarks>
/// Note that we are re-using the token reader, so we'll swap out the XamlParser that
/// the token reader uses with ourself. Then restore it when we're done parsing.
/// </remarks>
internal TemplateXamlParser(
XamlTreeBuilder treeBuilder,
XamlReaderHelper tokenReader,
ParserContext parserContext) : this(tokenReader, parserContext)
{
_treeBuilder = treeBuilder;
}

#endif

/// <summary>
/// Constructor.
/// </summary>
Expand All @@ -70,11 +50,8 @@ internal TemplateXamlParser(

_previousXamlParser = TokenReader.ControllingXamlParser;
TokenReader.ControllingXamlParser = this;
_startingDepth = TokenReader.XmlReader.Depth;
}

#endregion Constructors

#region Overrides


Expand Down Expand Up @@ -1666,15 +1643,7 @@ private void WriteDataTypeKey(XamlPropertyWithTypeNode xamlPropertyNode)
internal override void ParseError(XamlParseException e)
{
CloseWriterStream();
#if !PBTCOMPILER
// If there is an associated treebuilder, tell it about the error. There may not
// be a treebuilder, if this parser was built from a serializer for the purpose of
// converting directly to baml, rather than converting to an object tree.
if (TreeBuilder != null)
{
TreeBuilder.XamlTreeBuildError(e);
}
#endif

throw e;
}

Expand Down Expand Up @@ -1729,15 +1698,6 @@ internal void CloseWriterStream()

#region Properties

#if !PBTCOMPILER
/// <summary>
/// TreeBuilder associated with this class
/// </summary>
XamlTreeBuilder TreeBuilder
{
get { return _treeBuilder; }
}
#else
/// <summary>
/// Return true if we are not in pass one of a compile and we are parsing a
/// defer load section of markup. Note that if this is nested within a
Expand Down Expand Up @@ -1783,24 +1743,14 @@ private Type ItemContainerTemplateKeyType
}
}

#endif

#endregion Properties

#region Data

#if !PBTCOMPILER
// TreeBuilder that created this parser
XamlTreeBuilder _treeBuilder;
#endif
// The XamlParser that the TokenReader was using when this instance of
// the TemplateXamlParser was created. This must be restored on exit
private XamlParser _previousXamlParser;

// Depth in the Xaml file when parsing of this template block started.
// This is used to determine when to stop parsing
private int _startingDepth;

// Number of template root nodes encountered immediately under a Template. Only 1
// is allowed.
private int _templateRootCount;
Expand Down
Loading