Fix constants extractor to not include constants used in class methods and blocks