Skip to content

Commit e5d0482

Browse files
committed
Fix various remaining issues, bump versions
1 parent fa4fb73 commit e5d0482

File tree

20 files changed

+231
-123
lines changed

20 files changed

+231
-123
lines changed

.github/workflows/release-cli.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ codegen-units = 4
99
[profile.release-web]
1010
inherits = "release"
1111
opt-level = "s"
12-
strip = true

data/Empty.hx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Empty {
2+
static function main() {}
3+
}

hlbc-cli/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ All notable changes to this project will be documented in this file.
66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9-
## [Unreleased](https://github.com/Gui-Yom/hlbc/compare/cli-v0.5.0...HEAD)
9+
## [Unreleased](https://github.com/Gui-Yom/hlbc/compare/v0.6.0...HEAD)
10+
11+
## [0.6.0](https://github.com/Gui-Yom/hlbc/compare/v0.5.0...v0.6.0) - 2023-05-07
12+
13+
### Changed
1014

1115
- Updated to latest hlbc
1216

hlbc-cli/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hlbc-cli"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
authors = ["Guillaume Anthouard <[email protected]>"]
55
edition = "2021"
66
rust-version = "1.64"
@@ -27,9 +27,9 @@ chumsky = { version = "0.9" }
2727
# CLI args
2828
clap = { version = "4", features = ["derive"] }
2929
# Core functionnality
30-
hlbc = { version = "0.5", path = "../hlbc", default-features = false }
30+
hlbc = { version = "0.6", path = "../hlbc", default-features = false }
3131
# Decompiler
32-
hlbc-decompiler = { version = "0.5", path = "../hlbc-decompiler" }
32+
hlbc-decompiler = { version = "0.6", path = "../hlbc-decompiler" }
3333
# File system watching
3434
notify = { version = "5", optional = true, default-features = false, features = ["macos_fsevent"] }
3535
notify-debouncer-mini = { version = "0.2", optional = true, default-features = false }

hlbc-decompiler/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@ All notable changes to this project will be documented in this file.
66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9-
## [Unreleased](https://github.com/Gui-Yom/hlbc/compare/v0.5.0...HEAD)
9+
## [Unreleased](https://github.com/Gui-Yom/hlbc/compare/v0.6.0...HEAD)
10+
11+
## [0.6.0](https://github.com/Gui-Yom/hlbc/compare/v0.5.0...v0.6.0) - 2023-05-07
12+
13+
### Changed
1014

1115
- Updated to latest hlbc
1216

17+
### Fixed
18+
19+
- Fix `trace` ast post-processing step
20+
1321
## [0.5.0](https://github.com/Gui-Yom/hlbc/compare/v0.4.0...v0.5.0) - 2021-09-15
1422

1523
### Changed

hlbc-decompiler/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hlbc-decompiler"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
authors = ["Guillaume Anthouard <[email protected]>"]
55
edition = "2021"
66
rust-version = "1.56"
@@ -15,7 +15,7 @@ categories = ["visualization", "compilers"]
1515
[dependencies]
1616
# Advanced formatting functionalities
1717
fmtools = "0.1"
18-
hlbc = { version = "0.5", path = "../hlbc" }
18+
hlbc = { version = "0.6", path = "../hlbc" }
1919
# Graph utilities
2020
petgraph = { version = "0.6", default-features = false, features = ["graphmap"], optional = true }
2121

hlbc-decompiler/src/ast.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ pub struct Method {
3232
pub statements: Vec<Statement>,
3333
}
3434

35-
// TODO make this zero copy by accepting the Ref* types instead and only resolving on demand
36-
37-
#[derive(Debug, Clone)]
35+
#[derive(Debug, Clone, Copy)]
3836
pub enum Constant {
3937
InlineInt(usize),
4038
Int(RefInt),

hlbc-decompiler/src/fmt.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
use std::fmt;
22
use std::fmt::{Display, Formatter};
33

4-
use crate::ast::{Class, Constant, ConstructorCall, Expr, Method, Operation, Statement};
5-
use hlbc::fmt::EnhancedFmt;
4+
use hlbc::fmt::{BytecodeFmt, EnhancedFmt};
65
use hlbc::types::{Function, RefField, Type};
76
use hlbc::{Bytecode, Resolve};
87

8+
use crate::ast::{Class, Constant, ConstructorCall, Expr, Method, Operation, Statement};
9+
910
#[derive(Clone)]
1011
pub struct FormatOptions {
1112
indent: String,
@@ -100,17 +101,19 @@ impl Method {
100101
}
101102
}
102103

103-
impl Display for Constant {
104-
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
104+
impl Constant {
105+
fn fmt(&self, f: &mut Formatter, code: &Bytecode) -> fmt::Result {
105106
use Constant::*;
106-
match self {
107-
InlineInt(c) => Display::fmt(c, f),
108-
Int(c) => Display::fmt(c, f),
109-
Float(c) => Display::fmt(c, f),
110-
String(c) => write!(f, "\"{c}\""),
111-
Bool(c) => Display::fmt(c, f),
112-
Null => Display::fmt("null", f),
113-
This => Display::fmt("this", f),
107+
match *self {
108+
InlineInt(c) => Display::fmt(&c, f),
109+
Int(c) => EnhancedFmt.fmt_refint(f, code, c),
110+
Float(c) => EnhancedFmt.fmt_reffloat(f, code, c),
111+
String(c) => {
112+
write!(f, "\"{}\"", c.display::<EnhancedFmt>(code))
113+
}
114+
Bool(c) => Display::fmt(&c, f),
115+
Null => f.write_str("null"),
116+
This => f.write_str("this"),
114117
}
115118
}
116119
}
@@ -176,7 +179,7 @@ impl Expr {
176179
.enumerate()
177180
.map(|(i, f)| {
178181
fmtools::fmt! { move
179-
{f.name}": "{disp!(values.get(&RefField(i)).unwrap())}
182+
{f.name(code)}": "{disp!(values.get(&RefField(i)).unwrap())}
180183
}
181184
})) }"}"
182185
}
@@ -188,7 +191,7 @@ impl Expr {
188191
Expr::Call(call) => {
189192
{disp!(call.fun)}"("{fmtools::join(", ", call.args.iter().map(|e| disp!(e)))}")"
190193
}
191-
Expr::Constant(c) => {{c}},
194+
Expr::Constant(c) => {|f| c.fmt(f, code)?;},
192195
Expr::Constructor(ConstructorCall { ty, args }) => {
193196
"new "{ty.display::<EnhancedFmt>(code)}"("{fmtools::join(", ", args.iter().map(|e| disp!(e)))}")"
194197
}

0 commit comments

Comments
 (0)