scope management for class
function scope
functional style emitter
few fix