31 lines
934 B
C#
31 lines
934 B
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
|
|
namespace Microsoft.AspNetCore.Razor.Evolution
|
|
{
|
|
public static class RazorCodeDocumentExtensions
|
|
{
|
|
public static RazorSyntaxTree GetSyntaxTree(this RazorCodeDocument document)
|
|
{
|
|
if (document == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(document));
|
|
}
|
|
|
|
return document.Items[typeof(RazorSyntaxTree)] as RazorSyntaxTree;
|
|
}
|
|
|
|
public static void SetSyntaxTree(this RazorCodeDocument document, RazorSyntaxTree syntaxTree)
|
|
{
|
|
if (document == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(document));
|
|
}
|
|
|
|
document.Items[typeof(RazorSyntaxTree)] = syntaxTree;
|
|
}
|
|
}
|
|
}
|