Remove extra `[NotNull]` definition and second AssemblyInfo.cs file

- add necessary build-time dependency
- add missing `using Microsoft.Framework.Internal;` statements
- remove `[NotNull]` from tests
 - avoid duplicate definitions of `[NotNull]` from referenced projects
- remove incorrect NotNullArgument.cs and second AssemblyInfo.cs files entirely
 - merge content into AssemblyInfo.cs file in expected location

nit: clean up some trailing whitespace
This commit is contained in:
Doug Bunting 2015-04-28 10:45:51 -07:00
parent 2d20063ba5
commit 1111405786
27 changed files with 48 additions and 38 deletions

View File

@ -1,6 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNet.Razor.Runtime.Test")]

View File

@ -2,5 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.Razor.Runtime.Test")]

View File

@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{

View File

@ -7,6 +7,7 @@ using System.Globalization;
using System.Linq;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{

View File

@ -3,6 +3,7 @@
using System.Diagnostics;
using System.Globalization;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{

View File

@ -1,6 +1,8 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{
/// <summary>

View File

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{

View File

@ -3,6 +3,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator
{

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor
{

View File

@ -1,12 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. 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.AspNet.Razor
{
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
internal sealed class NotNullAttribute : Attribute
{
}
}

View File

@ -12,6 +12,7 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Parser
{

View File

@ -13,6 +13,7 @@ using Microsoft.AspNet.Razor.Parser.TagHelpers;
using Microsoft.AspNet.Razor.Parser.TagHelpers.Internal;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Parser
{
@ -205,14 +206,14 @@ namespace Microsoft.AspNet.Razor.Parser
/// specified <paramref name="documentRoot"/>.
/// </summary>
/// <param name="documentRoot">The <see cref="Block"/> to scan for tag helper registrations in.</param>
/// <param name="errorSink">Used to manage <see cref="RazorError"/>s encountered during the Razor parsing
/// <param name="errorSink">Used to manage <see cref="RazorError"/>s encountered during the Razor parsing
/// phase.</param>
/// <returns><see cref="TagHelperDescriptor"/>s that are applicable to the <paramref name="documentRoot"/>
/// </returns>
protected virtual IEnumerable<TagHelperDescriptor> GetTagHelperDescriptors([NotNull] Block documentRoot,
[NotNull] ErrorSink errorSink)
{
var addOrRemoveTagHelperSpanVisitor =
var addOrRemoveTagHelperSpanVisitor =
new TagHelperDirectiveSpanVisitor(TagHelperDescriptorResolver, errorSink);
return addOrRemoveTagHelperSpanVisitor.GetDescriptors(documentRoot);
}

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Parser.TagHelpers
{
@ -25,8 +26,9 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
{
}
public TagHelperDirectiveSpanVisitor([NotNull] ITagHelperDescriptorResolver descriptorResolver,
[NotNull] ErrorSink errorSink)
public TagHelperDirectiveSpanVisitor(
[NotNull] ITagHelperDescriptorResolver descriptorResolver,
[NotNull] ErrorSink errorSink)
{
_descriptorResolver = descriptorResolver;
_errorSink = errorSink;
@ -61,14 +63,14 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
{
var codeGenerator = (AddOrRemoveTagHelperCodeGenerator)span.CodeGenerator;
var directive =
var directive =
codeGenerator.RemoveTagHelperDescriptors ?
TagHelperDirectiveType.RemoveTagHelper :
TagHelperDirectiveType.AddTagHelper;
var directiveDescriptor = new TagHelperDirectiveDescriptor(
codeGenerator.LookupText,
span.Start,
codeGenerator.LookupText,
span.Start,
directive);
_directiveDescriptors.Add(directiveDescriptor);

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor
{

View File

@ -8,6 +8,7 @@ using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor
{

View File

@ -12,6 +12,7 @@ using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor
{

View File

@ -4,6 +4,7 @@
using System;
using System.Globalization;
using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal;
using Microsoft.Internal.Web.Utils;
namespace Microsoft.AspNet.Razor

View File

@ -4,6 +4,7 @@
using System;
using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.TagHelpers
{

View File

@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.TagHelpers
{

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.TagHelpers
{

View File

@ -1,6 +1,8 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.TagHelpers
{
/// <summary>

View File

@ -1,6 +1,9 @@
{
"description": "Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor parser and code generation infrastructure.",
"version": "4.0.0-*",
"dependencies": {
"Microsoft.Framework.NotNullAttribute.Internal": { "type": "build", "version": "1.0.0-*" }
},
"frameworks": {
"net45": { },
"dnx451": { },

View File

@ -16,9 +16,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
{
}
public bool Equals(
[NotNull] IReadOnlyTagHelperAttribute attributeX,
[NotNull] IReadOnlyTagHelperAttribute attributeY)
public bool Equals(IReadOnlyTagHelperAttribute attributeX, IReadOnlyTagHelperAttribute attributeY)
{
return
attributeX == attributeY ||
@ -27,7 +25,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
Equals(attributeX.Value, attributeY.Value);
}
public int GetHashCode([NotNull] IReadOnlyTagHelperAttribute attribute)
public int GetHashCode(IReadOnlyTagHelperAttribute attribute)
{
return HashCodeCombiner
.Start()

View File

@ -70,8 +70,9 @@ namespace Microsoft.AspNet.Razor.Test.Generator
{
}
protected override CSharpCodeVisitor CreateCSharpCodeVisitor([NotNull] CSharpCodeWriter writer,
[NotNull] CodeBuilderContext context)
protected override CSharpCodeVisitor CreateCSharpCodeVisitor(
CSharpCodeWriter writer,
CodeBuilderContext context)
{
var bodyVisitor = base.CreateCSharpCodeVisitor(writer, context);
@ -83,11 +84,12 @@ namespace Microsoft.AspNet.Razor.Test.Generator
private class CustomTagHelperAttributeCodeRenderer : TagHelperAttributeValueCodeRenderer
{
public override void RenderAttributeValue([NotNull] TagHelperAttributeDescriptor attributeInfo,
[NotNull] CSharpCodeWriter writer,
[NotNull] CodeBuilderContext context,
[NotNull] Action<CSharpCodeWriter> renderAttributeValue,
bool complexValue)
public override void RenderAttributeValue(
TagHelperAttributeDescriptor attributeInfo,
CSharpCodeWriter writer,
CodeBuilderContext context,
Action<CSharpCodeWriter> renderAttributeValue,
bool complexValue)
{
writer.Write("**From custom attribute code renderer**: ");