initiate hhbc_hhas.rs, a bytecode printing module
commita8fe927e3f83c2665c763001a96d8f5ffa043fff
authorSteve Cao <shiqicao@fb.com>
Mon, 27 Jan 2020 23:59:49 +0000 (27 15:59 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 28 Jan 2020 00:19:08 +0000 (27 16:19 -0800)
tree7d9db2df257fa6f3adc5b72b35e5702d1dcfce8d
parentdb4e32857a3c28955d73fb8dba7a71d42b7758ac
initiate hhbc_hhas.rs, a bytecode printing module

Summary:
- hhbc_hhas.ml prints bytecode from `Hhas` and aast, Ocaml version converts it to a list of string. List of string is like to avoid string concatenation. In Rust, a `Write` trait is introduced, it is meant be an abstraction over various channels can take string. An implementation for `std::fmt::Write` is added, therefore `String` implements `Write`,
- a set of write utilities are included to catch common patterns,
- in Compile.rs, a `String` is passed to `print_program`, later it will be changed to std output or file handlers.

Reviewed By: losvald

Differential Revision: D19458379

fbshipit-source-id: c6094e053b3a273c056648efe064766daa78d825
hphp/hack/Cargo.lock
hphp/hack/src/hhbc/cargo/hhbc_hhas/Cargo.toml
hphp/hack/src/hhbc/compile.rs
hphp/hack/src/hhbc/hhbc_hhas.rs [deleted file]
hphp/hack/src/hhbc/print.rs [new file with mode: 0644]
hphp/hack/src/hhbc/print_env.rs [new file with mode: 0644]
hphp/hack/src/hhbc/write.rs [new file with mode: 0644]