[Mono-dev] [PATCH] Simplifying/optimizing CodeGenerator.cs

Juraj Skripsky js at hotfeet.ch
Sun Jan 6 18:04:19 EST 2008


Hi Robert,

Please ignore my last mail. I think I see now what you meant.
Adding a abstract method to CodeObject, e.g.

abstract void GenerateCode(CodeGenerator generator);

and implementing/overriding it in each subclass (where it calls the
appropriate CodeGenerator.GenerateXYZ mehtod) would indeed result in
nicer and faster code.

- Juraj


On Sun, 2008-01-06 at 23:45 +0100, Juraj Skripsky wrote:
> Hi Robert,
> 
> I don't see how to use the visitor pattern in the implementation of
> CodeGenerator. But I'm probably to close to the details right now to see
> the big picture.
> 
> Could you roughly describe how you meant to apply the visitor pattern to
> this class?
> 
> - Juraj
> 
> 
> On Sun, 2008-01-06 at 23:15 +0100, Robert Jordan wrote:
> > Hi Juraj,
> > 
> > Juraj Skripsky wrote:
> > > Hi,
> > > 
> > > Attached you'll find a patch for CodeGenerator.cs (in
> > > System.CodeDom.Compiler). It simplifies two methods considerably and
> > > might also bring a small performance improvement (perf. tests pending).
> > 
> > I think using a visitor pattern would be more appropriate.
> > Performance and style-wise.
> > 
> > Robert
> > 
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> > 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 




More information about the Mono-devel-list mailing list