diff --git a/gersemi/command_invocation_dumpers/target_link_libraries_command_dumper.py b/gersemi/command_invocation_dumpers/target_link_libraries_command_dumper.py index cbbf744..00d4ab3 100644 --- a/gersemi/command_invocation_dumpers/target_link_libraries_command_dumper.py +++ b/gersemi/command_invocation_dumpers/target_link_libraries_command_dumper.py @@ -12,6 +12,9 @@ class IsolateConfigurationTypeAndItem(Transformer_InPlace): def arguments(self, children): new_children = [] + if len(children) < 2: + return Tree("arguments", new_children) + iterator = zip(children, children[1:]) is_one_of_defined_keywords = is_one_of_keywords(self.keywords) for one_behind, current in iterator: diff --git a/tests/formatter/issue_0013_meaningless_target_link_libraries_should_be_valid_code.in.cmake b/tests/formatter/issue_0013_meaningless_target_link_libraries_should_be_valid_code.in.cmake new file mode 100644 index 0000000..5fa7498 --- /dev/null +++ b/tests/formatter/issue_0013_meaningless_target_link_libraries_should_be_valid_code.in.cmake @@ -0,0 +1 @@ +target_link_libraries(foo) diff --git a/tests/formatter/issue_0013_meaningless_target_link_libraries_should_be_valid_code.out.cmake b/tests/formatter/issue_0013_meaningless_target_link_libraries_should_be_valid_code.out.cmake new file mode 100644 index 0000000..5fa7498 --- /dev/null +++ b/tests/formatter/issue_0013_meaningless_target_link_libraries_should_be_valid_code.out.cmake @@ -0,0 +1 @@ +target_link_libraries(foo)