square / Cleanse

Lightweight Swift Dependency Injection Framework
Other
1.78k stars 90 forks source link

[cleansec] Fix seed parsing. #155

Closed sebastianv1 closed 4 years ago

sebastianv1 commented 4 years ago

The seed from a component was not being parsed correctly and would always result in the default Void type. Added unit test for coverage.

In some AST files we were seeing strange behavior where the leading parenthesis would insert a newline before the node definition. For example: (\ncall_decl .... For now, the best fix seems to consider at least 1 whitespace followed by an open parenthesis and newline has a valid newline start. This is because it's very likely that the following line is the actual call_decl, meaning the sanitizer will append it to the previous line, forming a valid node.

This is another case where the -dump-ast output format seems to be brittle sometimes. This is known, but worth calling out as an example.