Skip to content

Commit

Permalink
* 处理下划线开头函数名转换
Browse files Browse the repository at this point in the history
  • Loading branch information
ccnyou committed Jan 19, 2017
1 parent 6b224cf commit 39fe902
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion js/JPContext.js
Expand Up @@ -85,7 +85,16 @@ var JPMethodContext = function() {
JPMethodContext.prototype = Object.create(JPContext.prototype);
JPMethodContext.prototype.parse = function(){
var ctx = this;
var script = this.ignore ? '' : this.names.join('_') + ": function(" + this.params.join(',') + ") {"
var script = ''
if (!this.ignore) {
var firstName = this.names[0]
if (firstName[0] == '_') {
// 处理下划线开头函数名
firstName = "_" + firstName;
this.names[0] = firstName;
}
script = this.names.join('_') + ": function(" + this.params.join(',') + ") {"
}

while (ctx = ctx.next) {
script += ctx.parse();
Expand Down

0 comments on commit 39fe902

Please sign in to comment.