Skip to content

Commit

Permalink
Merge pull request #82 from peterhuene/update-parser
Browse files Browse the repository at this point in the history
Reimplement `wac-parser` on `wac-graph`.
  • Loading branch information
peterhuene authored Apr 15, 2024
2 parents dbffafd + a38e629 commit 75f2f37
Show file tree
Hide file tree
Showing 96 changed files with 3,894 additions and 9,437 deletions.
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

0 comments on commit 75f2f37

Please sign in to comment.