Skip to content

Commit

Permalink
compiler: code generation support for functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Apr 3, 2024
1 parent e2117aa commit e5d6464
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/julec/obj/cxx/object.jule
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ impl ObjectCoder {
self.write("\n\n")
self.globals()
}

fn structure_methods(mut &self, mut &s: &StructIns) {
for (_, mut f) in s.methods {
self.func(f)
Expand Down Expand Up @@ -861,6 +861,22 @@ impl ObjectCoder {
}
}

fn funcs(mut &self) {
self.iter_packages(fn(mut &pkg: &Package) {
iter_files(pkg, fn(mut &file: &SymbolTable) {
for (_, mut f) in file.funcs {
if !env::TEST && has_directive(f.directives, Directive.Test) {
continue
}
if !f.cpp_linked && f.token != nil {
self.func(f)
self.write("\n\n")
}
}
})
})
}

pub fn serialize(mut &self) {
self.prepare_structures()
self.build_trait_map()
Expand All @@ -870,6 +886,7 @@ impl ObjectCoder {
self.decls()
self.write("\n")
self.structures()
self.funcs()
}
}

Expand Down

0 comments on commit e5d6464

Please sign in to comment.