public override void GenerateCode(Span target, CodeGeneratorContext context) { context.GeneratedClass.BaseTypes.Clear(); context.GeneratedClass.BaseTypes.Add( new CodeTypeReference(ResolveType(context, BaseType.Trim())) ); if (context.Host.DesignTimeMode) { int generatedCodeStart = 0; string code = context.BuildCodeString( cw => { generatedCodeStart = cw.WriteVariableDeclaration( target.Content, "__inheritsHelper", null ); cw.WriteEndStatement(); } ); int paddingCharCount; CodeSnippetStatement stmt = new CodeSnippetStatement( CodeGeneratorPaddingHelper.Pad( context.Host, code, target, generatedCodeStart, out paddingCharCount ) ) { LinePragma = context.GenerateLinePragma( target, generatedCodeStart + paddingCharCount ) }; context.AddDesignTimeHelperStatement(stmt); } }
public override void GenerateCode(Span target, CodeGeneratorContext context) { context.GeneratedClass.BaseTypes.Clear(); context.GeneratedClass.BaseTypes.Add(new CodeTypeReference(ResolveType(context, BaseType.Trim()))); if (context.Host.DesignTimeMode) { int generatedCodeStart = 0; string code = context.BuildCodeString(cw => { generatedCodeStart = cw.WriteVariableDeclaration(target.Content, "__inheritsHelper", null); cw.WriteEndStatement(); }); int paddingCharCount; CodeSnippetStatement stmt = new CodeSnippetStatement( CodeGeneratorPaddingHelper.Pad(context.Host, code, target, generatedCodeStart, out paddingCharCount)) { LinePragma = context.GenerateLinePragma(target, generatedCodeStart + paddingCharCount) }; context.AddDesignTimeHelperStatement(stmt); } }