diff --git a/Cargo.lock b/Cargo.lock index cf0721b16..e8eaa1f9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1609,7 +1609,7 @@ dependencies = [ [[package]] name = "fastn-resolved" -version = "0.1.0" +version = "0.1.1" dependencies = [ "serde", ] diff --git a/fastn-resolved-to-js/src/element.rs b/fastn-resolved-to-js/src/element.rs index d0a66e085..0d2c63d06 100644 --- a/fastn-resolved-to-js/src/element.rs +++ b/fastn-resolved-to-js/src/element.rs @@ -10,7 +10,7 @@ pub enum Element { Boolean(Boolean), Column(Column), Row(Row), - ContainerElement(ContainerElement), + Container(ContainerElement), Image(Image), Audio(Audio), Video(Video), @@ -35,7 +35,7 @@ impl Element { "ftd#boolean" => Element::Boolean(Boolean::from(component)), "ftd#column" => Element::Column(Column::from(component)), "ftd#row" => Element::Row(Row::from(component)), - "ftd#container" => Element::ContainerElement(ContainerElement::from(component)), + "ftd#container" => Element::Container(ContainerElement::from(component)), "ftd#image" => Element::Image(Image::from(component)), "ftd#video" => Element::Video(Video::from(component)), "ftd#audio" => Element::Audio(Audio::from(component)), @@ -99,7 +99,7 @@ impl Element { should_return, has_rive_components, ), - Element::ContainerElement(container) => container.to_component_statements( + Element::Container(container) => container.to_component_statements( parent, index, doc, @@ -2232,6 +2232,7 @@ impl TextCommon { } #[derive(Debug)] +#[allow(dead_code)] pub struct Rive { pub src: fastn_resolved_to_js::Value, pub canvas_width: Option, diff --git a/fastn-resolved-to-js/src/fastn_type_functions.rs b/fastn-resolved-to-js/src/fastn_type_functions.rs index 85350ca4c..15462385b 100644 --- a/fastn-resolved-to-js/src/fastn_type_functions.rs +++ b/fastn-resolved-to-js/src/fastn_type_functions.rs @@ -198,8 +198,6 @@ impl ValueExt for fastn_resolved::Value { variant, full_variant, value, - doc.name(), - value.line_number(), ); if has_value { return fastn_js::SetPropertyValue::Value(fastn_js::Value::OrType { diff --git a/fastn-resolved-to-js/src/utils.rs b/fastn-resolved-to-js/src/utils.rs index dbd451e50..0388eb5ba 100644 --- a/fastn-resolved-to-js/src/utils.rs +++ b/fastn-resolved-to-js/src/utils.rs @@ -108,10 +108,6 @@ pub(crate) fn to_key(key: &str) -> String { .to_string() } -pub(crate) fn update_reference_with_none(reference: &str) -> String { - update_reference(reference, &fastn_resolved_to_js::ResolverData::none()) -} - pub(crate) fn update_reference( reference: &str, rdata: &fastn_resolved_to_js::ResolverData, diff --git a/fastn-resolved-to-js/src/value.rs b/fastn-resolved-to-js/src/value.rs index 0f4974de9..1ab031cdd 100644 --- a/fastn-resolved-to-js/src/value.rs +++ b/fastn-resolved-to-js/src/value.rs @@ -14,19 +14,6 @@ pub struct ReferenceData { } impl Value { - pub(crate) fn to_set_property_value_with_none( - &self, - doc: &dyn fastn_resolved::tdoc::TDoc, - has_rive_components: &mut bool, - ) -> fastn_js::SetPropertyValue { - self.to_set_property_value_with_ui( - doc, - &fastn_resolved_to_js::ResolverData::none(), - has_rive_components, - false, - ) - } - pub(crate) fn to_set_property_value( &self, doc: &dyn fastn_resolved::tdoc::TDoc, @@ -61,8 +48,6 @@ impl Value { variant.as_str(), full_variant.as_str(), value, - doc.name(), - value.line_number(), ); // return or-type value with reference @@ -228,7 +213,6 @@ impl ExpressionExt for fastn_resolved::Expression { pub(crate) trait ArgumentExt { fn get_default_value(&self) -> Option; - fn get_value(&self, properties: &[fastn_resolved::Property]) -> fastn_resolved_to_js::Value; fn get_optional_value( &self, properties: &[fastn_resolved::Property], @@ -261,15 +245,6 @@ impl ArgumentExt for fastn_resolved::Argument { None } } - fn get_value(&self, properties: &[fastn_resolved::Property]) -> fastn_resolved_to_js::Value { - if let Some(value) = self.get_optional_value(properties) { - value - } else if let Some(value) = self.get_default_value() { - value - } else { - panic!("{}", format!("Expected value for argument: {:?}", &self)) - } - } fn get_optional_value( &self, @@ -327,8 +302,6 @@ pub(crate) fn ftd_to_js_variant( variant: &str, full_variant: &str, value: &fastn_resolved::PropertyValue, - doc_id: &str, - line_number: usize, ) -> (String, bool) { // returns (JSVariant, has_value) let variant = variant diff --git a/fastn-resolved/Cargo.toml b/fastn-resolved/Cargo.toml index 5c20c75b4..486ec5350 100644 --- a/fastn-resolved/Cargo.toml +++ b/fastn-resolved/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fastn-resolved" -version = "0.1.0" +version = "0.1.1" authors.workspace = true edition.workspace = true description.workspace = true diff --git a/ftd/src/js/mod.rs b/ftd/src/js/mod.rs index 16ea2757c..713f1619f 100644 --- a/ftd/src/js/mod.rs +++ b/ftd/src/js/mod.rs @@ -23,7 +23,7 @@ pub fn default_bag_into_js_ast() -> Vec { let doc = ftd::interpreter::TDoc { name: "", aliases: &ftd::interpreter::default::default_aliases(), - bag: ftd::interpreter::BagOrState::Bag(&bag), + bag: ftd::interpreter::BagOrState::Bag(bag), }; let mut export_asts = vec![]; for thing in ftd::interpreter::default::get_default_bag().values() { diff --git a/v0.5/fastn-compiler/src/lib.rs b/v0.5/fastn-compiler/src/lib.rs index 9dc6a09b0..69311b2df 100644 --- a/v0.5/fastn-compiler/src/lib.rs +++ b/v0.5/fastn-compiler/src/lib.rs @@ -7,6 +7,7 @@ extern crate self as fastn_compiler; mod compiler; mod js; mod symbols; +mod tdoc; mod utils; pub use compiler::compile; diff --git a/v0.5/fastn-compiler/src/tdoc.rs b/v0.5/fastn-compiler/src/tdoc.rs new file mode 100644 index 000000000..24afa1f72 --- /dev/null +++ b/v0.5/fastn-compiler/src/tdoc.rs @@ -0,0 +1,4 @@ +pub struct TDoc { + bag: indexmap::IndexMap, +} +