Migrate Source code generator to method instead of function.