xtclang / xvm

Ecstasy and XVM
Other
201 stars 17 forks source link

Fix the compilation of short-hand property declarations #188

Closed ggleyzer closed 6 months ago

ggleyzer commented 6 months ago

There are three different fixes in this change:

  1. There was a incorrect call to setParent with a null argument, causing an AnnotatedTypeExpression to become "orphaned" and causing an NPE during the compilation.

  2. For short-hand class declarations, we create a synthetic PropertyDeclarationStatement and used to simply ask it to create corresponding structures (properties). The problem with this approach was that the newly created PDS was immediately "orphaned" and therefore never validated properly. The change in TypeCompositionStatement.java adds it to the statement body and catches up to the current (Registered) stage, which does everything it used to do plus allowing the validation logic to be performed on it at during the validation phase.

  3. The compiler fix revealed an incorrect class declaration in TxManager.x. The Requirement const used to be declared as static, but it refers to DBObjectImpl, which is a typedef that depends on the formal type parameter Schema, which is not avaliable outside of the TxManager context.

cpurdy commented 6 months ago

Reviewed latest with Gene -- looks good!