Skip to content

Commit 75f2f37

Browse files
authored
Merge pull request #82 from peterhuene/update-parser
Reimplement `wac-parser` on `wac-graph`.
2 parents dbffafd + a38e629 commit 75f2f37

96 files changed

Lines changed: 3894 additions & 9437 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ keywords = ["webassembly", "wasm", "components", "component-model"]
1919
repository = "https://github.com/bytecodealliance/wac"
2020

2121
[dependencies]
22+
wac-types = { workspace = true }
23+
wac-graph = { workspace = true }
2224
wac-resolver = { workspace = true, default-features = false }
2325
wac-parser = { workspace = true, default-features = false }
2426
anyhow = { workspace = true }
@@ -30,7 +32,6 @@ owo-colors = { workspace = true }
3032
serde = { workspace = true }
3133
serde_json = { workspace = true }
3234
wat = { workspace = true }
33-
wasmparser = { workspace = true }
3435
wasmprinter = { workspace = true }
3536
thiserror = { workspace = true }
3637
indexmap = { workspace = true }

crates/wac-graph/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ semver = { workspace = true }
2121
serde = { workspace = true, optional = true }
2222
wasm-encoder = { workspace = true }
2323
log = { workspace = true }
24+
wasm-metadata = { workspace = true }
2425

2526
[dev-dependencies]
2627
pretty_assertions = { workspace = true }

crates/wac-graph/src/encoding.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use crate::{NodeId, PackageId};
1+
use crate::PackageId;
22
use indexmap::IndexMap;
3+
use petgraph::graph::NodeIndex;
34
use std::collections::HashMap;
45
use wac_types::{
56
CoreExtern, DefinedType, DefinedTypeId, Enum, Flags, FuncResult, FuncTypeId, InterfaceId,
@@ -116,11 +117,11 @@ pub struct State {
116117
/// The current encoding scope.
117118
pub current: Scope,
118119
/// A map of nodes in the graph to their encoded indexes.
119-
pub node_indexes: HashMap<NodeId, u32>,
120+
pub node_indexes: HashMap<NodeIndex, u32>,
120121
/// The map of package identifiers to encoded components (either imported or defined).
121122
pub packages: HashMap<PackageId, u32>,
122123
/// A map of instantiation nodes to a list of their encoded implicitly imported arguments.
123-
pub implicit_args: HashMap<NodeId, Vec<(String, ComponentExportKind, u32)>>,
124+
pub implicit_args: HashMap<NodeIndex, Vec<(String, ComponentExportKind, u32)>>,
124125
}
125126

126127
impl State {

0 commit comments

Comments
 (0)