Comparing version 0.5.10 to 0.5.11
@@ -0,0 +0,0 @@ if(typeof define === 'function' && (define.amd || define.cmd)) { |
{ | ||
"name": "jsdc", | ||
"version": "0.5.10", | ||
"version": "0.5.11", | ||
"description": "compiler ecmascript6 to ecmascript5", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -0,0 +0,0 @@ Javascript Downcast |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var events = {}; |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -11,2 +11,3 @@ var homunculus = require('homunculus'); | ||
this.hash = {}; | ||
this.hash2 = {}; | ||
this.sup = {}; | ||
@@ -197,2 +198,10 @@ this.gs = {}; | ||
if(node.next().name() == JsNode.ARGS) { | ||
var list = node.next().leaf(1); | ||
if(list.size() > 1) { | ||
var rest = list.last().prev(); | ||
//待被rest改写apply | ||
if(rest.isToken() && rest.token().content() == '...') { | ||
return; | ||
} | ||
} | ||
this.jsdc.append('.call'); | ||
@@ -220,7 +229,17 @@ } | ||
var i = this.jsdc.res.lastIndexOf('('); | ||
this.jsdc.insert('.call', i); | ||
if(node.size()) { | ||
var hasRest = false; | ||
if(node.size() > 1) { | ||
var rest = node.last().prev(); | ||
if(rest.isToken() && rest.token().content() == '...') { | ||
hasRest = true; | ||
} | ||
} | ||
if(!hasRest) { | ||
this.jsdc.insert('.call', i); | ||
} | ||
this.jsdc.append('this,'); | ||
} | ||
else { | ||
this.jsdc.insert('.call', i); | ||
this.jsdc.append('this'); | ||
@@ -251,3 +270,16 @@ } | ||
&& parent.prev().token().content() == 'super') { | ||
this.jsdc.appendBefore('this'); | ||
var list = parent.leaf(1); | ||
var hasRest = false; | ||
if(list.size() > 1) { | ||
var rest = list.last().prev(); | ||
if(rest.isToken() && rest.token().content() == '...') { | ||
hasRest = true; | ||
} | ||
} | ||
if(!hasRest) { | ||
this.jsdc.appendBefore('this'); | ||
} | ||
if(!hasRest && list.size()) { | ||
this.jsdc.appendBefore(','); | ||
} | ||
} | ||
@@ -254,0 +286,0 @@ } |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var fs = require('fs'); |
@@ -167,2 +167,3 @@ var homunculus = require('homunculus'); | ||
var o = this.hash2[parent.nid()]; | ||
var isSuper = false; | ||
if(o.needTemp) { | ||
@@ -175,6 +176,13 @@ //主表达式中含有生成的对象,不是直接引用,使用临时变量引用 | ||
var mmb = this.hash2[parent.nid()].node; | ||
this.jsdc.append(mmb.name() == JsNode.MMBEXPR ? join(mmb.first()) : 'this'); | ||
if(mmb.name() == JsNode.MMBEXPR) { | ||
var s = join(mmb.first()); | ||
isSuper = s == 'super'; | ||
this.jsdc.append(isSuper ? '' : s); | ||
} | ||
else { | ||
this.jsdc.append('this'); | ||
} | ||
} | ||
//用数组来concat可变参数,注意前面可能存在的固定参数需带上 | ||
this.jsdc.append(', ['); | ||
this.jsdc.append(isSuper ? '[' : ',['); | ||
var leaves = node.leaves(); | ||
@@ -181,0 +189,0 @@ for(var i = 0; i < leaves.length - 3; i++) { |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ exports.LINE = '\n'; |
@@ -0,0 +0,0 @@ function inheritPrototype(subType, superType) { |
@@ -0,0 +0,0 @@ function quickSort(arr, begin, end, compare) { |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var events = {}; |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -11,2 +11,3 @@ define(function(require, exports, module){var homunculus = require('homunculus'); | ||
this.hash = {}; | ||
this.hash2 = {}; | ||
this.sup = {}; | ||
@@ -197,2 +198,10 @@ this.gs = {}; | ||
if(node.next().name() == JsNode.ARGS) { | ||
var list = node.next().leaf(1); | ||
if(list.size() > 1) { | ||
var rest = list.last().prev(); | ||
//待被rest改写apply | ||
if(rest.isToken() && rest.token().content() == '...') { | ||
return; | ||
} | ||
} | ||
this.jsdc.append('.call'); | ||
@@ -220,7 +229,17 @@ } | ||
var i = this.jsdc.res.lastIndexOf('('); | ||
this.jsdc.insert('.call', i); | ||
if(node.size()) { | ||
var hasRest = false; | ||
if(node.size() > 1) { | ||
var rest = node.last().prev(); | ||
if(rest.isToken() && rest.token().content() == '...') { | ||
hasRest = true; | ||
} | ||
} | ||
if(!hasRest) { | ||
this.jsdc.insert('.call', i); | ||
} | ||
this.jsdc.append('this,'); | ||
} | ||
else { | ||
this.jsdc.insert('.call', i); | ||
this.jsdc.append('this'); | ||
@@ -251,3 +270,16 @@ } | ||
&& parent.prev().token().content() == 'super') { | ||
this.jsdc.appendBefore('this'); | ||
var list = parent.leaf(1); | ||
var hasRest = false; | ||
if(list.size() > 1) { | ||
var rest = list.last().prev(); | ||
if(rest.isToken() && rest.token().content() == '...') { | ||
hasRest = true; | ||
} | ||
} | ||
if(!hasRest) { | ||
this.jsdc.appendBefore('this'); | ||
} | ||
if(!hasRest && list.size()) { | ||
this.jsdc.appendBefore(','); | ||
} | ||
} | ||
@@ -254,0 +286,0 @@ } |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var fs = require('fs'); |
@@ -167,2 +167,3 @@ define(function(require, exports, module){var homunculus = require('homunculus'); | ||
var o = this.hash2[parent.nid()]; | ||
var isSuper = false; | ||
if(o.needTemp) { | ||
@@ -175,6 +176,13 @@ //主表达式中含有生成的对象,不是直接引用,使用临时变量引用 | ||
var mmb = this.hash2[parent.nid()].node; | ||
this.jsdc.append(mmb.name() == JsNode.MMBEXPR ? join(mmb.first()) : 'this'); | ||
if(mmb.name() == JsNode.MMBEXPR) { | ||
var s = join(mmb.first()); | ||
isSuper = s == 'super'; | ||
this.jsdc.append(isSuper ? '' : s); | ||
} | ||
else { | ||
this.jsdc.append('this'); | ||
} | ||
} | ||
//用数组来concat可变参数,注意前面可能存在的固定参数需带上 | ||
this.jsdc.append(', ['); | ||
this.jsdc.append(isSuper ? '[' : ',['); | ||
var leaves = node.leaves(); | ||
@@ -181,0 +189,0 @@ for(var i = 0; i < leaves.length - 3; i++) { |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){var homunculus = require('homunculus'); |
@@ -0,0 +0,0 @@ define(function(require, exports, module){exports.LINE = '\n'; |
@@ -0,0 +0,0 @@ define(function(require, exports, module){function inheritPrototype(subType, superType) { |
@@ -0,0 +0,0 @@ define(function(require, exports, module){function quickSort(arr, begin, end, compare) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
8119
307879
56