Addressed stylecop and CR issues.

#568
This commit is contained in:
N. Taylor Mullen 2014-06-24 12:28:48 -07:00 committed by Pranav K
parent 2ad175b687
commit 83f585e583
6 changed files with 32 additions and 17 deletions

View File

@ -1,4 +1,7 @@
using Microsoft.AspNet.Razor.Generator.Compiler;
// 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.AspNet.Razor.Generator.Compiler;
namespace Microsoft.AspNet.Mvc.Razor
{
@ -9,7 +12,7 @@ namespace Microsoft.AspNet.Mvc.Razor
/// </summary>
/// <param name="baseType">The base type of the view.</param>
/// <param name="modelType">The type of the view's Model.</param>
public ModelChunk(string baseType, string modelType)
public ModelChunk(string baseType, string modelType)
{
BaseType = baseType;
ModelType = modelType;

View File

@ -1,4 +1,7 @@
using Microsoft.AspNet.Razor.Generator;
// 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.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
namespace Microsoft.AspNet.Mvc.Razor
@ -8,7 +11,8 @@ namespace Microsoft.AspNet.Mvc.Razor
public ModelChunkVisitor([NotNull] CSharpCodeWriter writer,
[NotNull] CodeGeneratorContext context)
: base(writer, context)
{ }
{
}
protected override void Visit(ModelChunk chunk)
{

View File

@ -1,4 +1,7 @@
using System;
// 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.AspNet.Mvc.Razor;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
@ -23,7 +26,7 @@ namespace Microsoft.AspNet.Razor.Generator
public override string ToString()
{
return "Full Model Type: " + BaseType + "<" + ModelType + ">";
return BaseType + "<" + ModelType + ">";
}
public override bool Equals(object obj)

View File

@ -1,4 +1,7 @@
using Microsoft.AspNet.Razor.Generator;
// 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.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
@ -9,7 +12,8 @@ namespace Microsoft.AspNet.Mvc.Razor
public MvcCSharpChunkVisitor([NotNull] CSharpCodeWriter writer,
[NotNull] CodeGeneratorContext context)
: base(writer, context)
{ }
{
}
public override void Accept(Chunk chunk)
{

View File

@ -19,20 +19,20 @@ namespace Microsoft.AspNet.Mvc.Razor
protected override CSharpCodeWritingScope BuildClassDeclaration(CSharpCodeWriter writer)
{
var modelChunks = Context.CodeTreeBuilder.CodeTree.Chunks.OfType<ModelChunk>();
// Grab the last model chunk so it gets intellisense.
// NOTE: If there's more than 1 model chunk there will be a Razor error BUT we want intellisense to
// show up on the current model chunk that the user is typing.
var modelChunk = Context.CodeTreeBuilder.CodeTree.Chunks.OfType<ModelChunk>()
.LastOrDefault();
// If there were any model chunks then we need to modify the class declaration signature.
if (modelChunks.Any())
if (modelChunk != null)
{
writer.Write(string.Format(CultureInfo.CurrentCulture, "public class {0} : ", Context.ClassName));
writer.Write(string.Format(CultureInfo.InvariantCulture, "public class {0} : ", Context.ClassName));
// Grab the last model chunk so it gets intellisense.
// NOTE: If there's more than 1 model chunk there will be a Razor error BUT we want intellisense to show up
// on the current model chunk that the user is typing.
var lastModelChunk = modelChunks.Last();
var modelVisitor = new ModelChunkVisitor(writer, Context);
// This generates the base class signature
modelVisitor.Accept(lastModelChunk);
modelVisitor.Accept(modelChunk);
writer.WriteLine();

View File

@ -11,7 +11,8 @@ namespace Microsoft.AspNet.Mvc.Razor
public MvcCSharpCodeVisitor([NotNull] CSharpCodeWriter writer,
[NotNull] CodeGeneratorContext context)
: base(writer, context)
{ }
{
}
protected override void Visit(InjectChunk chunk)
{