diff --git a/enterprise-compiler/src/lib.rs b/enterprise-compiler/src/lib.rs index 9b837f3..0e53e07 100644 --- a/enterprise-compiler/src/lib.rs +++ b/enterprise-compiler/src/lib.rs @@ -9,7 +9,6 @@ mod visitor; use std::collections::HashMap; -use petgraph::{dot::Dot, graph::Graph}; use proc_macro2::TokenStream; use syn::Expr; @@ -29,10 +28,8 @@ fn process( let new_dom = visitor.make_graph(&dom); let toplevel_names = visitor.gen_code(&new_dom); - // println!("{:?}", visitor); - println!("DOT:"); - let graph: Graph<_, _, _> = visitor.deps.clone().into_graph(); - println!("{:?}", Dot::new(&graph)); + // let graph: Graph<_, _, _> = visitor.deps.clone().into_graph(); + // println!("{:?}", Dot::new(&graph)); let name = format_ident!("{}", name); let mut model = TokenStream::new(); @@ -85,7 +82,7 @@ fn process( } #[proc_macro] -pub fn example(input_tokens: proc_macro::TokenStream) -> proc_macro::TokenStream { +pub fn example(_input_tokens: proc_macro::TokenStream) -> proc_macro::TokenStream { let helloworld_datamodel: HashMap = hashmap! { "name".into() => "String".into(), }; diff --git a/enterprise-compiler/src/visitor.rs b/enterprise-compiler/src/visitor.rs index 6a28e1b..efd43ee 100644 --- a/enterprise-compiler/src/visitor.rs +++ b/enterprise-compiler/src/visitor.rs @@ -15,8 +15,10 @@ type Id = Symbol; #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub enum TagLhs { Bind(String), - On(String), - Plain(String), + // On(String), + // Plain(String), + #[doc(hidden)] + _Nonexhaustive, } #[derive(Debug, Default)] @@ -31,6 +33,9 @@ pub enum Rsx { Elem(Elem), Code(Expr), Text(String), + + #[doc(hidden)] + _Nonexhaustive, } #[derive(Debug)] @@ -38,12 +43,16 @@ pub enum TaggedRsx { Elem(Id, Elem), Code(Id, Expr), Text(Id, String), + + #[doc(hidden)] + _Nonexhaustive, } impl TaggedRsx { pub fn get_id(&self) -> Id { match self { TaggedRsx::Elem(id, _) | TaggedRsx::Code(id, _) | TaggedRsx::Text(id, _) => *id, + _ => unimplemented!(), } } } @@ -60,11 +69,6 @@ pub enum DepNode { ModelValue(Symbol), } -#[derive(Debug)] -enum DepActions { - Updates, -} - type DependencyGraph = DiGraphMap; #[derive(Default, Debug)] @@ -138,6 +142,7 @@ impl Visitor { TaggedRsx::Code(node_id, expr.clone()) } Rsx::Text(literal) => TaggedRsx::Text(node_id, literal.clone()), + _ => unimplemented!(), }; new_nodes.push(new_node); } @@ -150,7 +155,7 @@ impl Visitor { let node_str = node.get_id().as_str(); let make_node_id = format_ident!("make_{}", node_str); match node { - TaggedRsx::Elem(node_id, Elem { tag, attrs, inner }) => { + TaggedRsx::Elem(node_id, Elem { tag, inner, .. }) => { let mut updates = TokenStream::new(); if let Some(this_attrs) = self.elem_attr_map.get(node_id) { for attr in this_attrs { @@ -159,7 +164,6 @@ impl Visitor { let mut update_func = TokenStream::new(); while let Some(nx) = dfs.next(&self.deps) { if nx != starting { - println!("NX: {:?}", nx); match nx { DepNode::ModelValue(sym) => { let sym_name = format_ident!( @@ -206,24 +210,24 @@ impl Visitor { self.impl_code.extend(quote! { fn #make_node_id(&self) -> impl stdweb::web::INode { let el = document().create_element(#tag).unwrap(); - el.set_attribute("id", #node_str); + el.set_attribute("id", #node_str).unwrap(); #updates el } }); self.gen_code(&inner); } - TaggedRsx::Code(node_id, expr) => { + TaggedRsx::Code(_, _) => { self.impl_code.extend(quote! { #[inline] fn #make_node_id(&self) -> impl stdweb::web::INode { let el = document().create_element("span").expect("shouldn't fail"); - el.set_attribute("id", #node_str); + el.set_attribute("id", #node_str).unwrap(); el } }); } - TaggedRsx::Text(node_id, literal) => { + TaggedRsx::Text(_, literal) => { self.impl_code.extend(quote! { #[inline] fn #make_node_id(&self) -> impl stdweb::web::INode { @@ -231,7 +235,7 @@ impl Visitor { } }); } - _ => (), + _ => unimplemented!(), } names.push(format!("{}", make_node_id)); } diff --git a/src/main.rs b/src/main.rs index ad29d98..c7d5c3c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,9 +12,8 @@ use stdweb::{ unstable::TryFrom, web::{ document, html_element::InputElement, Element, IElement, IEventTarget, INode, - INonElementParentNode, TextNode, + INonElementParentNode, }, - Reference, Value, }; use crate::backend::{Backend, Web};