Factor out JS expression checking
Fix handling comments of non output nodes (like type declarations)