hhvm / hack-codegen

Library to programatically generate Hack code and write it to signed files
https://hhvm.github.io/hack-codegen/
MIT License
341 stars 93 forks source link

Support for rendering enums in CodegenFile #113

Closed gmarcotte closed 5 years ago

gmarcotte commented 5 years ago

Summary: In commit cd388d6c24cbeb3a5b55e6226274e63dcc6ce189 to hhvm/hack-codegen, CodegenEnum stopped extending CodegenClassish, which means that CodegenFile::addClass can no longer be used to add an Enum into CodegenFile.

This diff adds methods CodegenFile::addEnum[s]/getEnums identical to addClass[es]/getClasses but that operate on CodegenEnum instances. When the CodegenFile is rendered, enums will be rendered after constants and before any functions or classes.

Test Plan: Add a test case into tests/CodegenFileTest

fredemmott commented 5 years ago

@gmarcotte just want to say thanks, and we're aware of this PR, and it LGTM. I'm holding off on merging it until unrelated issues with the nightlies are fixed

fredemmott commented 5 years ago

merged as 9af145b58e68e472930e913cc6390242b5a56da1

gmarcotte commented 5 years ago

thanks @fredemmott !

youareawesome :)