Comparing version 0.4.12 to 0.4.13
{ | ||
"name": "jsdc", | ||
"version": "0.4.12", | ||
"version": "0.4.13", | ||
"description": "compiler ecmascript6 to ecmascript5", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -55,7 +55,10 @@ var homunculus = require('homunculus'); | ||
self.jsdc.ignore(node.first(), 'gen6'); | ||
var state = self.jsdc.uid(); | ||
var state; | ||
var res = self.count(node.last().prev(), node); | ||
var count = res.count; | ||
if(count) { | ||
state = self.jsdc.uid(); | ||
} | ||
var temp = self.jsdc.uid(); | ||
var param = node.leaf(4).first(); | ||
var res = self.count(node.last().prev(), node); | ||
var count = res.count; | ||
var ret = res.return; | ||
@@ -96,3 +99,5 @@ if(res.pre) { | ||
self.jsdc.append('function(){'); | ||
self.jsdc.append('var ' + state + '=0;'); | ||
if(o.count) { | ||
self.jsdc.append('var ' + state + '=0;'); | ||
} | ||
self.jsdc.append('return function(){return{next:' + temp + '}};'); | ||
@@ -265,3 +270,5 @@ o.pos = self.jsdc.res.length; | ||
var o = self.hash[top.nid()]; | ||
self.jsdc.appendBefore(';' + o.state + '=-1;default:'); | ||
if(o.count) { | ||
self.jsdc.appendBefore(';' + o.state + '=-1;default:'); | ||
} | ||
} | ||
@@ -268,0 +275,0 @@ }); |
@@ -67,3 +67,4 @@ var homunculus = require('homunculus'); | ||
if(token.type() == Token.ID) { | ||
self.ids[token.content()] = true; | ||
//防止关键字或内置原生方法如hasOwnProperty被设置为true,将所有id前面加_记录 | ||
self.ids['_' + token.content()] = true; | ||
} | ||
@@ -414,3 +415,3 @@ }); | ||
while(temp = '_' + uid++) { | ||
if(!this.ids.hasOwnProperty(temp)) { | ||
if(!this.ids.hasOwnProperty('_' + temp)) { | ||
return temp; | ||
@@ -417,0 +418,0 @@ } |
@@ -56,7 +56,10 @@ define(function(require, exports, module) { | ||
self.jsdc.ignore(node.first(), 'gen6'); | ||
var state = self.jsdc.uid(); | ||
var state; | ||
var res = self.count(node.last().prev(), node); | ||
var count = res.count; | ||
if(count) { | ||
state = self.jsdc.uid(); | ||
} | ||
var temp = self.jsdc.uid(); | ||
var param = node.leaf(4).first(); | ||
var res = self.count(node.last().prev(), node); | ||
var count = res.count; | ||
var ret = res.return; | ||
@@ -97,3 +100,5 @@ if(res.pre) { | ||
self.jsdc.append('function(){'); | ||
self.jsdc.append('var ' + state + '=0;'); | ||
if(o.count) { | ||
self.jsdc.append('var ' + state + '=0;'); | ||
} | ||
self.jsdc.append('return function(){return{next:' + temp + '}};'); | ||
@@ -266,3 +271,5 @@ o.pos = self.jsdc.res.length; | ||
var o = self.hash[top.nid()]; | ||
self.jsdc.appendBefore(';' + o.state + '=-1;default:'); | ||
if(o.count) { | ||
self.jsdc.appendBefore(';' + o.state + '=-1;default:'); | ||
} | ||
} | ||
@@ -269,0 +276,0 @@ }); |
@@ -68,3 +68,4 @@ define(function(require, exports, module) { | ||
if(token.type() == Token.ID) { | ||
self.ids[token.content()] = true; | ||
//防止关键字或内置原生方法如hasOwnProperty被设置为true,将所有id前面加_记录 | ||
self.ids['_' + token.content()] = true; | ||
} | ||
@@ -415,3 +416,3 @@ }); | ||
while(temp = '_' + uid++) { | ||
if(!this.ids.hasOwnProperty(temp)) { | ||
if(!this.ids.hasOwnProperty('_' + temp)) { | ||
return temp; | ||
@@ -418,0 +419,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
321174
7373