Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement wac-parser on wac-graph. #82

Merged
merged 15 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ keywords = ["webassembly", "wasm", "components", "component-model"]
repository = "https://github.com/bytecodealliance/wac"

[dependencies]
wac-types = { workspace = true }
wac-graph = { workspace = true }
wac-resolver = { workspace = true, default-features = false }
wac-parser = { workspace = true, default-features = false }
anyhow = { workspace = true }
Expand All @@ -30,7 +32,6 @@ owo-colors = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
wat = { workspace = true }
wasmparser = { workspace = true }
wasmprinter = { workspace = true }
thiserror = { workspace = true }
indexmap = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/wac-graph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ semver = { workspace = true }
serde = { workspace = true, optional = true }
wasm-encoder = { workspace = true }
log = { workspace = true }
wasm-metadata = { workspace = true }

[dev-dependencies]
pretty_assertions = { workspace = true }
Expand Down
7 changes: 4 additions & 3 deletions crates/wac-graph/src/encoding.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{NodeId, PackageId};
use crate::PackageId;
use indexmap::IndexMap;
use petgraph::graph::NodeIndex;
use std::collections::HashMap;
use wac_types::{
CoreExtern, DefinedType, DefinedTypeId, Enum, Flags, FuncResult, FuncTypeId, InterfaceId,
Expand Down Expand Up @@ -116,11 +117,11 @@ pub struct State {
/// The current encoding scope.
pub current: Scope,
/// A map of nodes in the graph to their encoded indexes.
pub node_indexes: HashMap<NodeId, u32>,
pub node_indexes: HashMap<NodeIndex, u32>,
/// The map of package identifiers to encoded components (either imported or defined).
pub packages: HashMap<PackageId, u32>,
/// A map of instantiation nodes to a list of their encoded implicitly imported arguments.
pub implicit_args: HashMap<NodeId, Vec<(String, ComponentExportKind, u32)>>,
pub implicit_args: HashMap<NodeIndex, Vec<(String, ComponentExportKind, u32)>>,
}

impl State {
Expand Down
Loading
Loading