anachronauts / jeff65

a compiler targeting the Commodore 64 with gold-syntax
GNU General Public License v3.0
6 stars 0 forks source link

Simplify transformation visitor pattern impl #36

Closed jdpage closed 6 years ago

jdpage commented 6 years ago

Previously, we'd have AstNode.transform dynamically call the enter_ and exit_ methods. Then the pattern system would implement __getattr__ to catch all of them, which makes it hard to follow.

Now, AstNode.transform calls transform_enter and transform_exit, and the base transformer does the dynamic dispatch. The pattern system doesn't inherit from it, so no dynamic behavior there.

As a side benefit, this also simplified inheriting from ScopedPass.

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 203


Changes Missing Coverage Covered Lines Changed/Added Lines %
jeff65/gold/pattern.py 11 15 73.33%
<!-- Total: 36 40 90.0% -->
Totals Coverage Status
Change from base Build 193: 1.3%
Covered Lines: 1127
Relevant Lines: 1305

💛 - Coveralls