Skip to content

Commit

Permalink
fix: match only "create aggregate" tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
cvng committed Dec 13, 2023
1 parent 14cd55b commit b0328ef
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions crates/codegen/src/get_node_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,23 +534,25 @@ fn custom_handlers(node: &Node) -> TokenStream {
tokens.push(TokenProperty::from(Token::Replace));
}
match n.kind() {
protobuf::ObjectType::ObjectAggregate => tokens.push(TokenProperty::from(Token::Aggregate)),
_ => todo!("Unknown DefineStmt {:#?}", n.kind())
}
if let Some(node) = &n.args[0].node {
if let NodeEnum::List(n) = node {
if n.items.len() == 2 {
tokens.push(TokenProperty::from(Token::Order));
tokens.push(TokenProperty::from(Token::By));
tokens.push(TokenProperty::from(Token::Ident));
protobuf::ObjectType::ObjectAggregate => {
tokens.push(TokenProperty::from(Token::Aggregate));
if let Some(node) = &n.args[0].node {
if let NodeEnum::List(n) = node {
if n.items.len() == 2 {
tokens.push(TokenProperty::from(Token::Order));
tokens.push(TokenProperty::from(Token::By));
tokens.push(TokenProperty::from(Token::Ident));
tokens.push(TokenProperty::from(Token::Ident));
}
}
} else {
tokens.push(TokenProperty::from(Token::Ascii42));
}
if n.definition.len() > 0 {
tokens.push(TokenProperty::from(Token::Ident));
}
}
} else {
tokens.push(TokenProperty::from(Token::Ascii42));
}
if n.definition.len() > 0 {
tokens.push(TokenProperty::from(Token::Ident));
},
_ => todo!("Unknown DefineStmt {:#?}", n.kind())
}
},
_ => quote! {},
Expand Down

0 comments on commit b0328ef

Please sign in to comment.