refactoring IR
Add test cases
Merge branch 'master' into IR_refactor

Conflicts:
	lib/compiler/IR.js
Merge pull request #26 from infosia/IR_refactor

IR refactoring and test cases