Use of partial classes in parser generated classes in 4.0

SyntaxEditor for Windows Forms Forum

Posted 18 years ago by Russell Mason
Avatar
Hi

In the Simple language (4.0 sample) am I right in thinking the CompilationUnit class was manually changed or have I missed something in the XML language file it was generated from?

If this is the case and the documentation says use these as templates and that it is likely you would change the AST classes, would it be possible to add an attribute to the XML that allows the generation of partial classes? (i.e. just outputs the word 'partial' in front of any class with the corresponding attribute set).

I think this would need to be applicable to any generated class, not just AST based ones.

If the attribute is not set then don't output the keyword (i.e. for .net 1.0, 1.1 compatibility).

This means that these files can be regenerated without affecting the manually written bits. This could be manually set against each class once generated but the attribute method would save a lot of time and potential mistakes.

Thanks
Russell Mason

Comments (2)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes your thinking is correct. That's a pretty cool idea.

How about this... what if we put the partial keyword on the classes if you are using the .NET 2.0 SyntaxEditor library. Otherwise we leave it off? Can you think of any reason not to have the keyword automatically put on if it's .NET 2.0?

One side effect of this is that we should no longer output this "stub" code:
public override string DisplayText {
    get {
        // NOTE: Implement display text if desired
        return base.DisplayText;
    }
}
Or maybe we only include that if in .NET 1.1, otherwise leave it out. What do you think?


Actipro Software Support

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We just uploaded a new build at the same beta location that should output partial classes if you are in .NET 2.0.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.