Modify SetBaseTYpeCodeGenerator to use value from BaseType instead of
parsed content
This commit is contained in:
parent
8db45f7564
commit
3afb31b78b
|
|
@ -16,18 +16,13 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
|
|
||||||
public string BaseType { get; private set; }
|
public string BaseType { get; private set; }
|
||||||
|
|
||||||
public void GenerateCode(Span target, CodeTreeBuilder codeTreeBuilder, CodeGeneratorContext context)
|
|
||||||
{
|
|
||||||
codeTreeBuilder.AddSetBaseTypeChunk(target.Content, target);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
||||||
{
|
{
|
||||||
#if NET45
|
#if NET45
|
||||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||||
|
|
||||||
context.GeneratedClass.BaseTypes.Clear();
|
context.GeneratedClass.BaseTypes.Clear();
|
||||||
context.GeneratedClass.BaseTypes.Add(new CodeTypeReference(ResolveType(context, BaseType.Trim())));
|
context.GeneratedClass.BaseTypes.Add(new CodeTypeReference(BaseType.Trim()));
|
||||||
|
|
||||||
if (context.Host.DesignTimeMode)
|
if (context.Host.DesignTimeMode)
|
||||||
{
|
{
|
||||||
|
|
@ -48,14 +43,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
context.AddDesignTimeHelperStatement(stmt);
|
context.AddDesignTimeHelperStatement(stmt);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: Make this generate the primary generator
|
// TODO: Make this generate the primary generator
|
||||||
GenerateCode(target, context.CodeTreeBuilder, context);
|
context.CodeTreeBuilder.AddSetBaseTypeChunk(BaseType, target);
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual string ResolveType(CodeGeneratorContext context, string baseType)
|
|
||||||
{
|
|
||||||
return baseType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue