Skip to content

Commit

Permalink
Tests are passing now
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpita-Jaiswal committed Nov 22, 2024
1 parent ca74295 commit 3e7da2a
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions ftd/src/interpreter/tdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2214,26 +2214,34 @@ impl<'a> TDoc<'a> {

impl<'a> fastn_resolved::tdoc::TDoc for TDoc<'a> {
fn get_opt_function(&self, name: &str) -> Option<Function> {
let initial_thing = self.get_reexport_thing(name, 0).ok()?.0;
initial_thing.function(self.name, 0).ok().clone()
match self.get_thing(name, 0).ok()? {
ftd::interpreter::Thing::Function(r) => Some(r),
_ => None,
}
}

fn get_opt_record(&self, name: &str) -> Option<Record> {
let initial_thing = self.get_reexport_thing(name, 0).ok()?.0;
initial_thing.record(self.name, 0).ok().clone()
match self.get_thing(name, 0).ok()? {
ftd::interpreter::Thing::Record(r) => Some(r),
_ => None,
}
}

fn name(&self) -> &str {
self.name
}

fn get_opt_component(&self, name: &str) -> Option<ComponentDefinition> {
let initial_thing = self.get_reexport_thing(name, 0).ok()?.0;
initial_thing.clone().component()
match self.get_thing(name, 0).ok()? {
ftd::interpreter::Thing::Component(c) => Some(c),
_ => None,
}
}

fn get_opt_web_component(&self, name: &str) -> Option<fastn_resolved::WebComponentDefinition> {
let initial_thing = self.get_reexport_thing(name, 0).ok()?.0;
initial_thing.web_component(self.name, 0).ok().clone()
match self.get_thing(name, 0).ok()? {
ftd::interpreter::Thing::WebComponent(c) => Some(c),
_ => None,
}
}
}

0 comments on commit 3e7da2a

Please sign in to comment.