Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/codegen/src/get_node_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,9 @@ fn custom_handlers(node: &Node) -> TokenStream {
} }
// if its a list, we handle it in the handler for `List`
},
protobuf::ObjectType::ObjectType => {
tokens.push(TokenProperty::from(Token::TypeP));
},
_ => panic!("Unknown DefineStmt {:#?}", n.kind()),
}
},
Expand Down
13 changes: 13 additions & 0 deletions crates/parser/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,19 @@ mod tests {

#[test]
fn test_create_type() {
test_get_node_properties(
"create type type1",
SyntaxKind::DefineStmt,
vec![
TokenProperty::from(SyntaxKind::Create),
TokenProperty::from(SyntaxKind::TypeP),
TokenProperty::from("type1".to_string()),
],
)
}

#[test]
fn test_create_composite_type() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: create type as constitute a composite type

test_get_node_properties(
"create type type1 as (attr1 int4, attr2 bool);",
SyntaxKind::CompositeTypeStmt,
Expand Down