Fix a bug that class variable can't be referenced from class method

Class method defined in singleton class should be evaluated in class
context not singleton class context.

fix #2515