Skip to content

Commit

Permalink
Moved resolver to fastn_resolved_to_js
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpita-Jaiswal committed Nov 20, 2024
1 parent 3808e07 commit 2b984e6
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 156 deletions.
8 changes: 8 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"fastn-lang",
"fastn-package",
"fastn-resolved",
"fastn-resolved-to-js",
"fastn-update",
"fastn-utils",
"fbt",
Expand Down Expand Up @@ -92,6 +93,7 @@ fastn-ds.path = "fastn-ds"
fastn-update.path = "fastn-update"
fastn-builtins.path = "fastn-builtins"
fastn-resolved = { path = "fastn-resolved", version = "0.1.0" }
fastn-resolved-to-js.path = "fastn-resolved-to-js"
fastn-core.path = "fastn-core"
fastn-issues.path = "fastn-issues"
fastn-package.path = "fastn-package"
Expand Down
12 changes: 12 additions & 0 deletions fastn-resolved-to-js/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "fastn-resolved-to-js"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
description.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true

[dependencies]
fastn-js.workspace = true
4 changes: 4 additions & 0 deletions fastn-resolved-to-js/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extern crate self as fastn_resolved_to_js;

mod resolver;
pub use resolver::ResolverData;
16 changes: 8 additions & 8 deletions ftd/src/js/resolver.rs → fastn-resolved-to-js/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct ResolverData<'a> {
}

impl<'a> ResolverData<'a> {
pub(crate) fn none() -> ResolverData<'a> {
pub fn none() -> ResolverData<'a> {
ResolverData {
component_definition_name: &None,
record_definition_name: &None,
Expand All @@ -24,15 +24,15 @@ impl<'a> ResolverData<'a> {
}
}

pub(crate) fn new_with_component_definition_name(
pub fn new_with_component_definition_name(
component_definition_name: &'a Option<String>,
) -> ResolverData<'a> {
let mut rdata = ResolverData::none();
rdata.component_definition_name = component_definition_name;
rdata
}

pub(crate) fn clone_with_default_inherited_variable(&self) -> ResolverData<'a> {
pub fn clone_with_default_inherited_variable(&self) -> ResolverData<'a> {
ResolverData {
component_definition_name: self.component_definition_name,
record_definition_name: self.record_definition_name,
Expand All @@ -45,7 +45,7 @@ impl<'a> ResolverData<'a> {
}
}

pub(crate) fn clone_with_new_inherited_variable(
pub fn clone_with_new_inherited_variable(
&self,
inherited_variable_name: &'a str,
) -> ResolverData<'a> {
Expand All @@ -61,7 +61,7 @@ impl<'a> ResolverData<'a> {
}
}

pub(crate) fn clone_with_new_component_name(
pub fn clone_with_new_component_name(
&self,
component_name: Option<String>,
) -> ResolverData<'a> {
Expand All @@ -77,7 +77,7 @@ impl<'a> ResolverData<'a> {
}
}

pub(crate) fn clone_with_new_device(
pub fn clone_with_new_device(
&self,
device: &'a Option<fastn_js::DeviceType>,
) -> ResolverData<'a> {
Expand All @@ -93,7 +93,7 @@ impl<'a> ResolverData<'a> {
}
}

pub(crate) fn clone_with_new_loop_alias(
pub fn clone_with_new_loop_alias(
&self,
loop_alias: &'a Option<String>,
loop_counter_alias: &'a Option<String>,
Expand All @@ -111,7 +111,7 @@ impl<'a> ResolverData<'a> {
}
}

pub(crate) fn clone_with_new_record_definition_name(
pub fn clone_with_new_record_definition_name(
&self,
record_definition_name: &'a Option<String>,
) -> ResolverData<'a> {
Expand Down
2 changes: 1 addition & 1 deletion fastn-resolved/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ mod component;
pub mod evalexpr;
mod expression;
mod function;
pub mod js;
mod kind;
mod module_thing;
mod or_type;
mod record;
pub mod tdoc;
mod value;
mod variable;
mod web_component;
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions ftd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ fastn-js.workspace = true
indexmap.workspace = true
fastn-resolved.workspace = true
fastn-builtins.workspace = true
fastn-resolved-to-js.workspace = true

[dev-dependencies]
diffy.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion ftd/src/interpreter/tdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2217,7 +2217,7 @@ impl<'a> TDoc<'a> {
}
}

impl<'a> fastn_resolved::js::TDoc for TDoc<'a> {
impl<'a> fastn_resolved::tdoc::TDoc for TDoc<'a> {
fn get_opt_function(&self, name: &str, line_number: usize) -> Option<Function> {
let initial_thing = self.get_initial_thing(name, line_number).ok()?.0;
initial_thing.function(self.name, line_number).ok()
Expand Down
Loading

0 comments on commit 2b984e6

Please sign in to comment.