Skip to content

Commit 36685c7

Browse files
committed
feat: partial support for resources
This adds support for resources to gravity. It's a pretty huge change and I'm not sure it's ready for review yet (or maybe ever), but it's a decent PoC. Much of the code was written by Claude with a huge amount of guidance, so it will probably need some cleanup. The main limitations are a lack of support for 'owned' resources as parameters because it involves a lot of complexity re. tracking ownership of resources. Even so this is quite useful for many things. Relates to arcjet#5.
1 parent cf16cfc commit 36685c7

File tree

21 files changed

+3367
-121
lines changed

21 files changed

+3367
-121
lines changed

Cargo.lock

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

cmd/gravity/src/codegen/bindings.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<'a> Bindings<'a> {
5656
pub fn generate(&mut self) {
5757
let (imports, chains) = self.generate_imports();
5858
self.generate_factory(&imports, chains);
59-
self.generate_exports(&imports.instance_name);
59+
self.generate_exports(&imports.instance_name, &imports);
6060
}
6161

6262
/// Generates the imports for the bindings.
@@ -89,12 +89,13 @@ impl<'a> Bindings<'a> {
8989
///
9090
/// Note: for now this only generates functions; types and interfaces are
9191
/// still TODO
92-
fn generate_exports(&mut self, instance: &GoIdentifier) {
92+
fn generate_exports(&mut self, instance: &GoIdentifier, analyzed_imports: &AnalyzedImports) {
9393
let config = ExportConfig {
9494
instance,
9595
world: self.world,
9696
resolve: self.resolve,
9797
sizes: self.sizes,
98+
analyzed_imports,
9899
};
99100
ExportGenerator::new(config).format_into(&mut self.out)
100101
}

0 commit comments

Comments
 (0)