diff --git a/v0.5/fastn-lang/src/compiler.rs b/v0.5/fastn-lang/src/compiler.rs index d98923784..c82506b88 100644 --- a/v0.5/fastn-lang/src/compiler.rs +++ b/v0.5/fastn-lang/src/compiler.rs @@ -15,8 +15,8 @@ pub async fn compile( ) -> Result { // this guy will maintain symbols that failed to resolve, along with their dependencies, or maybe // just the one dependency that failed? - let _d = fastn_unresolved::parse(document_id, source); - for c in _d.content {} + let d = fastn_unresolved::parse(document_id, source); + for _c in d.content {} todo!() } diff --git a/v0.5/fastn-unresolved/src/lib.rs b/v0.5/fastn-unresolved/src/lib.rs index aff5bd95e..27061f5ba 100644 --- a/v0.5/fastn-unresolved/src/lib.rs +++ b/v0.5/fastn-unresolved/src/lib.rs @@ -35,15 +35,15 @@ pub struct Definition { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub enum InnerDefinition { Component { - properties: Vec, + properties: Vec, body: Vec, }, Variable { - arguments: Vec, + arguments: Vec, caption: Vec, }, Function { - properties: Vec, + properties: Vec, return_type: Option, body: Vec, }, @@ -51,10 +51,10 @@ pub enum InnerDefinition { // name: foo ;; we are updating / setting the default value TypeAlias { kind: Kind, - arguments: Vec, + arguments: Vec, }, Record { - properties: Vec, + properties: Vec, }, // TODO: OrType(fastn_section::Section), // TODO: Module(fastn_section::Section), @@ -69,23 +69,43 @@ pub struct Import { pub exposing: Option, } +// #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)] +// pub struct ComponentInvocation { +// #[serde(skip_serializing_if = "Option::is_none")] +// pub id: Option, +// pub name: String, +// pub properties: Vec, +// pub iteration: Box>, +// pub condition: Box>, +// pub events: Vec, +// pub children: Vec, +// pub source: ComponentSource, +// pub line_number: usize, +// } + +#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)] +pub enum UR { + Resolved(R), + UnResolved(U), +} + #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)] pub struct ComponentInvocation { - pub name: Identifier, + pub name: UR, pub caption: Option, - pub arguments: Vec, + pub properties: Vec, pub body: Vec, pub children: Vec, } #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)] -pub struct Argument { +pub struct Property { pub name: Identifier, pub value: Vec, } #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)] -pub struct Property { +pub struct Argument { pub name: Identifier, pub kind: Kind, pub visibility: fastn_section::Visibility, diff --git a/v0.5/fastn-unresolved/src/parser/component_invocation.rs b/v0.5/fastn-unresolved/src/parser/component_invocation.rs index dcfa1b0f4..c2340e81b 100644 --- a/v0.5/fastn-unresolved/src/parser/component_invocation.rs +++ b/v0.5/fastn-unresolved/src/parser/component_invocation.rs @@ -13,11 +13,11 @@ pub(super) fn component_invocation( document .content .push(fastn_unresolved::ComponentInvocation { - name: fastn_unresolved::Identifier(section.name(source).to_string()), + name: fastn_unresolved::Identifier(section.name(source).to_string()).into(), caption: section.caption, - arguments: vec![], // todo - body: vec![], // todo - children: vec![], // todo + properties: vec![], // todo + body: vec![], // todo + children: vec![], // todo }) } diff --git a/v0.5/fastn-unresolved/src/utils.rs b/v0.5/fastn-unresolved/src/utils.rs index 31a673e6d..c2f8a59f9 100644 --- a/v0.5/fastn-unresolved/src/utils.rs +++ b/v0.5/fastn-unresolved/src/utils.rs @@ -88,3 +88,9 @@ impl std::str::FromStr for fastn_unresolved::Identifier { Ok(fastn_unresolved::Identifier(s.to_string())) } } + +impl From for fastn_unresolved::UR { + fn from(u: U) -> fastn_unresolved::UR { + fastn_unresolved::UR::UnResolved(u) + } +}