zspitz / ExpressionTreeToString

String representations of expression trees + library of expression tree objects
MIT License
151 stars 12 forks source link

BuiltinsWriterVisitor: Replace dynamic subtype abstract methods with overridable default implementations, throwing NotImplementedException #50

Closed zspitz closed 3 years ago

zspitz commented 4 years ago

There are currently three classes that inherit from BuiltinsWriterVisitor:

We're planning on adding two more:

Of all of these, only CodeWriterVisitor provides implementations for the dynamic submethods: WriteBinaryOperationBinder, WriteConvertBinder etc. All the others handle everything in VisitDynamic.

We could move these from abstract to virtual methods in BuiltinsWriterVisitor, throwing a NotImplementedException in the default implementation.

Alternatively, we could move these abstract methods out to CodeWriterVisitor, where they could be changed to non-overridable.

zspitz commented 3 years ago

70 is a better choice than throwing handled exceptions.