ENYO-3571: fix bad insertion of auto-generated functions

Related JIRA: https://enyojs.atlassian.net/browse/ENYO-3571

* ENYO-3571: fix comma issue due to position calcutation that provides a range with column values equal to -1. This value generates the issue
* ENYO-3571: fix a wrong function insertion when last function is followed by a comma

Enyo-DCO-1.1-Signed-off-by: Vincent HERILIER vincent.herilier@hp.com